Raspberry Pi

Raspberry Pi (low level I/O electronics control)

Get started with Raspberry Pi (RPi), a step by step approach to get your Raspberry Pi with low level electronics hardware control.

Make simple, step by step.


Edited by Lim Siong Boon, last dated 22-Sep-2013.

Topic Discussion Overview

  1. Installation from scratch
  2. Hardware Pin Out
  3. Raspberry Pi, HelloWorld for I/O pins
  4. Understanding UART, SPI, I2C port on Raspberry Pi
  5. Networking on Raspberry Pi
  6. Accessing Raspberry Pi through the network
  7. C Programming
  8. Python Programming
  9. Java Programming
  10. List of frequent used Commands
  11. Add Wifi to Raspberry Pi


1. Installation from scratch

 

 

Your orientation to Raspberry Pi.

http://www.raspberrypi.org/

Status LED Indicator
OK  (Green) – SDCard Access       (D5 via GPIO16)
PWR (Red)   – 3.3 V Power         (D6           )
FDX (Green) – Full Duplex   (LAN) (D7 Model B   )
LNK (Green) – Link/Activity (LAN) (D8 Model B   )
10M (Yellow)- 10/100Mbit    (LAN) (D9 Model B   )

Click here for Raspberry Pi Schematic

STEP 01:

Download this quick start up guide to help you install your Linux OS on your Raspberry Pi.

STEP 02:

Get yourself a 4GB SD card, which is enough for use in many application.


NOTE: Not all SD cards work with the Raspberry Pi. High speed cards can be too fast for the Raspberry Pi bus. Check out which SD card is suitable for your Raspberry Pi. It has a lists of cards that have and have not worked for Raspberry Pi users. http://elinux.org/RPi_SD_cards

You may also like to check out the various peripherals that are compatiable to Raspberry Pi.
http://elinux.org/RPi_VerifiedPeripherals

 

STEP 03:

Format your SD card with SD Formatter 4.0 for SD/SDHC/SDXC
SDFormatter4exe.zip (5.99MB)

 

 

STEP 04:

You can download the image version New Out Of Box Software (NOOBS), extract all the files and copy into your SD card.

Insert this SD card into your Raspberry Pi, and power on it. Follow the instruction on your screen display to complete the installation process.

 

 

 

 

 

STEP 05:

You will be ask to select an Linux OS to install on your Raspberry Pi.

Choose the recommended “Raspian”, which is also the Raspbian “wheezy”.

The installation process will proceed.

 

Proceed to step 10.

Installing Raspbian operating system onto my Raspberry Pi.

 

 

 

STEP 06:

As of 02 Nov 2013, Raspbian now supports and pre-installed with Java.

Note: For those who want to run Java SDK on Raspberry Pi.

Raspbian “wheezy” is the recommended Linux OS for Raspberry Pi. This version is optimized to be run by Raspberry Pi which is using RP’s ARM processor supporting ‘hard-float’. However Java SDK only support ‘soft-float’ at this point in time (Jul 2013).

This call for another Debian Linux version which is known as Soft-float Debian “wheezy” (It is same as Raspbian “wheezy”, except that it will be slower. Use this version if you need to run Java JDK Linux ARM)

 

 

STEP 07:

Download and run the Win32DiskImager on your Windows Operating System.
win32diskimager-v0.8-binary.zip (5.67MB)

You can download the latest version at this website,
http://sourceforge.net/projects/win32diskimager/


STEP 08:

Unzip the Debian Linux version Soft-float Debian “wheezy”, which is a “2013-05-29-wheezy-armel.img” file.

Run the program Win32 Disk Imager.
a) Select the Image File “2013-05-29-wheezy-armel.img”
b) Select the Device, which is your storage drive for your SD card.
c) Click on the <Write> button to write the raw image onto your SD card.

Note: You can also use Win32 Disk Imager software to backup (clone)your existing SD card image, by click on the <Read> button, and choosing a *.img file name.

STEP 09:

Insert the SD card into your Raspberry Pi and power it up.

 

STEP 10:

On the first boot, the “raspi-config” menu will pop up.

raspi-config



Note: If you are at the command shell prompt. You can key in “sudo raspi-config” to access to this menu.

cmd prompt

“raspi-config” menu

raspi-config menu


Note: You may find yourself having problem when trying to key in the ‘#’ char by pressing <Shift+’3′>. A ” pound char may be generated instead.

This is because the Raspberry Pi’s default locale code is set as UK. You will need to set the locale code to US, for a US keyboard layout.

Key in the following command,
“sudo dpkg-reconfigure keyboard-configuration”

 

Alternative method to configure you keyboard layout.
a) key in “sudo nano /etc/default/keyboard”
b) look for the line containing “XKBLAYOUT=”gb””.
c) change “gb” to “us” for US keyboard layout.
d) save and exit.
e) reboot or key in the following “invoke-rc.d keyboard-setup start”, to reload the keymap.

STEP 11:

Select <1> and press enter to Expand Filesystem.

If you are connected to the network, select <8 Advanced Options> and press enter.

<A2 Hostname> to change the hostname default “raspberrypi”.

<A3 Memory Split> to configure the amount of ram allocation for GPU (graphic processing).

<A4 SSH> to enable or disable SSH (remote command access); it is enable by default.

<A5 Update> and then press enter to upgrade to the latest version of this tool. Try to perform this update.

“raspi-config” menu 8-A

raspi-config8A

ram for GPU

To change to the Standard US Keyboard mapping, select <4 Internationalisation Options>,

<I1 Change Locale>, with the following options,
Default Locale : None

<I2 Time Zone >, with the following options,
Geographic area: Asia
Time Zone      : Singapore

<I3>, with the following options,
Keyboard model : “Generic 105-key (Intl) PC”
Keyboard layout: “Others” -> “English (US)”
AltGr as       : “The default for the keyboard layout”
Compose Key    : “No compose key”
Ctrl+Alt+Backsp: “No”, (don’t use it to terminate Xserver)

You can also configure to allow the system to boot directly straight into the GUI desktop, using this raspi-config.

Select <Finish> then press enter to proceed to the system command shell.

You can always come back to this raspi-config menu again by executing the command “sudo raspi-config” from the shell command.

“raspi-config” menu 4-I

raspi-config4I menu

Very Very Important Note regarding boot up error

If you have encounter any error during the Linux operating system boot up, be sure to check the voltage level being supplied to your Raspberry Pi. It is a very common problem faced, if you have tried to power up your Raspberry Pi using any power adaptor that you have picked up.

Always check if your power adaptor is suitable by measuring the voltage supplied to your Raspberry Pi. If you deploy your Raspberry Pi for yoru project without ensuring that your power adaptor is ok, you may face random system error freeze/hang/halt. Problem can occur out of the norm. Be sure to check. Click here to find out how you can ensure that you are using the correct power adaptor and cable for your Raspberry Pi.

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

 

2. Hardware Pin Out

 

Raspberry Pi revision 2, header pins out.


3V3 1 2
5V

GPIO_2
<->SDA0 3 4
5V

GPIO_3
<->SCL0 5 6
Gnd

GPIO_4
GPCLK0 7 8
TXD->
GPIO_14

Gnd 9 10
RXD<-
GPIO_15
GPIO_17
GPIO0 11 12
GPIO1/PWM
GPIO_18
GPIO_27
GPIO2 13 14
Gnd

GPIO_22
GPIO3 15 16
GPIO4
GPIO_23

3V3 17 18
GPIO5
GPIO_24
GPIO_10
<-MOSI 19 20
Gnd

GPIO_9
->MISO 21 22
GPIO6
GPIO_29
GPIO_11
<-SCLK 23 24
CE0->
GPIO_8

Gnd 25 26
CE1->
GPIO_7

 

This is my Raspberry Pi. I have custom built a prototyping board that can be plugged on top of my Raspberry Pi. This prototyping board is soldered with 2.54mm housing connector (2 rows of 13 pins) so that I can easily access to the I/O pins of my Raspberry Pi.

My LED indicator wiring is as follows,
LED0 – GPIO_17 (Pin11)
LED1 – GPIO_18 (Pin12)
LED2 – GPIO_27 (Pin13)
LED3 – GPIO_22 (Pin15)
LED4 – GPIO_23 (Pin16)
LED5 – GPIO_24 (Pin18)
LED6 – GPIO_29 (Pin22)

UART (serial communication) wiring,
Gnd –         (Pin06)
TXD – GPIO_14 (Pin08)
RXD – GPIO_15 (Pin10)

SPI (serial communication) wiring,
MOSI – GPIO_10 (Pin19)
MISO – GPIO_09 (Pin21)
SCLK – GPIO_11 (Pin23)
CE0  – GPIO_08 (Pin24)
CE1  – GPIO_07 (Pin26)

I2C (serial communication) wiring,
SDA0 – GPIO_02 (Pin03)
SCL0 – GPIO_03 (Pin05)


GPIO input/output pin electrical characteristics
Output low voltage
VOL
< 0.40 V
< 0.66 V
< 0.40 V
Output high voltage
VOH
> 2.40 V
> 2.64 V
> 2.90 V
Input low voltage
VIL
< 0.80 V
< 0.54 V
< 1.15 V
Input high voltage
VIH
> 2.00 V
> 2.31 V
> 2.15 V
Hystereses > 0.25 V
   0.66 – 2.08 V
Schmitt trigger input low threshold
VT–
1.09 – 1.16 V
0.9
Schmitt trigger input high threshold
VT+
2.24 – 2.74 V
0.90 V
Pull-up/down
resistance
40 – 65KΩ
100KΩ
Pull-up/down
current
< 50 uA
< 28 uA
Pin capacitance 5 pF
Bus hold resistance 5-11KΩ

Information taken from
http://www.mosaic-industries.com/embedded-systems/

 

3. Raspberry Pi, HelloWorld for I/O pins  

Learning to control Raspberry Pi general purpose I/O pin 11 (which is known as GPIO_0, or GPIO_17 if base on BCM2835 IC pin assignment)Power on my Raspberry, and the operating system will prompt for my raspberrypi login.Key in “pi” for the login, and “raspberry” for the password.

 

raspberrypi login: pi
Password: raspberry

pi@raspberrypi ~ $

First start by keying the command “” to change to the root user, which have a higher privilege access rights to the system. pi@raspberrypi ~ $ sudo -i
You will see a new prompt -> root@raspberrypi:~#

Setup or initialise I/O port 17, by sending text “17” to the operating file system “/sys/class/gpio/export”

A directory folder will be created. “/sys/class/gpio/gpio17/”

root@raspberrypi:~# echo “17” > /sys/class/gpio/export
Setting the I/O pin as an output port, by sending text “out” to the operating file system “/sys/class/gpio/gpio17/direction” root@raspberrypi:~# echo “out” > /sys/class/gpio/gpio17/direction
To set logic 1 to the output port, send a text “1” to the operating file system “/sys/class/gpio/gpio17/value” root@raspberrypi:~# echo “1” > /sys/class/gpio/gpio17/value
My LED indicator0 (green color) gets lighted up. My very first hardware control using Raspberry Pi, Linux operating system. Yuppee…
To switch off my LED, send a text “0” to the operating file system “/sys/class/gpio/gpio17/value” root@raspberrypi:~# echo “0” > /sys/class/gpio/gpio17/value
 
Setting up an input port is quite similar. I will be using I/O port 18 as input.  
Setup I/O port 18. root@raspberrypi:~# echo “18” > /sys/class/gpio/export
Setup port 18 as an input port. root@raspberrypi:~# echo “in” > /sys/class/gpio/gpio18/direction
Reading input port 18. root@raspberrypi:~# cat /sys/class/gpio/gpio18/value
Command prompt will return the following value (logic 0) after reading the port. 0
root@raspberrypi:~#
The port 18, which is pin 12 on my Raspberry Pi is now connected to 3.3V to simulate a logic 1 input. The input port is then rRead in again. root@raspberrypi:~# cat /sys/class/gpio/gpio18/value
Command prompt will return the following value (logic 1) after reading the port, which is correct. 1
root@raspberrypi:~#

Reference:
http://elinux.org/RPi_Low-level_peripherals#GPIO_Driving_Example_.28C.29

 

 
 

I am able to control the I/O pins on my Raspberry Pi, but I want to larn more into controlling the I/O pins using native C. Controlling I/O pins using the “file directory system” like method will be very slow.The speed achieved base on this benchmark website, I/O control through this shell (or file directory system) method, achieved a maximum process speed of about 6.8kHz (2x 3.4kHz).To achieve a higher speed, I will need to use native C programming, which can process from 9.4Mhz to 44Mhz (2x 4.7Mhz to 22Mhz).

More things to learn…

 

References:

Notes regarding digital I/O pins, https://www.kernel.org/doc/Documentation/gpio.txt

 

 

4. Understanding UART, SPI, I2C port on Raspberry Pi  

UART

The UART port is actually pin8 (TxD) and pin10 (RxD) on the Raspberry Pi connectors. The UART signal is 3.3V.You can use RS232/RS422/RS485 communication to talk to the UART, but a level shifter (for example MAX3232) required. RS232 uses about +/- 7 to 13V, while UART uses digital voltage (1.8V, 3.3V or 5V). For our Raspberry Pi UART, it is 3.3V. More information about making your own level shifter, you can visit this page. There are also standard USB to UART products for interfacing to your Raspberry Pi.The Raspberry Pi default operating system uses this UART port as its diagnostic port. This port has the following default UART settings,
– Baudrate   : 115200bps
– Data       : 8 bits
– Parity     : None
– Handshaking: NoneThis default port act as another Linux shell terminal screen, as you would have seen on the screen through the Raspberry Pi’s HDMI or video output.

 

 

You can use a terminal program to access through this port.Using the Window’s Hyperterminal program, setup the correct com port settings. And connect the terminal. You will see nothing on the terminal screen, but actually the Raspberry Pi is prompting you for your login ID. This ID is “pi” which is similar to how you log on to your typical terminal screen. You will see the terminal replying you with the prompt for password. Key in the default password “raspberry”. You shall get a similar print out from the terminal program, as on the right. ->Looks very much like the typical terminal on your local display. This is mainly for troubleshooting, diagnostic or perhaps used for remote access of your Raspberry Pi.

 

raspberrypi login: pi
Password:
Last login: Wed Jun 19 15:36:44 UTC 2013 on tty1
Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6lThe programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
pi@raspberrypi:~$

The UART on the Raspberry Pi is quite an useful peripheral. For me, I would like to use this UART as a serial communication to control my other circuit modular.

In order to use this UART, I need to disable the diagnostic features from the operating system’s boot up. This means that I do not want the system to setup the UART pins as diagnotic port, when the system boots up.

 
This means that we need to edit the boot up file. Before we do any editing, it is good to save a backup copy of it. Type the copy command “cp” as follows. -> pi@raspberrypi ~ $ sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt

The following command is key in to edit the system boot up script. vi is an text editor program, which is not very user friendly.Alternative, you can use nano editor instead of vi for the text file editing.
Or gedit editor. You can install then if they are not installed.
“sudo apt-get install nano” or
“sudo apt-get install gedit ” To learn how to use the vi editor, click on the following link, http://www.unix-manuals.com/tutorials/vi/vi-in-10-1.html

A summary of the vi editor’s command is summeries as follows, http://osr600doc.sco.com/en/FD_create/vi_summary.html

pi@raspberrypi ~ $ sudo vi /boot/cmdline.txt

After the vi command, you should see the following screen display. This is the vi editor diaplaying the text in the “cmdline.txt file”.The objective is to delete the text (in red color), which is relating to the UART setup. Press ‘l’ on your keyboard to shift the cursor to the right, until it is at the position of the char that we want to delete. Move the cursor under the first char ‘c’ (char as illustrated in red).Press ‘x’ on your keyboard to delete the char one by one. You should observed the delete action.When all the text in red are deleted, press ‘:w’ on your keyboard, follow by a enter key to save the text file.Press ‘:q’ on your keyboard, follow by a enter key to exit the vi program.If at anytime you have edit wrongly, you can enter the command ‘:q!’ on your keyboard, to exit the vi program without saving the text file.

 

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
~
~
~
~
~
~

Your “cmdline.txt” should contain the following text after the editing. dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
~
~
~
Next edit inittab with the following command. pi@raspberrypi ~ $ sudo vi /etc/inittab

Find and comment away the line containing the following text (near the end of the file),
“T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100”,
by pressing the ‘j’ on your keyboard to scroll down line by line.Issue an insert command by pressing ‘i’ to insert some text before the cursor. Insert a char ‘#’ at the beginning of the line to comment the whole line. The ‘#’ mask off the whole line. The line that are masked off will not be intepreted by the system.After the ‘#’ char is inserted, press <Esc> key on your keyboard to end the insert command that was issued.Press ‘:w’ save the text file.

Press ‘:q’ to exit the vi program.

#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

The UART device name is /dev/ttyAMA0
Now the UART is not in use by the Linux Raspbian operating system, and is available for my own use.

 

 
Reboot for the operating system’s settings to take effect. pi@raspberrypi ~ $ sudo reboot
 

To test the UART serial communication port, we can install a program call minicom. The use of minicom is similar to hyperterminal program that I use in Windows operating system (OS).

Enter the command “sudo apt-get install minicom

There are also alternative GUI based serial communication program, cutecom.

pi@raspberrypi ~ $ sudo apt-get install minicom

Reading package lists… Done
Building dependency tree
Reading state information… Done

Need to get 420 kB of archives.
After this operation, 1,189 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main lrzsz armhf 0.12.21-5 [106 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main minicom armhf 2.6.1-1 [314 kB]
Fetched 420 kB in 13s (30.2 kB/s)

Unpacking minicom (from …/minicom_2.6.1-1_armhf.deb) …
Processing triggers for man-db …
Processing triggers for menu …
Setting up lrzsz (0.12.21-5) …
Setting up minicom (2.6.1-1) …
Processing triggers for menu …

To run the minicom terminal program. Key in the following command “sudo minicom -b 9600 -o -D /dev/ttyAMA0“.

-o              (skip initialisation)
-D /dev/ttyAMA0 (specify the serial port)

Key in command “man minicom” to find out the other options that you can set with the minicom program.

Configuration Settings:
Baudrate : 9600bps
Data bit : 8    (default)
Stop bits: 1    (default)
Parity   : None (default)

Apply the configuration settings to serial port “ttyAMA0”. The label tty (known as teletype) denotes all serial communication that the linux operating system is handling. In Raspberry Pi, ttyAMA0 refers to the pin8 (TxD) and pin10 (RxD).

When you type a char on your keyboard, an ascii char code is actually sent out of the Raspberry Pi ‘s pin8 (TxD). You will not be able to see it on the screen. What you will see on your screen will be those serial data that the Raspberry Pi received through pin10, which is the RxD.

In order to see what we have transmitted out from TxD, we can short the pin8 (TxD) and pin10 (RxD) together. This means that what you send will be receive and display on the display. The serial port configuration for the TxD and RxD is the same, so the serial data that is received will be exactly what you have transmitted.

The following text “Hello World!!! ” were typed on the keyboard after shorting the RxD and Txd pin. The text will be displayed, indicating that the UART is working properly.

Now that you know that the UART on your Raspberry Pi is ready for use, you can use it to communicate with many other peripheral.

Press <Ctrl + ‘A’>, followed by <‘X’>, then key in enter for “Yes” to quit the minicom program.

pi@raspberrypi ~ $ sudo minicom -b 9600 -o -D /dev/ttyAMA0

——————————————-
Welcome to minicom 2.6.1OPTIONS: I18n
Compiled on Apr 28 2012, 19:24:31.
Port /dev/ttyAMA0Press CTRL-A Z for help on special keysHello World!!!

CTRL-A Z for help | 9600 8N1 | NOR | Minicom 2.6.1 | VT102 | Offline
——————————————-

Setting up the serial port with other settings,
Baudrate : 115200bps
Data bit : 8    
Stop bits: 1    
Parity   : Even

pi@raspberrypi ~ $ sudo minicom -b 115200 -8 -o -D /dev/ttyAMA0
Key in command “sudo minicom -s ” to launch the minicom menu for other default settings, which can be save onto *.dfl files.
The default config file is minicom.dfl
 
Other related commands

– “dmesg | grep tty” checking up the UART available on the system.
 
   

SPI

The SPI port onboard the Raspberry is disable by default. The first thing to do is to enable the SPI port.

Edit the file “/etc/modprobe.d/raspi-blacklist.conf”

Comment off the line “blacklist spi-bcm2708” with a # in front.

Key in Ctrl+’X’ to exit, then ‘Y’ yes to save the change to the file, and finally ‘Enter’. This will brings you back to the command prompt.

pi@raspberrypi ~ $ sudo nano /etc/modprobe.d/raspi-blacklist.conf

GNU nano 2.2.6 File: /etc/modprobe.d/raspi-blacklist.conf Modified

# blacklist spi and i2c by default (many users don’t need them)

#blacklist spi-bcm2708
blacklist i2c-bcm27088

 

Reboot Raspberry Pi pi@raspberrypi ~ $ sudo reboot

Check to see if the SPI is successfully enable in the Raspberry Pi.

You should see “/dev/spidev0.0 /dev/spidev0.1” created.

0.0 means SPI0 CS0 (CS is the chip select)
0.1 means SPI0 CS1

pi@raspberrypi ~ $ ls /dev/spidev*
/dev/spidev0.0 /dev/spidev0.1
pi@raspberrypi ~ $

Testing the SPI port

download this SPI loopback test code written in ‘C’ programming language.

spidev_test.c

Compile the *.c file using gcc command,then run the compiled program.

You should see the following hex dump data, indicating all 0x00.

This means that the SPI is receiving nothing, no data.

pi@raspberrypi ~ $ gcc spidev_test.c -o spidev_test
pi@raspberrypi ~ $ sudo ./spidev_test -D /dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00
pi@raspberrypi ~ $

Now we do a SPI data loopback test.
Short the pins MISO (GPIO 9, Pin21) and MOSI (GPIO 10, Pin19) on your Raspberry Pie. This will enables the SPI MISO to received whatever data that is sent out from the MOSI pins.

From this test, we will be able to know if SPI hardware for sending and receving is working ok. Whatever that is sent out, the data should be properly received.

Run the compiled program again.

You should see the following hex dump data. This means that your SPI peripheral is working fine.

pi@raspberrypi ~ $ sudo ./spidev_test -D /dev/spidev0.0

spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D
pi@raspberrypi ~ $

   

I2C

The SPI port onboard the Raspberry is disable by default. The first thing to do is to enable the SPI port.

Edit the file “/etc/modprobe.d/raspi-blacklist.conf”

Comment off the line “blacklist i2c-bcm2708” with a # in front.

Key in Ctrl+’X’ to exit, then ‘Y’ yes to save the change to the file, and finally ‘Enter’. This will brings you back to the command prompt.

pi@raspberrypi ~ $ sudo nano /etc/modprobe.d/raspi-blacklist.conf

GNU nano 2.2.6 File: /etc/modprobe.d/raspi-blacklist.conf Modified

# blacklist spi and i2c by default (many users don’t need them)

blacklist spi-bcm2708
#blacklist i2c-bcm27088

 

Edit the file “/etc/modules”

Add in “i2c-dev” to the end of the file.

Key in Ctrl+’X’ to exit, then ‘Y’ yes to save the change to the file, and finally ‘Enter’. This will brings you back to the command prompt.

pi@raspberrypi ~ $ sudo nano /etc/modules

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.
# Parameters can be specified after the module name.

snd-bcm2835
i2c-dev

 

Install I2C Tools to test on the I2C peripheral. pi@raspberrypi ~ $ sudo apt-get install i2c-tools
Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
libi2c-dev python-smbus
The following NEW packages will be installed:
i2c-tools
0 upgraded, 1 newly installed, 0 to remove and 52 not upgraded.
Need to get 59.5 kB of archives.
After this operation, 223 kB of additional disk space will be used.
Get:1 http://http.debian.net/debian/ wheezy/main i2c-tools armel 3.1.0-2 [59.5 kB]
Fetched 59.5 kB in 4s (12.5 kB/s)
Selecting previously unselected package i2c-tools.
(Reading database … 57047 files and directories currently installed.)
Unpacking i2c-tools (from …/i2c-tools_3.1.0-2_armel.deb) …
Processing triggers for man-db …
Setting up i2c-tools (3.1.0-2) …

Allow Pi User to Access I2C peripheral.

This allow configuration of the software.

pi@raspberrypi ~ $ sudo adduser pi i2c
Adding user `pi’ to group `i2c’ …
Adding user pi to group i2c
Done.
Reboot Raspberry Pi pi@raspberrypi ~ $ sudo reboot

Check to see if the SPI is successfully enable in the Raspberry Pi.

You should see “/dev/i2c-0 /dev/i2c-1” created.

pi@raspberrypi ~ $ ls /dev/i2c*
/dev/i2c-0 /dev/i2c-1
pi@raspberrypi ~ $

Running the test program.

You will see that there is a total of 0x77 or 119 blanks “–“. This indicates that no I2C devices is detected on the bus.

pi@raspberrypi ~ $ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: — — — — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — — —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — —
40: — — — — — — — — — — — — — — — —
50: — — — — — — — — — — — — — — — —
60: — — — — — — — — — — — — — — — —
70: — — — — — — — —
If the I2C devices is on the I2C bus, it will appeared as follows.
For this example, the I2C devices has an address of 0x60. The software detects a device is currently onto the I2C data bus.
pi@raspberrypi ~ $ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: — — — — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — — —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — —
40: — — — — — — — — — — — — — — — —
50: — — — — — — — — — — — — — — — —
60: 60 — — — — — — — — — — — — — — —
70: — — — — — — — —

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller


5. Networking on Raspberry Pi References:
Installing Samba program
Checking the IP setting on my Raspberry Pi. pi@raspberrypi 
Ping gateway 192.168.1.1 pi@raspberrypi ping 192.168.1.1 -c 4
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.98 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.17 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=1.19 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=1.23 ms

— 192.168.1.1 ping statistics —
4 packets transmitted, 4 packets received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.171/1.399/1.988/0.340 ms
Ping website www.yahoo.com.sg pi@raspberrypi ~ $ ping yahoo.com.sg -c 4
PING yahoo.com.sg (106.10.165.51) 56(84) bytes of data.
64 bytes from w2.rc.vip.sg3.yahoo.com (106.10.165.51): icmp_seq=1 ttl=51 time=16.9 ms
64 bytes from w2.rc.vip.sg3.yahoo.com (106.10.165.51): icmp_seq=2 ttl=51 time=28.1 ms
64 bytes from w2.rc.vip.sg3.yahoo.com (106.10.165.51): icmp_seq=3 ttl=51 time=20.3 ms
64 bytes from w2.rc.vip.sg3.yahoo.com (106.10.165.51): icmp_seq=4 ttl=51 time=17.5 ms

— yahoo.com.sg ping statistics —
4 packets transmitted, 4 packets received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 16.996/20.762/28.140/4.441 ms

Other command:
ifconfig eth0 (display the first ethernet adaptor)
– ifconfig -a (show all network interface, active or inactive)
traceroute

 
 

Install Samba on the system so that my Raspberry Pi can be access from a Window operating system.

Ensure that the network cable (internet enabled) is plugged onto the Raspberry Pi before powering on the board. Enter the following command to install samba software. The process will fetch the installation from the internet.

pi@raspberrypi ~ $ sudo apt-get install samba samba-common-bin
Optional:
Enable security on the Samba server on the Raspberry Pi (RPi)
 
Making a backup of the samba configuration file. pi@raspberrypi ~ $ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
Edit the samba configuration file using the nano text editor pi@raspberrypi ~ $ sudo nano /etc/samba/smb.conf

Search for the section marked ##### Authentication #####,
Change the following text “# security = user” to “security = user”.
To save the text file, Press “Ctrl+X”, then ‘Y’, then enter.

 
Restart samba to use the new configuration file. pi@raspberrypi ~ $ sudo /etc/init.d/samba restart
[ ok ] Stopping Samba daemons: nmdb smdb
[ ok ] Stopping Samba daemons: nmdb smdb

Use command “hostname -I” to check the IP address.

Alternate command “ifconfig” to check the IP address of my Raspberry Pi, which IP address is “192.168.1.99”

pi@raspberrypi ~ $ hostname -I
192.168.1.99

pi@raspberrypi ~ $  ifconfig
eth0  Link encap:Ethernet  HWaddr b8:27:eb:dc:ee:af
      inet addr:192.168.1.99  Bcast:192.168.1.255  Mask:255.255.255.0
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:337 errors:0 dropped:0 overruns:0 frame:0
      TX packets:198 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:30734 (30.0 Kib)  TX bytes:20136 (19.6 Kib)

Or using command “ip address show” pi@raspberrypi ~ $ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:dc:ee:af brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.95/24 brd 192.168.1.255 scope global eth0
Configuring your network settings
sudo nano /etc/network/interfaces
 pi@raspberrypi ~ $ sudo nano /etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
To set static IP address, edit the file “interfaces” to the example as follows.
Save the file and reboot Raspberry Pi for the changes to take effect.
auto lo

iface lo inet loopback

#wired connection (using static IP address, instead of DHCP to auto allocate IP)
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.201
netmask 255.255.255.0
gateway 192.168.1.1

#wireless connection (using static IP address, instead of DHCP to auto allocate IP)
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface wlan0 inet dhcp
iface wlan0 inet static
address 192.168.1.202
netmask 255.255.255.0
gateway 192.168.1.1
#iface default inet dhcp

Go to window’s to map a network drive. The network folder path is “//192.168.1.99”. Check box for “Reconnect at logon” & “Connect using different credentials”

 

Check the network and port bind on the Raspberry Pi.

 

From the list, it can be seen that UDP port 6324 is currently being used by process ID PID 2361/java program.

 pi@raspberrypi ~ $ netstat -nlptu
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN –
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN –
udp 0 0 192.168.1.99:123 0.0.0.0:* –
udp 0 0 127.0.0.1:123 0.0.0.0:* –
udp 0 0 0.0.0.0:123 0.0.0.0:* –
udp 0 0 0.0.0.0:51876 0.0.0.0:* –
udp 0 0 0.0.0.0:6324 0.0.0.0:* 2361/java
udp 0 0 0.0.0.0:68 0.0.0.0:* –
Setting up a secure home Web Server with Raspberry Pi

 

6. Accessing Raspberry Pi through the network

Sometimes you may like to access to your Raspberry Pi without connecting your display monitor and your keyboard. This section provide a guide to allow access to your Raspberry Pi remotely through network connection.

 

Checking the IP setting on the Raspberry Pi, using command “ip address show”. For my Raspberry Pi, the IP address is 192.168.1.95. pi@raspberrypi ~ $ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:dc:ee:af brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.95/24 brd 192.168.1.255 scope global eth0

How to locate your Raspberry Pi IP address from a remote computer?

The method above requires you to plugged a monitor display to your Raspberry Pi in order to obtain its IP address. The following method allows you to obtain raspberry pi address through thr

You can also check the IP address of your Raspberry Pi that is plugged into a dynamic network through the router webserver. Typical router’s IP address for a local network is 192.168.1.1. You will need your user name and password to log into the router’s webserver. From the webserver, you should be able to locate the device name “raspberrypi” (or known as hostname) and its allocated dynamic IP address and its MAC address.

Alternative, you can use this software “Advance Port Scanner” to scan for your Raspberry Device on the network.

pi@raspberrypi ~ $ hostname
raspberrypi


 

Note: To change the Raspberry Pi’s hostname “raspberrypi”, use nano text editor to edit the following file “/etc/hostname” and “/etc/hosts”. Replace the old hostname “raspberrypi” to your new hostname. Your new hostname can only contains lower/upper case character, numbers, and ‘-‘.

Your new hostname will appear on the raspberry prompt, after the device reboot.

pi@raspberrypi ~ $ sudo nano /etc/hostname

pi@raspberrypi ~ $ sudo nano /etc/hosts

pi@raspberrypi ~ $ sudo reboot

pi@newHostname ~ $

Download this program MobaXterm, and install in your Window operating system. You can download from http://mobaxterm.mobatek.net/


Alternative, you can also use this program call Putty.
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Alternative, you can also use this program call Filezilla
https://filezilla-project.org/ (for Microsoft Windows OS).
or (for Linux OS) “sudo apt-get install filezilla”

These program allow SSH connection logging in to your Raspberry Pi. You will be able to see what you would see with the display monitor and keyboard connected to your Raspberry Pi

 

Run the installed MobaXterm program.
Click on “Session”->”Open New Session”.
Choose “SSH” as the session type.
Key in the IP address of your Raspberry Pi.
The standard port number for SSH Remote Login Protocol is 22.

 

Click “OK” to connect to your Raspberry Pi.

Key in the Login user name “pi”, then press enter, and
standard password “raspberry” then press enter key.

You will see the following display as on the right.

Login: pi
Permanently added ‘192.168.1.95’ (ECDSA) to the list of known hosts.
rasppi@192.168.1.95’s password:
Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6lThe programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jul 22 13:47:57 2013
pi@raspberrypi ~ $

You may encounter the following error on the right.
If not, you can skip this section.
This happens when you login successfully for the first time, but then you reinstall the server. The key becomes different, and you get prompt for this security message.Access into your Raspberry Pi and key in the following command,
rm -f ~/.ssh/known_hosts

Delete from your client computer.
C:\Users\LSB\Documents\MobaXterm\home\.ssh\known_hosts.

You may need to reboot the Linux in order for the change to take effect “sudo reboot”.

It should solve the problem. For more information regarding this issue, you can visit the following website,
http://www.geekride.com/ssh-warning-remote-host-identification-has-changed/


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is xx:xx:xx:xx:b1:66:fd:05:0c:43: …. … .. .

Congratulation. You have access your Raspberry Pi remotely through the network.  
To remotely access the desktop GUI of your Raspberry Pi, key in the following command from your MobaXterm’s command console. The ‘&’ at the end of the command help launch the application in the background (another thread process) so that we can continue using the terminal. pi@raspberrypi ~ $ lxsession&
The Raspberry Pi’s desktop will be launched from your Window operating system, as follows…
GUI application can also be launched directly within WinOS without accessing to the Raspberry Pi Linux desktop.

pi@raspberrypi ~ $ leadpad&

Using MobaXterm, you can actually drag and drop file in the lower left corner of the MobaXterm’s windows.
Key in “exit”, then press enter, to terminate the session. pi@raspberrypi ~ $ exit

 

7. C Programming on Raspberry Pi, Hello World!!!  
Classic first program to write every time we learn a new programming language on a new platform.  
Type in “gcc” command with a flag -v to see the version of the C complier.

pi@raspberrypi ~ $ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO…


Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14+rpi1)

Create a folder “tutorial” to hold the files for this tutorial pi@raspberrypi ~ $ mkdir tutorial
Get into the newly create tutorial folder pi@raspberrypi ~ $ cd tutorial
Create a “main.c” file using the program nano (text editor) pi@raspberrypi ~ $ sudo nano main.c

Key in the following hello world source code into the nano editor.

When finish typing in the source code text, press CTRL+X to save this file “main.c”, press ‘Y’ to confirm. Press enter key to finish the process.

#include <stdio.h>

int main()
{
   printf(“Hello World!!!”);
   return(0);
}

Now compile the source code file “main.c” to executable file “main” pi@raspberrypi ~ $ gcc -o main main.c
Now execute the file “main”, you should see the text “Hello World!!!” as you have programmed in the source code. pi@raspberrypi ~ $ ./main
Hello World!!!

For compiling C++ language (*.cpp file), use g++ compiler.

 

 

8. Python Programming on Raspberry Pi, Hello World!!!  
Classic first program to write every time we learn a new programming language on a new platform.  
Type in “python -V ” command to see the version of the C complier.

pi@raspberrypi ~ $ python -V
Python 2.7.3

Run the python program, and key in the python script directly onto the python command line.

Type the script >>> print “Hello World!!!”

You will see the “Hellow World!!!” text echo back.

Press <Ctrl+’z’> to terminate the Python program.
pi@raspberrypi ~ $ sudo python
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> print “Hello World!!!”
Hello World!!!
>>>
You can also write the phython codes onto a *.py file, and run directly from the file saved with python scripts.

Create a folder “python_tutorial” to hold the files for this tutorial
pi@raspberrypi ~ $ mkdir python_tutorial
Get into the newly create tutorial folder pi@raspberrypi ~ $ cd python_tutorial
Create a “hello.py” file using the program nano (text editor) pi@raspberrypi ~ $ sudo nano hello.py

Key in the following hello world source code into the nano editor.

When finish typing in the source code text, press CTRL+X to save this file “hello.py“, press ‘Y’ to confirm. Press enter key to finish the process.

#!/usr/bin/python

print “Hello World!!!”nt “Boon, you’re awesome”
else :
print “Hello”, name

Now execute the file “hello.py”, you should see the text “Hello World!!!” as you have programmed in the source code. pi@raspberrypi ~ $ python hello.py
Alternative, you can make the file executable, and execute the file directly. pi@raspberrypi ~ $ chmod a+x hello.py
pi@raspberrypi ~ $ ./hello.py
Hello World!!!

Using Python to control the digital I/O port.
Before starting to program your I/O on Raspberry Pi, we will need to download and setup the library.

pi@raspberrypi ~ $ wget http://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.1.0.tar.gz
pi@raspberrypi ~ $ tar zxf RPi.GPIO-0.1.0.tar.gz
pi@raspberrypi ~ $ cd RPi.GPIO-0.1.0
pi@raspberrypi ~ $ sudo python setup.py install

Try controlling the Raspberry Pi’s digital I/O GPIO1 (pin12 of the header, GPIO18) as output port, using Python script.

1) import RPi.GPIO
2) setup I/O direction, as output port.
3) set digital I/O port to logic ‘1’, high
4) set digital I/O port to logic ‘0’, low

You should see the LED lights up and switched off, if wired an indicator to pin 12.

pi@raspberrypi ~ $ sudo Python
>>> import RPi.GPIO as GPIO
>>> GPIO.setup(18, GPIO.OUT)
>>> GPIO.output(18, True)
>>> GPIO.output(18, False)

Example of a typical python’s source code.

#!/usr/bin/python

import sys
import time
import serial

#print title
print(“start python program.”)#print out the arg passed from command line
for arg in sys.argv:
  print arg#delay 0.1sec
time.sleep(0.1)
#delay 1.0sec
time.sleep(1) #setup serial port
port = serial.Serial(“/dev/ttyAMA0”, baudrate=115200, timeout=3.0)#get user input
name = raw_input(‘what is your name? ‘)#conditional statement
if name == ‘Boon’ :
  print “Boon, you’re awesome”
else :
  print “Hello”, name

#while loop
while True:
  port.write(“\r\nSay something:”)
  rcv = port.read(10)
  port.write(“\r\nYou sent:” + repr(rcv))

Python code example for I/O.

#!/usr/bin/python

import time
import RPi.GPIO as GPIO

GPIO.setup(11, GPIO.IN)
while True:
  mybutton = GPIO.input(11)
  if mybutton == False:
    print “giggle”
  time.sleep(.2)

#!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setup(11, GPIO.IN)
GPIO.setup(12, GPIO.OUT)
while True:
  if GPIO.input(11):
    GPIO.output(12, True)
  else:
    GPIO.output(12, False)
Invoke system command (shell command) from Python script. >>> import commands
>>> commands.getstatusoutput(‘ls /bin/ls’)
(0, ‘/bin/ls’)
>>> commands.getstatusoutput(‘cat /bin/junk’)
(256, ‘cat: /bin/junk: No such file or directory’)
>>> commands.getstatusoutput(‘/bin/junk’)
(256, ‘sh: /bin/junk: not found’)
>>> commands.getoutput(‘ls /bin/ls’)
‘/bin/ls’
>>> commands.getstatus(‘/bin/ls’)
‘-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls’

 

9. Java Programming on Raspberry Pi, Hello World!!!  

Note: As of Nov 2013, the official operating system for Raspberry Pi “Raspian” is installed with Java by default. Proceed to the step for installing Pi4J.

Installing Java to your Raspberry Pi

First, we will need to download and instal the Java JDK onto the Raspberry Pi.Do take note that the JDK version that we will be downloading is meant for Linux ARM processor “Linux ARM v6/v7 Soft Float ABI”.
(28 July 2013)
JDK for Linux ARM, “jdk-21-linux-arm-sfp.tar.gz (65.12MB)”



You can download the lastest version of this file from this Java website,
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Remember to accept the Oracle Binary Code License Agreement for Java SE.

Untar the Java JDK distribution file. pi@raspberrypi ~ $ tar xvzf ~/jdk-7u21-linux-arm-sfp.tar.gz
Create a java directory and move the untarred distribution to it.
Delete the tar file once we are done.
pi@raspberrypi ~ $ sudo mkdir -p -v /opt/java
pi@raspberrypi ~ $ sudo mv -v ~/jdk1.7.0_21 /opt/java/
pi@raspberrypi ~ $ rm ~/jdk-7u21-linux-arm-sfp.tar.gz
Create the environment paths to the java and javac commands so that they can be used anywhere in the command line environment. pi@raspberrypi ~ $ sudo update-alternatives –install “/usr/bin/java” “java” “/opt/java/jdk1.7.0_21/bin/java” 1
pi@raspberrypi ~ $ sudo update-alternatives –set java /opt/java/jdk1.7.0_21/bin/java
pi@raspberrypi ~ $ sudo update-alternatives –install “/usr/bin/javac” “javac” “/opt/java/jdk1.7.0_21/bin/javac” 1
pi@raspberrypi ~ $ sudo update-alternatives –set javac /opt/java/jdk1.7.0_21/bin/javac

Check that the Java environment variable is setup correctly.

Note: If the following error is encountered when the command “java -version” is executed.
java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

It is propably that you have installed the incorrect version of Debian Linux. At this point in time, Java SDK for Linux ARM has yet to support.

Please refer to the previous section, for the installtion of the correct Debian Linux version for use with Java SDK Linux ARM.

pi@raspberrypi ~ $ java -version
java version “1.7.0_21”
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode)
Installing PI4J, a bridge project between the native libraries and Java for full access to the Raspberry Pi’s peripheral.

Check out PI4J website for more information.
pi@raspberrypi ~ $ wget http://pi4j.googlecode.com/files/pi4j-0.0.5.deb
pi@raspberrypi ~ $ sudo dpkg -i pi4j-0.0.5.deb

Check if PI4J is installed correctly.
Go to PI4J directory.
Compile the example “WiringPiGpioExample.java”.
Run the compile java program “WiringPiGpioExample”.

I am able to see my rows of LED lighting up in a wave sequence, up and down non-stop.

pi@raspberrypi ~ $ cd /opt/pi4j/examples/
pi@raspberrypi /opt/pi4j/examples $ sudo javac -classpath .:classes:/opt/pi4j/lib/’*’ -d . WiringPiGpioExample.java
pi@raspberrypi /opt/pi4j/examples $ sudo java -classpath .:classes:/opt/pi4j/lib/’*’ WiringPiGpioExample

To uninstall PI4J, check out the following command. pi@raspberrypi ~ $ sudo dpkg -r pi4j

Testing out with a simple Java program.
Let us do a hello world example.

Key in “nano hello.java”.
This will open a text editor for us to key in the java source code for our hello world example.

Key in the following java source code.

Press ‘Ctrl+X’ to exit, then ‘Y’ to save, then press ‘Enter’.

pi@raspberrypi ~ $ nano hello.java

class hello
{
   public static void main(String args[])
   {
      System.out.println(“Hello World!”);
   }
}

Compile the java source code “hello.java”, a java compiled file “hello.class” will be generated.

 

pi@raspberrypi ~ $ javac hello.java

To run the program, key in “java hello”.

You should be able to see the printed text “Hello World!” after execution.

pi@raspberrypi ~ $ java hello
Hello World!

Looking back to the wiringPi, which is the library for java to access to the native hardware I/O on the Raspberry Pi.

Taking a look at the java code using pi4j wiringPi.

WiringPiGpioExample.java

 

import com.pi4j.wiringpi.Gpio;
import com.pi4j.wiringpi.GpioUtil;

public class WiringPiGpioExample {
    
    // Simple sequencer data
    // Triplets of LED, On/Off and delay

    private static final int data[] = { 
            0, 1, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 3, 1, 1, 2, 0, 0, 4, 1, 1, 3, 0, 0, 5, 1, 1, 4,
            0, 0, 6, 1, 1, 5, 0, 0, 7, 1, 1, 6, 0, 1, 7, 0, 1,
            0, 0,
            1, // Extra delay
            // Back again
            7, 1, 1, 6, 1, 1, 7, 0, 0, 5, 1, 1, 6, 0, 0, 4, 1, 1, 5, 0, 0, 3, 1, 1, 4, 0, 0, 2, 1,
            1, 3, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1,
            0, 0, 1, // Extra delay
            9, 9, 9, // End marker
    };

    public static void main(String args[]) throws InterruptedException {
        int pin;
        int dataPtr;
        int l, s, d;
        
        System.out.println("<--Pi4J--> GPIO test program");

        // setup wiringPi
        if (Gpio.wiringPiSetup() == -1) {
            System.out.println(" ==>> GPIO SETUP FAILED");
            return;
        }

        // set GPIO 4 as the input trigger 
        GpioUtil.export(7, GpioUtil.DIRECTION_IN);
        GpioUtil.setEdgeDetection(7, GpioUtil.EDGE_BOTH);
        Gpio.pinMode (7, Gpio.INPUT) ;  
        Gpio.pullUpDnControl(7, Gpio.PUD_DOWN);        

        // set all other GPIO as outputs
        for (pin = 0; pin < 7; ++pin) {
            // export all the GPIO pins that we will be using
            GpioUtil.export(pin, GpioUtil.DIRECTION_OUT);            
            Gpio.pinMode(pin, Gpio.OUTPUT);
        }
        
        dataPtr = 0;
        for (;;) {
            l = data[dataPtr++]; // LED
            s = data[dataPtr++]; // State
            d = data[dataPtr++]; // Duration (10ths)

            if ((l + s + d) == 27) {
                dataPtr = 0;
                continue;
            }

            Gpio.digitalWrite(l, s);
            
            if (Gpio.digitalRead(7) == 1) // Pressed as our switch shorts to ground
                Gpio.delay(d * 10); // Faster!
            else
                Gpio.delay(d * 100);
        }
    }
}
Compile the “WiringPiGpioExample.java” with the pi4j lib files pi@raspberrypi ~ $  javac -classpath .:classes:/opt/pi4j/lib/’*’ -d . WiringPiGpioExample.java

Run the java program.

You may notice “wiringPiSetup: Unable to open /dev/mem”. This means that you do not have access to the hardware.

 

 

Run the java program with the “sudo” in front as follows.

You should see the LED light running from left to right.

pi@raspberrypi ~ $ java -classpath .:classes:/opt/pi4j/lib/’*’ WiringPiGpioExample

<–Pi4J–> GPIO test program
wiringPiSetup: Unable to open /dev/mem: Permission denied
==>> GPIO SETUP FAILED

pi@raspberrypi ~ $ sudo java -classpath .:classes:/opt/pi4j/lib/’*’ WiringPiGpioExample

<–Pi4J–> GPIO test program

   

Serial Java Programming with pi4j on Raspberry Pi

SerialExample.java

import java.util.Date;

import com.pi4j.io.serial.Serial;
import com.pi4j.io.serial.SerialDataEvent;
import com.pi4j.io.serial.SerialDataListener;
import com.pi4j.io.serial.SerialFactory;
import com.pi4j.io.serial.SerialPortException;

/**
* This example code demonstrates how to perform serial communications using the Raspberry Pi.
*
* @author Robert Savage
*/
public class SerialExample {
    
    public static void main(String args[]) throws InterruptedException {
        
        // !! ATTENTION !!
        // By default, the serial port is configured as a console port
        // for interacting with the Linux OS shell. If you want to use
        // the serial port in a software program, you must disable the
        // OS from using this port. Please see this blog article by
        // Clayton Smith for step-by-step instructions on how to disable
        // the OS console for this port:
        // http://www.irrational.net/2012/04/19/using-the-raspberry-pis-serial-port/
                
        System.out.println("<--Pi4J--> Serial Communication Example ... started.");
        System.out.println(" ... connect using settings: 38400, N, 8, 1.");
        System.out.println(" ... data received on serial port should be displayed below.");
        
        // create an instance of the serial communications class
        final Serial serial = SerialFactory.createInstance();

        // create and register the serial data listener
        serial.addListener(new SerialDataListener() {
            @Override
            public void dataReceived(SerialDataEvent event) {
                // print out the data received to the console
                System.out.print(event.getData());
            }
        });
                
        try {
            // open the default serial port provided on the GPIO header
            serial.open(Serial.DEFAULT_COM_PORT, 38400);
            
            // continuous loop to keep the program running until the user terminates the program
            for (;;) {
                try {
                    // write a formatted string to the serial transmit buffer
                    serial.write("CURRENT TIME: %s", new Date().toString());
    
                    // write a individual bytes to the serial transmit buffer
                    serial.write((byte) 13);
                    serial.write((byte) 10);
    
                    // write a simple string to the serial transmit buffer
                    serial.write("Second Line");
    
                    // write a individual characters to the serial transmit buffer
                    serial.write('\r');
                    serial.write('\n');
    
                    // write a string terminating with CR+LF to the serial transmit buffer
                    serial.writeln("Third Line");
                }
                catch(IllegalStateException ex){
                    ex.printStackTrace();
                }
                
                // wait 1 second before continuing
                Thread.sleep(1000);
            }
            
        }
        catch(SerialPortException ex) {
            System.out.println(" ==>> SERIAL SETUP FAILED : " + ex.getMessage());
            return;
        }
    }
}
Compile the “SerialExample.java pi@raspberrypi ~ $ javac -classpath .:classes:/opt/pi4j/lib/’*’ -d . SerialExample.java

Run the “SerialExample.java

If you encounter error when opening the serial port, do check out the eariler posting to ensure that the serial port is properly configured.

 

pi@raspberrypi ~ $ java -classpath .:classes:/opt/pi4j/lib/’*’ SerialExample
If you short the TX (GPIO_14, Pin08) & RX (GPIO_15, Pin10)pin on the Raspberry Pi, you should be able to see the following timestamp messages.
Raspberry Pi transmit the timestamp message for each second.

If the RX pin received data from other serial devices, the data can be seen on the console as well.

CURRENT TIME: Mon Nov 04 12:23:23 SGT 2013
Second Line
Third Line
CURRENT TIME: Mon Nov 04 12:23:24 SGT 2013
Second Line
Third Line
CURRENT TIME: Mon Nov 04 12:23:25 SGT 2013
Second Line
Third Line

   
SPI Java Programming with pi4j on Raspberry Pi  
   

Java examples (taken from www.pi4j.com)

WiringPiGpioExample.java
ControlGpioExample.java
ListenGpioExample.java
ShutdownGpioExample.java
TriggerGpioExample.java
SerialExample.java
SystemInfoExample.java

 
   

Linux bash script for launching/starting Java program. The command to launch Java is similar to those in WinOs, except for some notation changes. Note the use of char ‘:’ as the seperator and the slash ‘/’ for its file path. WinOS uses ‘;’ and the backslash ‘\’.
The script is similar to the batch file used in WinOS.

The following is an example of the script,
run.sh

Key in “. run.sh” to run the script in Linux command prompt.
Note: remember to make this file “run.sh” executable. (see examples in this website.)

inside file “run.sh”
#!/bin/bash
echo “Running SmartHomeSensors Java Program…”
java -classpath .:bin:lib/log4j-1.2.14.jar:lib/commons-logging-1.1.jar:classes:/opt/pi4j/lib/’*’:lib/json-simple-1.1.1.jar:lib/org.apache.httpcomponents.httpclient_4.3.1.jar:lib/utilities.jar:resource com.picControl.smartHomeSensors.MyMain

pi@raspberrypi ~ $ . run.sh

To auto run the script which launch the java program upon Raspberry Pi boot up (startup), edit the file “rc.local”.

Add in the following to the file,

cd /home/pi/smartHomeSensor
echo “Run script for SmartHomeSensor Java program”
SCRIPT=”/home/pi/smartHomeSensor/run.sh”
echo “run script \”-> $SCRIPT\””
sudo $SCRIPT &

 

The add command set the current directory to the project folder. During the boot process, it cannot be assume that you are in the user directory. Reference to the root directory to be safe.

Use sudo to run the script, and make the script run in the background.

pi@raspberrypi ~ $ sudo nano /etc/rc.local


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ “$_IP” ]; then
   printf “My IP address is %s\n” “$_IP”
fi

cd /home/pi/smartHomeSensor
echo “Run script for SmartHomeSensor Java program”ensor Java program”
SCRIPT=”/home/pi/smartHomeSensor/run.sh”
echo “run script \”-> $SCRIPT\””
sudo $SCRIPT &

exit 0

save and reboot Raspberry Pi. After the Raspberry Pi reboot, you should be able to see the text “Run script for SmartHomeSensor Java program” printed before the user prompt or login. There should be no error message.

pi@raspberrypi ~ $ sudo nano /etc/rc.local

 

Login to check if the java process is running.
command “ps ax” print out the list of processes (thread) currently running in Raspberry Pi. “| grep java” pipe the output result and print out only those result that have the word “java” in it.

The result shows that the java program is running with PID 2242 (process ID). Remember this number, for you may need to use it to kill the process.

 

pi@raspberrypi ~ $ ps ax | grep java
2242 ? Sl 0:44 java -classpath .:bin:lib/log4j-1.2.14.jar:lib/commons-logging-1.1.jar:classes:/opt/pi4j/lib/*:lib/json-simple-1.1.1.jar:lib/org.apache.httpcomponents.httpclient_4.3.1.jar:lib/utilities.jar:resource com.picControl.smartHomeSensors.MyMain
2461 pts/0 S+ 0:00 grep –color=auto java


Now grep “run.sh”. Notice the PID 2241.

This is generated before the Java program is launch. Remember this PID no. You may need this number to kill the same java program.

pi@raspberrypi ~ $ ps ax | grep run.sh

2233 ? S 0:00 sudo /home/pi/smartHomeSensor/run.sh
2241 ? S 0:00 /bin/bash /home/pi/smartHomeSensor/run.sh
2481 pts/0 S+ 0:00 grep –color=auto run.sh

To kill the process.
Check the process currently running.
The previous process that appear is no longer running.

pi@raspberrypi ~ $ sudo kill -9 2242
pi@raspberrypi ~ $ ps ax | grep run.sh
2487 pts/0 S+ 0:00 grep –color=auto run.sh
pi@raspberrypi ~ $ ps ax | grep java
2489 pts/0 S+ 0:00 grep –color=auto java

 

List of frequently used commands
A list of frequently used Linux command (using Bash Shell)

Commands Illustration

List directory pi@raspberrypi ~ $ ls
Desktop ocr_pi.png python_games
or
pi@raspberrypi ~ $ ls -all
Change directory pi@raspberrypi ~ $ cd Desktop
Returning down one directory level. pi@raspberrypi ~/Desktop $ cd ..

Access to /sys directory which is hidden.
Containing system peripherals directory/information, for example GPIO, I2C, tty (UART, teletype).
http://www.linusakesson.net/programming/tty/index.php

pi@raspberrypi ~ $ /sys
pi@raspberrypi /sys $ 
Return to user’s root directory (~). pi@raspberrypi /sys $ cd ~
Rename a file from abc.txt to xyz.txt pi@raspberrypi /sys $ mv abc.txt xyz.txt
Delete or Remove a file pi@raspberrypi /sys $ rm abc.txt
Find or search a file name in the sub-directory, where ‘*’ is a wildcard. pi@raspberrypi /sys $ sudo find / -name *findText*
   
Press up down arrow keys to scroll through the previously executed commad list.  
Press tab to auto complete the command, file name, directory name or list all possibility. Press up down to select related name.  
Shortcut key to open terminal console <Ctrl+Alt+’T’>  
Create new directory. pi@raspberrypi ~ $ mk DIRECTORY_NAME
Remove file. pi@raspberrypi ~ $ rm FILENAME
Launch GUI, or Linux’s GUI pi@raspberrypi ~ $ startx
Stop Linux operating system pi@raspberrypi ~ $ sudo exit
or
pi@raspberrypi ~ $ sudo halt
or
pi@raspberrypi ~ $ sudo shutdown -h now
Reboot Linux operating system pi@raspberrypi ~ $ sudo reboot
or
pi@raspberrypi ~ $ sudo shutdown -r now

To get help or further details for any linux command, use the “man” command.
Help manual for any command or program, where ???? is the command/program name.

pi@raspberrypi ~ $ man ????
Pipe following terminal output text to this grep filter before display on the terminal console. Only the lines containing the text will be printed out. “XXXX” will be the command that generate the printed text on the terminal console, while “TEXT_FILTER” is the text to be filtered. The operator ‘|‘ pipes the console output from “XXXX” to the grep program. pi@raspberrypi ~ $ XXXX | grep TEXT_FILTER
Direct the terminal output text, saving to this file.txt pi@raspberrypi ~ $ XXXX > file.txt
To enable root privilege. Any command entered will be treated with root privilege as long as the terminal remains open. pi@raspberrypi ~ $ sudo su
Allow root privilege only for the command “XXXX pi@raspberrypi ~ $ sudo XXXX

Display the content of the file “XXXX”.
Example to display Raspberry Pi hardware revision, key in “cat /proc/cpuinfo

Example to display Linux OS information, key in “cat /etc/lsb-release

pi@raspberrypi ~ $ cat XXXX
pi@raspberrypi ~ $ cat /proc/cpuinfoProcessor : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7

Hardware : BCM2708
Revision : 000e
Serial : 000000005fdceeaf

Execute program in the background (execute program in a seperated thread), while allowing the current terminal for other more commands. This is done by appending the ‘&’ behind a program execution command, which is denoted as “XXXX”. pi@raspberrypi ~ $ XXXX&

Command “PS” List the program or threads running in the background of the Linux operating system (for the current user session only).
Where PID is the process ID number.

Command “ps” is a useful troubleshooting tools. Other related command is “top”.

Other useful troubleshooting commands are,
– “strace“, “ltrace
– “mtrace

 

pi@raspberrypi ~ $ ps
PID TTY TIME CMD
2803 pts/1 00:00:02 bash
2948 pts/1 00:00:00 ps

 

 

 

 


To list all the process running in the Raspberry Pi device, use command “PS AX”.
You can see the process created by other user session and you can kill it as well.

 

These are the bash session started by various user session 0, 1, 2, etc… ,

3477 pts/0 T 0:00 -bash
347? pts/1 T 0:00 -bash
347? pts/2 T 0:00 -bash

 

This is a bash session started for the main hardware,

2121 tty1 S+ 0:01 -bash

 

 

 

To list only the PID for a particular program, you can use with grep.

pi@raspberrypi ~ $ ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:01 init [2]
2 ? S 0:00 [kthreadd]
3 ? S 0:00 [ksoftirqd/0]
5 ? S< 0:00 [kworker/0:0H]
6 ? S 0:01 [kworker/u:0]
7 ? S< 0:00 [kworker/u:0H]
8 ? S< 0:00 [khelper]
9 ? S 0:00 [kdevtmpfs]
10 ? S< 0:00 [netns]
12 ? S 0:00 [bdi-default]
13 ? S< 0:00 [kblockd]
14 ? S 0:00 [khubd]
15 ? S< 0:00 [rpciod]
16 ? S 0:00 [khungtaskd]
17 ? S 0:00 [kswapd0]
18 ? S 0:00 [fsnotify_mark]
19 ? S< 0:00 [nfsiod]
20 ? S< 0:00 [crypto]
27 ? S< 0:00 [kthrotld]
28 ? S< 0:00 [VCHIQ-0]
29 ? S< 0:00 [VCHIQr-0]
30 ? S< 0:00 [VCHIQs-0]
31 ? S< 0:00 [iscsi_eh]
32 ? S< 0:00 [dwc_otg]
33 ? S< 0:00 [DWC Notificatio]
35 ? S< 0:00 [deferwq]
36 ? S 0:00 [kworker/u:2]
37 ? S 0:08 [mmcqd/0]
38 ? S 0:00 [jbd2/mmcblk0p6-]
39 ? S< 0:00 [ext4-dio-unwrit]
154 ? Ss 0:00 udevd –daemon
1503 ? S 0:01 /usr/sbin/ifplugd -i lo -q -f -u0 -d10 -w -I
1592 ? S 0:07 /usr/sbin/ifplugd -i eth0 -q -f -u0 -d10 -w -I
1778 ? Sl 0:00 /usr/sbin/rsyslogd -c5
1863 ? Ss 0:00 /usr/sbin/cron
1888 ? Ss 0:00 dhclient -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhcli
1918 ? Ss 0:00 /usr/bin/dbus-daemon –system
1964 ? Ss 0:02 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 102:104
2003 ? Ss 0:00 /usr/sbin/thd –daemon –triggers /etc/triggerhappy/triggers.d
2008 ? Ss 0:00 /usr/sbin/sshd
2037 tty1 Ss 0:00 /bin/login -f tty1
2038 tty2 Ss+ 0:00 /sbin/getty 38400 tty2
2039 tty3 Ss+ 0:00 /sbin/getty 38400 tty3
2040 tty4 Ss+ 0:00 /sbin/getty 38400 tty4
2041 tty5 Ss+ 0:00 /sbin/getty 38400 tty5
2042 tty6 Ss+ 0:00 /sbin/getty 38400 tty6
2044 ? Sl 0:01 /usr/sbin/console-kit-daemon –no-daemon
2111 ? Sl 0:00 /usr/lib/policykit-1/polkitd –no-debug
2121 tty1 S+ 0:01 -bash
2151 ? S 0:00 [kworker/0:0]
2249 ? Ss 0:00 sshd: pi [priv]
2256 ? S 0:00 sshd: pi@notty
2257 ? Ss 0:00 /usr/lib/openssh/sftp-server
2258 ? Ss 0:00 /usr/lib/openssh/sftp-server
2662 ? S 0:00 [flush-179:0]
2663 ? Ss 0:00 sshd: pi [priv]
2667 ? Ss 0:00 sshd: pi [priv]
2674 ? S 0:01 sshd: pi@pts/0
2678 ? S 0:00 sshd: pi@notty
2679 ? Ss 0:00 /usr/lib/openssh/sftp-server
2684 pts/0 Ss 0:03 -bash
3127 ? S 0:00 udevd –daemon
3130 ? S 0:00 udevd –daemon
3338 ? S 0:00 [kworker/0:1]
3393 ? Ss 0:00 sshd: pi [priv]
3397 ? Ss 0:00 sshd: pi [priv]
3404 ? S 0:00 sshd: pi@pts/1
3408 ? S 0:00 sshd: pi@notty
3409 ? Ss 0:00 /usr/lib/openssh/sftp-server
3416 pts/1 Ss+ 0:01 -bash
3469 ? S 0:00 [kworker/0:2]
3476 pts/0 R+ 0:00 ps ax
3477 pts/0 T 0:00 -bash
3478 pts/0 Tl 0:03 java -classpath .:bin:lib/log4j-1.2.14.jar:lib/commons-logging

pi@raspberrypi ~ $ ps ax | grep java
3478 pts/0 Tl 0:03 java -classpath .:bin:lib/log4j-1.2.14.jar:lib/commons-logging

To terminate the program running in the background thread, use the kill command. Where “####” is the process ID (PID)

Putting an option -9 will force the process to be killed.

The process PID can be kill from another user session, even if the PID is not listed in its session.

pi@raspberrypi ~ $ kill ####

or

pi@raspberrypi ~ $ kill -9 ####

Check physical disk information. pi@raspberrypi ~ $ sudo fdisk -l
Check physical disk mount information pi@raspberrypi ~ $ sudo df -h
Measure Raspberry Pi temperature pi@raspberrypi ~ $ vcgencmd measure_temp
temp=58.4’C
 
Running a simple echo bash script on the command line terminal. pi@raspberrypi ~ $ echo “Hello World!!!”
Hello World!!!
The script can be save onto a file and be run just like a batch file under Microsoft Windows OS. Save the following echo bash script onto a file name “bash_script.sh”.

You can actually name the file whatever you like, but it is good to keep the *.sh file extension as under some GUI Linux OS, double clicking the file will automatic launch the correct application which runs the file.
#!/bin/bash
echo “Hello World!!!”
Run the file “bash_script.sh”. pi@raspberrypi ~ $ bash bash_script.sh
Hello World!!!

To run the “bash_script.sh” without the command bash, set the file as executable and run the file.

Note: You may encounter with the following
./test.sh: /bin/bash^M: bad interpreter: No such file or directory.

There is a ‘^M’ char detected at the end of the first line. Ensure that the script is not written on a Microsoft Window OS. Window’s environment will append ‘^M’ for enter key.

Use vi editor to view the file.
Type in command “vi bash_script.sh”.
You will see the ‘^M’ char in blue.
Delete those char.

Press ‘:w’ save the text file.
Press ‘:q’ to exit the vi program.

Try again, it should work fine now.

pi@raspberrypi ~ $ source bash_script.sh
Hello World!!!
or
pi@raspberrypi ~ $ . bash_script.sh
Hello World!!!

or
pi@raspberrypi ~ $ sudo chmod u+x bash_script.sh
pi@raspberrypi ~ $ ./bash_script.sh
Hello World!!!

To check the permission for the files in the current directory use “ls -l”.

To check permission for a particular file, type out the file name behind “ls -l filname”

File permissiondrwxrwxrwx 2 pi pi

    d – represent the name as a directory.
    – – Regular file or program.
    l – file/dir is a symbolic link.
    s – setuid/setgid permissions.
    t – sticky bit permissions.
    b – driver for storage medium.
    c – driver for communication hardware.


rwx – ‘r’ refers to the read permission
      ‘w’ refers to the write permission
      ‘x’ refers to the permission to execute

1st “rwx” -> owner (‘u’)
2nd “rwx” -> group (‘g’)
3rd “rwx” -> all users (‘o’ or ‘a’)
2 – referes to the number of hardlinks to the file.
pi pi -> Owner:Group

To change the file permission, use the following command,

“chmod a+x filename”
This will add all (‘a’) with executable (‘x’) permission.

“chmod ax filename”
This will remove all (‘a’) with executable (‘x’) permission.You can also set file permission using binary references (set to _rwxr—–),
command “chmod 740 filename”To change file’s owner and group,
command “chown newuser:newgroup filename”

 

pi@raspberrypi ~ $ ls -l
drwxr-xr-x 2 pi pi 4096 May 30 04:07 Desktop
-rw-r–r– 1 pi pi 5781 Feb  3  2013 ocr_pi.png
drwxrwxr-x 2 pi pi 4096 Mar 10 18:20 python_games

pi@raspberrypi ~ $ ls -l Desktop
drwxr-xr-x 2 pi pi 4096 May 30 04:07 Desktop

pi@raspberrypi ~ $ chmod a+x ocr_pi.png
pi@raspberrypi ~ $ ls -l
drwxr-xr-x 2 pi pi 4096 May 30 04:07 Desktop
-rwxr-xr-x 1 pi pi 5781 Feb  3  2013 ocr_pi.png
drwxrwxr-x 2 pi pi 4096 Mar 10 18:20 python_games

pi@raspberrypi ~ $ chmod a-x ocr_pi.png
pi@raspberrypi ~ $ ls -l
drwxr-xr-x 2 pi pi 4096 May 30 04:07 Desktop
-rw-r–r– 1 pi pi 5781 Feb  3  2013 ocr_pi.png
drwxrwxr-x 2 pi pi 4096 Mar 10 18:20 python_games

Auto Login (login without being prompt for password). Edit the file /etc/inittab.

Comment away the following line by inserting a ‘#’ in front of the statement.
“#1:2345:respawn:/sbin/getty 115200 tty1”
and insert the following line below it.
“1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1”

Reboot the system and you should be able to power up and go striaght into the command prompt without being prompt for user ID and password.

pi@raspberrypi ~ $ sudo nano /etc/inittab

#1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

Run a script after login (user specific),
by adding the following line to the end of the file /etc/profile (similar to /home/pi/.bashrc)
“. /home/pi/script1.sh”

“script1.sh” will run after the user has been sucessfully login. Local or remote user will get to auto execute “script1.sh” after login.

NOTE!!!
Please ensure to set the file as executable and run the file.

#! /bin/sh
echo “— script<1> ————–”
Run a script after the very end of the boot process (before any login), by adding the following line to the end of the file /etc/rc.local
“/home/pi/script3.sh”
 

Run a script after the booting process (or within the booting process), but before the login (using service method).

1) Create a script “script2.sh” in the folder /etc/init.d/script2.sh.
“sudo nano /etc/init.d/script2.sh”

2) Make the script executable.
“sudo chmod 755 /etc/init.d/script2.sh”

3) Test the script (service start).
“sudo /etc/init.d/script2.sh start”

4) Test the script (service stop).
“sudo /etc/init.d/script2.sh stop”

5) Register the script to be run at start-up (with default priorities).
“sudo update-rc.d script2.sh defaults”

update-rc.d is a program which mananged the start-up and shutdown using the file /etc/rcX.d (where rcX.d means rc0.d to rc6.d, rcS.d)
You can key in the following command to view the link to your script.
“ls -l /etc/rc?.d/”

6) To remove the script from start-up,
“sudo update-rc.d -f script2.sh remove”
‘-f’ is to force the removal of the symlinks even if the script is still under the /etc/init.d folder. Remember to delete away your script away from the folder /etc/init.d
Note: The command above will only disable the service until the next time the service is upgraded. To enable the service will not be re-enabled upon upgrade, type the following command, “update-rc.d script2.sh stop 80 0 1 2 3 4 5 6”

7) You can also register the services with custom priorities. (you can visit this website)

#! /bin/sh
# /etc/init.d/script2.sh### BEGIN INIT INFO
# Provides: —
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simple script to start a program at boot
# Description: A simple script which will start / stop a program a boot / shutdown.
### END INIT INFO# If you want a command to always run, put it here# Carry out specific functions when asked to by the system
case “$1” in
  start)
    echo “— script<2> start ———“
    # run application you want to start
    # /usr/local/bin/noip2
    ;;
  stop)
    echo “— script<2> stop ———“
    # kill application you want to stop
    # killall noip2
    ;;
  *)
    echo “Usage: /etc/init.d/noip {start|stop}”
    exit 1
    ;;
esac

exit 0

After testing with various start-up scripts process, I have summarizes the sequence in which the scripts are call up.

— Booting process ——–
    before user login

– Script registered with update-rc.d
– /etc/rc.local

— User login prompt——-
    after user login

– /etc/profile
– /home/pi/.bashrc

— End of start-up process —–
    command prompt

 

Custom Splash screen
“apt-get install fbi”

Name your image file to “splash.png” and copy to the directory /etc

****encounter problem copying file to /etc directory.***
If the error above is encountered, copy the image file to the user directory instead. Then use “sudo mv” (move file command) to move it to the etc directory.

Edit a new text file “sudo nano”.
Cut and paste the followings,

#! /bin/sh
### BEGIN INIT INFO
# Provides: asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: S
# Default-Stop:
# Short-Description: Show custom splashscreen
# Description: Show custom splashscreen
### END INIT INFO
do_start () {
/usr/bin/fbi -T 1 -noverbose -a /etc/splash.png
exit 0
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
exit 0
;;
*)
echo "Usage: asplashscreen [start|stop]" >&2
exit 3
;;
esac

:

save the file as /etc/init.d/asplashscreen

make the script executable and install it for init mode:

“sudo chmod a+x /etc/init.d/asplashscreen”

“sudo insserv /etc/init.d/asplashscreen”

Reboot

“sudo reboot “

 

The custom logo is displayed near the end of the booting process, not at the beginning.

This is followed by a blank screen.
Press <Ctrl + Alt + F2> to return to the command prompt.

pi@raspberrypi ~ $ sudo apt-get install fbi

pi@raspberrypi ~ $ sudo mv splash.png /etc

pi@raspberrypi ~ $ sudo nano

cut and paste, save file as

/etc/init.d/asplashscreen

pi@raspberrypi ~ $ sudo chmod a+x /etc/init.d/asplashscreen

pi@raspberrypi ~ $ sudo insserv /etc/init.d/asplashscreen

pi@raspberrypi ~ $ sudo reboot


Place your favourite wall paper on the desktop.
-> Login GUI Desktop
-> On the desktop, press right click , and -> Select “Desktop Preferences”.
-> Select your favourite wallpaper.

 
Hide boot up text, kernel loading modules (slient pi boot)  
– List process task, thread

enable sound
sudo modprobe snd_bcm2835
disable sound
rmmod snd_bcm2835

Root access

Some users believe that the root account has a password that they are not aware of. This is not the case. For security reasons, Raspbmc has been hardened by disabling the root account. There is no need to enable the root account in Raspbmc, and doing so increases the likelihood of you causing damage to the system. Instead, the following options are recommended:

  • Prefixing the command requiring root privileges with sudo will allow you to run the command as root.
  • Alternatively, you can temporarily have root privileges with the command sudo -s

If you truly wish to enable root access so that you can login as root. You can do so as follows:sudo passwd rootYou have now set a root password you can login with.To disable the root account again:

sudo passwd -l root

To change Raspberry Pi password. pi@raspberrypi ~ $ passwd
Changing password for pi.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Changing Raspberry Pi user name (“newUserName”) and password (“abc1234”).

Follow the following procedure,

 
Add a new user with new password.

pi@raspberrypi ~ $ sudo adduser newUserName

Adding user `newUserName’ …
Adding new group `newUserName’ (1004) …
Adding new user `newUserName’ (1001) with group `newUserName’ …
Creating home directory `/home/newUserName’ …
Copying files from `/etc/skel’ …
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for newUserName
Enter the new value, or press ENTER for the default
     Full Name []:
     Room Number []:
     Work Phone []:
     Home Phone []:
     Other []:
Is the information correct? [Y/n] y
 

Give the new user sudo privileges, by editing the sudoers file.
Copy the line with the default user name pi and copy below it. Change the name pi to your newUserName.

After you have finished, key in Ctrl+’x’ then ‘Y’, followed by enter key.

pi@raspberrypi ~ $ sudo visudo

pi ALL=(ALL) NOPASSWD: ALL
newUserName ALL=(ALL) NOPASSWD: ALL

Testing the newUserName if it is working properly with sudo privileges.

pi@raspberrypi ~ $ logout

pi@raspberrypi ~ $ login

Enter your newUserName and passsword.

 

Try to see if you can edit the sudoers file. The file can only be edited if it has sudo access privileges.

Delete the line containing the “pi” user, if it is no longer required.
After you have finished, key in Ctrl+’x’ then ‘Y’, followed by enter key.

newUserName@raspberrypi ~ $ sudo visudo

Delete the old user “pi” account,
or add in option flag “-remove-home” to remove the “/home/pi” directory as well.

The process of changing the Raspberry Pi user name and password is completed.
Reboot the Raspberry Pi for the new user name to take effect. Old user name can no longer be in use.

(method do not work so well. still able login using pi as the user name.)

newUserName@raspberrypi ~ $ sudo deluser pi
newUserName@raspberrypi ~ $ sudo deluser -remove-home pi
Disable screen saver, or disable auto blank screen.

newUserName@raspberrypi ~ $ sudo nano /etc/kbd/config

BLANK_TIME=0
BLANK_DPMS=off
POWERDOWN_TIME=0

   
   
   

Advance command
– “lsusb” List all the USB peripherals
– “df /” check disk space
– “free” check memory RAM

 
Directory Structure of
Raspberry Pi running
Soft-float Debian “wheezy”

I have created an overview directory maps of my Raspberry Pi directory map to assist me in understanding the files modification that I will be dealing with.

Learning how things are being organised in a Linux platform.
/~–/bin    Essential commands that all user
  |
  |-/boot   Information that boots the machine, including Kernel.
  |  |-boot.rc
  |
  |-/dev    Device driver for all the hardware peripherals.
  |  |-/block
  |  |-/bus
  |  |-/char
  |  |-/disk
  |  |-/input
  |  |-/mapper
  |  |-/net
  |  |-/pts
  |  |-/raw
  |  |-/snd
  |-/etc    Configuration files for your system.
  |  |-/alternatives
  |  |-/apm
  |  |-/apparmor.d
  |  |-/apt
  |  |-/avahi
  |  |-/bash_completion.d
  |  |-/ca-certificates
  |  |-/calendar
  |  |-/console-setup
  |  |-/ConsoleKit
  |  |-/cron.d
  |  |-/cron.daily
  |  |-/cron.hourly
  |  |-/cron.monthly
  |  |-/cron.weekly
  |  |-/dbus-1
  |  |-/default
  |  |-/dhcp
  |  |-/dhcp3
  |  |-/dictionaries-common
  |  |-/dillo
  |  |-/dpkg
  |  |-/emacs
  |  |-/fonts
  |  |-/fstab.d
  |  |-/gconf
  |  |-/gdb
  |  |-/ghostscript
  |  |-/groff
  |  |-/gtk-2.0
  |  |-/gtk-3.0
  |  |-/ifplugd
  |  |-/init
  |  |-/init.d         save and register scripts in this directory to auto run when bootup or shutdown
  |  |-/insserv
  |  |-/insserv.conf.d
  |  |-/iproute2
  |  |-/kbd
  |  |-/ld.so.conf.d
  |  |-/ldap
  |  |-/libnl-3
  |  |-/libpaper.d
  |  |-/lightdm
  |  |-/logcheck
  |  |-/logrotate.d
  |  |-/menu
  |  |-/menu-methods
  |  |-/modprobe.d
  |  |-/network
  |  |-/opt
  |  |-/pam.d
  |  |-/perl
  |  |-/pm
  |  |-/polkit-1
  |  |-/profile.d
  |  |-/pulse
  |  |-/python
  |  |-/python2.7
  |  |-/python3
  |  |-/python3.2
  |  |-/rc0.d
  |  |-/rc1.d
  |  |-/rc2.d
  |  |-/rc3.d
  |  |-/rc4.d
  |  |-/rc5.d
  |  |-/rc6.d
  |  |-/rcS.d
  |  |-/request-key.d
  |  |-/rsyslog.d
  |  |-/samba
  |  |-/security
  |  |-/selinux
  |  |-/sgml
  |  |-/skel
  |  |-/ssh
  |  |-/ssl
  |  |-/sudoers.d
  |  |-/sysctl.d
  |  |-/systemd
  |  |-/terminfo
  |  |-/triggerhappy
  |  |-/udev
  |  |-/ufw
  |  |-/vim
  |  |-/wpa_supplicant
  |  |-/X11
  |  |-/xdg
  |  |-/xml
  |  |-/xpdf
  |  |-inittab   controls the startup/initialization process (example: auto login)
  |  |-profile
  |  |-rc.local
  |
  |-/home   Home directory for each of the user
  |  |~/pi  (User named pi)
  |     |-/Desktop
  |     |-/python_games
  |     |-.bashrc        script trigger everytime a specific user logs in
  |
  |-/lib    Library or code, Kernel or other programs use.
  |  |-/arm-linux-gnueabi
  |  |-/firmware
  |  |-/init
  |  |-/lsb
  |  |-/modprobe.d
  |  |-/modules
  |  |-/systemd
  |  |-/terminfo
  |  |-/udev
  |  |-/xtables
  |
  |-/lost+found
  |
  |-/media  Temp media (disk, CD-ROM)
  |
  |-/mnt    Temp media (disk, CD-ROM, network drive)
  |
  |-/opt    Location for installing new software package.
  |  |-/java
  |  |-/pi4j
  |  |-/vc
  |
  |-/proc
  |
  |-/root   Super user’s home directory
  |
  |-/run
  |  |-/ConsoleKit
  |  |-/dbus
  |  |-/lock
  |  |-/mount
  |  |-/network
  |  |-/sendsigs.omit.d
  |  |-/shm
  |  |-/sshd
  |  |-/udev
  |
  |-/sbin   Commands for system adminstrator.
  |
  |-/selinux
  |
  |-/srv    Data for system’s services (programs running in the background)
  |
  |-/sys
  |  |-/block
  |  |-/bus
  |  |-/class
  |  |-/dev
  |  |-/devices
  |  |-/firmware
  |  |-/fs
  |  |-/kernel
  |  |-/module
  |  |-/power
  |
  |-/tmp    for storing temp files
  |
  |-/usr    A complex hierarchy of additional programs and files
  |  |-/bin
  |  |-/games
  |  |-/include
  |  |-/lib
  |  |-/local
  |  |-/sbin
  |  |-/share
  |  |-/src
  |
  |-/var    The data that changes frequently. (log files, emails)
  |  |-/backups
  |  |-/cache
  |  |-/lib
  |  |-/local
  |  |-/log
  |  |-/mail
  |  |-/opt
  |  |-/spool
  |  |-/tmp


Linux Files and Directory Structure Reference

 

/~–/bin    Essential commands that all user
  |
  |-/boot   Information that boots the machine, including Kernel.
  |
  |-/dev    Device driver for all the hardware peripherals.
  |  |-/cd-rom
  |  |-/fd0
  |  |-/fd1
  |  |-/hda
  |  |-/hda1
  |  |-/hda2
  |  |-/hdb
  |  |-/hdb1
  |  |-/hdb2
  |  |-/sda
  |  |-/sda1
  |
  |-/etc    Configuration files for your system.
  |
  |-/home   Home directory for each of the user
  |  |~/pi  (User named pi)
  |     |-/Desktop
  |
  |-/lib    Library or code, Kernel or other programs use.
  |
  |-/media  Temp media (disk, CD-ROM)
  |
  |-/mnt    Temp media (disk, CD-ROM, network drive)
  |
  |-/opt    Location for installing new software package.
  |
  |-/root   Super user’s home directory
  |
  |-/sbin   Commands for system adminstrator.
  |
  |-/srv    Data for system’s services (programs running in the background)
  |
  |-/tmp    for storing temp files
  |
  |-/usr    A complex hierarchy of additional programs and files
  |  |-/X11R6
  |  |-/bin
  |  |-/games
  |  |-/include
  |  |-/lib
  |  |-/local
  |  |-/sbin
  |  |-/share
  |  |-/src
  |
  |-/var    The data that changes frequently. (log files, emails)

-/??? -> Directory related to the Linux operating system that needs careful attention in handling.

Linux Command Reference
linux_quickref.pdf
linuxcard.pdf

 
 
 

 

 

Add Wifi to Raspberry Pi
Add a Wifi to tap the internet access from your Wifi wireless network.

WiFi dongle keyword
– Edimax EW-7811Un
– Dynamode WL-700N-RXS

Commands Illustration

In order to connect to the Wifi, the first thing you will need is a Wifi dongle for your Raspberry Pi. The following contains the list of Wifi adaptors available that can work with Raspberry Pi.

http://elinux.org/RPi_USB_Wi-Fi_Adapters

In this example, D-Link DWA-123, H/W Ver.: B1, P/N IWA123EU…..B1G

 
Edit and Setup the network interface configuration pi@raspberrypi ~ $ sudo nano /etc/network/interfaces

Original setup look like the following,
——————————————————
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

 

If you have a DHCP server, change to the following
——————————————————
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet manualdhcp
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

 
If you are using a static IP, change to the following
——————————————————
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
 
Setup the WPA configuration, the following block to the file. Change the text in blue to your router settings. pi@raspberrypi ~ $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid=”SSID-GOES-HERE”
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=”WIFI-PASSWORD-GOES-HERE”
}
 
Reboot and unplug the ethernet cable. The Wifi should be taking over the network connection after the reboot. pi@raspberrypi ~ $ sudo reboot
Reference:
http://www.correderajorge.es/wifi-under-raspberry-pi-with-archlinux/

 

 


www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller





Reference book- Embedded Linux Primer (2nd Edition), A Practical, Real-World Approach, by Christopher Hallinan (indepth details of Linux OS operations) To explore list
– start up script, shutdown script
– Play Audio, Display images, Video – C I/O, UART, SPI programming



Keyword: Raspberry Pi, electronic hardware setup, UART, I2C, SPI, Digital I/O port, Python Programming, C Programming.

Spotronic1 Robot

Spotronic & my first Mine Avoidance Robot

Written by Lim Siong Boon, last dated 11-Apr-09.

 

Photos of SRG 1997

Robot Battlefield, laid with electronics mines. The mine will buzz and light up if it is being knock. Any robot that hit the mine will be out of the game.

 

 

Our senior’s robot representing Singapore Polytechnic in SRG 1997. MAR uses 3 infrared sensor, one in the middle and two at the side.

 

Our senior’s threat from Nanyang Polytechnic. Everybody were surprise by it performance in the 1997 competition. It has strong motor power and speed. This robot is able to complete the race before our senior MAR reaches their 2nd mine. The robot is able to stop quickly and negotiate the mine in a perfect curve in relatively short time, at least 5 times faster than MAR. It is no doubt a clear winner for Robot Battlefield 1997. No robot come close. It seems that they are using gear DC motor. The NYP robot have an array of sensor, sensing the mine from the top. A design that non of us expected. The design is a real genius, because they have break the impression that mines can only be sensed from the side. The position of the sensor is perfect, as mines sensing is very clear cut. This is unlike the side sensors position in MAR and the rest of the robots where sensing is more easily affected by the environment lightings when using infra-red. Looking into the components NYP use and the way the robot operate we guess that they are using PLC controller and a array of infra-red sensor. When the robot senses a defined pattern from the top-down sensor, it will negotiate the mine in a perfect curve close to the mine. Without side sensors to guide the robot, it is unlikely to negotiate the mine in such accuracy and speed. The only explanation for this behavior is that the curve movement profile is being pre-programmed into the PLC. Using PLC is the strength of their team, a group of mechantronic students.

Their design was great, and fit into the game. There is no rules at that time to restrict robot from using top down sensing. Since then, the SRG committee begin to seek new rule to deter new players to adopt such short-cut. The SRG 1998 committee begins to add on new odd shape obstacles prevent the use of such logic control robot. Example of new obstacles like a big/tall/non reflective dust bin in the middle of mine field, with low plank at the corner of the field. This new rules will ensure that the new generation of robot is intelligence enough to negotiate any type of obstacles and maneuver.

This robot from NYP becomes the ultimate aim in our project, to be better than this monster. Our team were looking forward to Robot Battlefield 1998, to fight with NYP robot. We will be following our senior’s robot technology, using direct drive stepper motor (without gear). It was a real challenge.

 

Robot powered by a 9V battery

This is the robot, I most admire among all robot. If I remember correctly, this robot is from NUS. It is driven by 2 very small tamiya motor with small wheels power by a 9V Alkaline Battery. The whole robot is flat and light like a pizza box, and movement is very swift. Unfortunately there is a problem with their sensing and algorithm which hinder their robot to move between two mines. The robot just move forward and backward very swiftly, just like a mouse who is afraid to move through the mine field. If programmed correctly, this robot could be a winner. The problem might also be their choice of battery. The alkaline battery might not be suitable to run high current application. This may affect the power stability, which affects their digital logic circuitry. It will be extremely difficult to troubleshoot software if the bug is partly contribute by the hardware. In my heart, this NUS robot will always be special for it’s performance in speed and energy efficient.

 

This is one of the robot using ultra sonic sensing. The sensor is enclose behind the casing. We are very aware that only this type of sensor at that time, can be mounted in this manner. We were trying very hard to analysis all possible threat for Robot Battlefield 1998.

 

Some other photos taken. It is a norm in SRG competition, that most IC chips are blank off, especially the important ones. This deter the competitor to learn more about their robotic system or to steal technological ideas. It is easy to learn about robot capability by observing their circuits, mechanical and sensing technology.

 

 

Spotronic Robot is still under development.

Motivate by my previous work in working on a mine avoidance vehicle, representing Singapore Polytechnic for the Singapore Robotic Games 1998. It is a new robotic event, and we are only the second batch of student competing in the event call “Robot Battlefield”. It was a very exciting moment in my life that no amount of words can described that feeling. The competition barely a minute in the battle field determines our one and a half year worth of effort.

The happiest moment, our commitment have won us a Gold Award in the competition. The award is won by my team namely, project leader Chew Chuen Hee (hardware motor), Lee Chin Kwang (firmware sensor and decision control), Pang Sze Hsin (hardware electronics) and lastly me Lim Siong Boon (motor driver firmware).

The rules of Robot Battlefield can be found in the SRG 1998 website or a copy of the rules I saved from the website. A lot of  changes to the rule have been make for Robot Battlefield 99. Part of the changes are resulted from some frustrating incident that occur during our competition in 1998. I shall touch further on this in future.

 

 

The following are some of my design work regarding the robot sensor positioning. It has never been implemented because of the demand in writing motor driver software. I am suppose to handle all the software coding for the whole robot. In the end, the demand in writing the motor control algorithm has taken me the whole one and a half year of our project schedule. It was quite complex to me at that time because it is not easy to debug the mechanical performance in real time. Electrical problem may surface when the robot operate by itself on the floor. Switches get trigger due to mechanical vibration when the robot travels. These are the kind of unforeseen bugs makes our debugging task extremely difficult. The task of writing sensing algorithm is eventually taken over by my team mate Chin Kwang who is in charge of sensor design.

Mine Avoidance Vehicle project report. (13.4 Mb)

My motor driver software for motorola microcontroller MC68HC705C8CS (commonly known as 6805), master and slave operation for the left and right stepper motor. The file are in asm machine language. Although I have written a lot of comment in the source code, it is now meaningless to me. I hardly remember that they were my own codes. The concept is still clear in my mind, how the two stepper motors are operated. The robot uses 3 microcontroller because we have meet the speed limitation in motorola 6805. A single 6805 chip is too slow in supporting our target robot speed at 2 meter per second. We have suggested switching to a more powerful microcontroller but was rejected by our supervisor as he is afraid that the learning curve for a new controller will be long. In the end, we had all agreed to implement 3 microcontroller to control the robot. One main controller for sensor algorithm, one master and slave microcontroller for left and right motor. Initially I have great doubt that individual controller for each motor will work. There might be synchronizing problem which affect the robot from traveling straight. Eventually after the first prototype, it seems working very well and the problem is in fact negligible. There was nothing to worry about after all.

 

 

 

 

 

My team mate Sze Hsin, and Chin Kwang. We take some photos during SRG 1997.

 

 

Our team leader Chuen Hee (Mechanical, Electronics hardware), Chin Kwang (Sensor, Robot algorithm firmware), Sze Hsin (Electronics hardware, PCB), Siong Boon (Me, Motor driver firmware & software tools).

Too bad that these are all the photos I have on hand. Furthermore they are blur. If you have more photos to share for SRG 1998, 1997, 1999, please forward me your collection. I will be excited to receive these precious.

Pinky (left), Brain (right).

Pinky & the Brain, the name has a very symbolic meaning. To conquer the world, the dream of Pinky and the Brain, which is what we want our robot to achieve.

 

 

 

 

 

We have created two similar robot for the competition. It is the cutest name we come up with. I love it. One robot, we call it “Pinky”, and the other one ” Brain”. Combine together, they are call “Pinky and the Brain“.

The saddest thing is that I didn’t keep any of the photos we had. I cannot forgive myself for not taking any pictures of our champion robot. It is one of the regret of my life for not taking any photos. The only traces of the robot we have created were our project report, certificates and the only website link on SRG 98.

Anyone of you out there, have document or picture for SRG 1998, please let me know. I am eager to get in contact with you. If only our competitor see this, I am sure they have our Pinky and the Brain photos taken.

Our developed robot is far superior from our senior. I forgot how we eventually agreed to join into this robotic game category. What we observe in our senior’s demonstration, there are plenty of opportunities for improvement. Our senior’s robot has limited sensor capability and their robot speed and movement is rather slow. For each object blocking their robot path, the robot execute a stop and do rotation, moving forward and rotate movement until the robot negotiated the obstacle “mine”. This wasted a lot of time and speed as time is required to do acceleration and braking.

My job is to write a motor driver firmware to provide ease of control for our main software (sensor algorithm), at the same time control our stepper motor to speed and precision. To improve our robot speed in the competition, we cannot afford to stop the robot. The turning have to be made immediately when obstacle is detected. The motor driver allows full speed control and full degree of left, right turn options. Efficient acceleration and de-acceleration of both the left and right motor are taken care by the driver controller. This ease processing power from the sensing controller which is programmed by my team mate Chin Kwang.

I will write more of this topic in future.

 

written by Siong Boon, 29 Nov 2005

   

 

 

www.pic-control.com, Singapore Research & Development R&D

Singapore Customized, custom made Electronics Circuits & Kits

 

 

My Spotronic  

 

 

Here are some snapshot of the robot I am building. It looks a bit like a trash robot because I did not spent too much money for it. I come across the wheels in a shop and it got me a very long time before I decided to buy the wheel. The coupling between the wheel and motor shaft is custom made, and it cause me about S$120. I had been waiting to resolve this wheel issue until I started working in my first job, and eventually had enough saving to spent some on my robot.

I forgot to mount on another PCB circuit which is the motor and LCD driver. The PCB board shown on the photos consist of the logic circuits. They uses less power and the digital control is run by my favourite microcontroller from Microchip, PIC16F877A.

The robot is in-completed as some of the electronics module is under research phase.

1) Power regulator, DC to DC

2) Wireless FM Transceiver

Other module involved and does not need further improvement are as follows,

1) Microcontroller PIC16F877

2) DC Motor driver L6203

3) Serial communication interface

4) LCD control

I want to make a good robot. Although I had purchase a DC to DC module to supply my electronics, I insist on robot completion using minimum funding. The DC to DC research is completed but I had yet put onto my robot. The DC to DC cost half the price of the module I brought and it provides me with the experience for future higher current application.

The next module I lack of is the wireless transceiver, which I never successfully have it working until recent FM transceiver research. The previous attempt fail, until the discovery of implementing an encoder and decoder for the data transmission. Finally my dream of a remote control robot is on the right path. Parallel digital bits transmission is tested to be working fine. The next step will be to try out serial communication through the transceiver.

Will update on my robot again once I have completed my documentation.

 

written by Siong Boon, 29 Nov 2005

   

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller



 

 

 

Keyword: remote control robot autonomous robotic Singapore Robotic Games

 

Touch Sensor

Introduction to DIY capacitive touch sensing, and the various type of touch sensor technologies.

Edited by Lim Siong Boon, last dated 14-Jul-09.

 

Topic Discussion Overview

  1. Touch sensor IC and product
  2. Touch sensor circuit
  3. Touch sensor in action
  4. Touch Vibration Motion Sensor
  5. Piezo Touch Sensor
  6.  

     

    1. Touch sensor IC and products

     

     

    Various capacitive touch sensor products

     

     

    Quantum Research Group

    Capacitive touch sensor QT100, QT102, QT110, QT113, QT118H, QT220, QT240, QT1081, QT1103, QT60160, QT60168, QT60240, QT60248, QT60326, QT60486, QT411, QT511, QT1106

    STMicroelectronics

    Capacitive touch sensor: QST108, QST1610, STMPE1208S

    Resistive touch sensor: STMPE811

          Omron

    Capacitive touch sensor: B6TS-04LT, B6TS-08NF, B6TS-16LT

    Sensor Platforms

    Capacitive touch sensor: SSP1401, SSP1492

    Analog Devices

    Capacitive touch sensor: AD7142, AD7143, AD7147, AD7150, AD7151, AD7745, AD7746, AD7747

    The following circuit DIY touch sensor will be focusing oncapacitive sensing method. In case you think that capacitive is the only method to implement touch sensing, I have done some searching and list down the possible method and technology to achieve similar touch effect as the capacitive method. Just a short brief of the various touch sensing technology available in the market for your reference.

    The various types of touch sensor.

    – Capacitive

    – Resistive “4 wire/ 5 wire/ 8 wire”

    S.A.W “surface acoustic wave”, Acoustic

    InfraRed

    – Camera

     

    Capacitive type are normally used in a simpler button switch interface, which are commonly available on portable gadgets like mouse, ipod, and the On/Off switch for your LCD monitor. This method senses the changed of capacitance when the user come in close contact on the switch plate surface.

    Capacitive touch sensor can be implemented using microcontroller with simple interfacing component. You may like to refer to Microchip or Texas Instruments website for implementing touch sensing using a microcontroller, mTouch.

    PDF Article: Layout and Physical Design Guidelines for Capacitive Sensing

    PDF Article: Software Handling for Capacitive Sensing

    PDF Article: Capacitive Multibutton Configurations

    PDF Article: PCB-Based Capacitive Touch Sensing With MSP430

     

     

    Fortunately there are already integrated hardware solution in the form of IC chip, making it easier to integrate touch sensing into your gadget. On the left are some references for the various source of IC chip.

     

     

    The following are some of the touch solution available.

     

     

    Resistive touch sensor is commonly deployed in our touch panel LCD monitor.

     

     

     

    SAW acoustic sensor

     

     

    Piezo touch switch

    http://www.danielsoneurope.com/products/piezo_switches/

     

    Acroustic sound sensing, by sensitive object.

     

     

     

     

    IR touch screen InfraRed

     

     

     

     

    Cherry IR touch panel

    A simple IR emitter and detector for touch sensing.

     

     

     

     

    Another method of detection using IR sensor, by sensing the lights that is being blocked (the IR component looks like a LED).

    http://web.ndak.net/jdgrotte/touchsensor/touchsensor.htm

     

    IR sensor deployed in grid form, creating a IR sensing touch screen.

     

     

     

    Touch technology base on camera.

     

    IR camera.

     

    more: http://www.instructables.com/id/How-to-Make-a-Cheap-Multitouch-Pad/1

     

    Whiteboard using the Wiimote.

    http://uiui.mmdays.com/2008/03/29/johnny-lee/

     

     

    LED Multi-touch panel (click the picture for reference)

     

     

    Comparison references for various touch sensing technology.

    PDF Article: Touch Screen Technology Comparison

    http://www.tvielectronics.com/Touch_Screen.html

    http://www.softtouch.co.in/compareTouch.htm

     

     

     

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

    Singapore Customized, custom made Electronics Circuits & Kits

     

     

    2. Touch sensor circuit  
     

    Simplest touch sensor circuit

    The illustration on the left shows a simple touch sensor circuit. It will light up the LED when a person gets in contact with the wire or metal connection to the transistor base. This touch circuit is cheap and easy to construct. All you need is a npn transistor, a resistor, a LED, a metal contact surface and of course the wire connection. It is so simple.

    NOTE: Interface the circuit will requires a bit further improvement to the design. Do not connect the ground reference to the earth. The LED will either not light up or will be very dim.

     

     

     

    Capacitive touch sensor circuit using QT100

     

    Touch sensor schematic. (click for larger image)

    Using QT100

     

    QT100 IC pin out

    QT100 datasheet

    QTouch design

    Touch sensor using spring

    AT42QT1011.pdf

     

    Part no.

    AT42QT1011 (touch on output)

    – AT42QT1012 (touch toggle output)

    – AT42QT1010 (touch pulse output)

     

       

    Touch Sensor Module PIC-116

    click here to
    Buy Mini Touch Sensor
    Available Now at the PIC-store

     

    This touch sensor module PIC-116 from PIC-CONTROL uses QT100 IC to sense touch. You can purchase this from PIC-store. The module is small measuring only about 21x10x3mm, making it easy to deploy for switch or button press application. The voltage supply Vcc required can be from 1.8V to 5.5V.

    There is two output provided. Pin 2 is a digital output logic 0 and logic 1. Logic 1 indicates a touch detected. Logic 0 will be a 0V, while logic 1 is a voltage that is same as Vcc (supply voltage). Pin 1 is a npn output; logic 1 will force this pin 1 to ground, while logic 0 will leave this pin floating. Pin 1 is useful if the application needs to drive directly a load of not more than 40V 0.5A. The load can be a LED indicator or the coil of a relay to drive higher current load. This means that it can be use as a momentary switch to switch on virtually anything.

    The touch sensitivity can be adjusted by changing the capacitor Cs. PIC-116 mini touch sensor module is installed with a Cs value of 8.2nF. The sensitivity can be reduced by using a lower capacitance value Cs; minimum Cs value is about 2nF. A Cs value lower than 2nF can have undetermine output state. To increase the sensitivity, a higher capacitance of Cs can be used. Maximum Cs value is about 50nF.

    The sensor can be so sensitive that it can detect your finger or body a few centimeter away from the sense pad.

    The reverse side of the PIC-116 touch sensor module is completely flat, making it easy to hide and stick behind a glass or plastic plate as a user interface. The intergrated sense pad onboard is on this side of the board labelled by the 3 circled ring with a pad area of about 10x10mm.

    The sensor comes with a soldering pad to allow me to use my own sensor pad. I have coil a length of fine wire wraping wire (thickness 0.5mm) as a touch pad. One end of the fine wire is soldered to the pad labelled as “Ext”, which is also next to the component Rs. This coil allows me to customised my own touch pad with varies size and shape. The coil on the left is about a diameter of 50mm. A big touch pad makes it easy for a user to interact with.

    wire wrapping wire. Fine wire, dia of about 0.5mm

    Alternative, this “Ext” pad can be soldered to copper foil or copper tape (thickness 0.08mm) which can be much thinner than my wire wrapping wire. A flat touch pad can be easily conceal behind poster or PVC stickers, allowing the touch switch to be hidden flat. This is great if you need an odd size/shape/surface switches as a user interface to blend into your designed artifact; which is impossible using a typical off the shelves mechanical push switches. Compare to a mechanical switch, touch switch do not have the problem of mechanical wear and tear. You can get the copper foil from stained-glass shop. Copper foil tape is used as adhesive to allow the solder to hold the glass that was cut to shape.

    copper foil, copper foil tape, easily available from stained-glass shops

    After my external wire coil is soldered onto the “Ext” pad, the sensor becomes more sensitive. This is due to the increase in the pad area. The larger the pad size, the more sensitive it will become. The larger pad surface allows the sensor to capture from a larger area. In order to reduced the sensitively, a smaller capacitance Cs can be use.

    The touch pad should be of a size of the sense target. If the finger is expected to touch the pad, the pad size should be of the finger size which is about 10x10mm. If a palm/hand/leg touch is expected, the sense pad can be larger.

    Sensor will not response when nothing is near its sense pad.

    Sensor detects my finger at a close proximity to the pad. A physical touch is not neccessary; it depends on the sensitivity that was set by the capacitor Cs. The sensitivity can be set lower, so that the sensor gets activated only upon a physical touch on the sense pad.

    Video of the touch sensor PIC-116

    MVI_1615, finger touch switch.AVI
    Video showing the sensor response to a finger at close proximity. Notice the sensor is able to detect the finger even before the finger touches the pad. The sensitivity was set too high. Cs can be lower to reduce the sensitivity so the the sensor gets activated when the finger is in contact with the pad.

    MVI_1616, sensor sensitive to metalic.AVI
    Video showing a piece of aluminium foil material activating the sensor. The sensor is too sensitive in this case. This can be eliminated by lower the capacitance Cs, so that the sensor is robust against such foil at close proximity. Radio radiation and electrical power line can also affect the result if they are placed near the sensor.

    MVI_1620, touch sensor through material.AVI
    The sensor is able to detect my finger touch even through insulated material like plastic or wood. The sensitivty of the sensor will need to increase in order to sense a finger touch across a much thicker insulated material >5mm.

     

     

     

     

     

     

     

     

     

     

    click here to
    Buy Mini Touch Sensor
    Available Now at the PIC-store

       
    Various others touch circuit that I have found on other website:

     

       

     

     

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

    Singapore Customized, custom made Electronics Circuits & Kits

     

     

    3. Touch sensor in action

    Testing out with my first touch sensor prototype board. It is actually more sensitive than expected. The sensor board can sense my finger at a distance of about 10mm. The circuit is quite simple to setup with only a few passive resistor and capacitor components.

    I am suppose to make the board a plate for sensing the capacitance, but I only wired the sensing plate in a form of L shape path. It is working well just like a rectangular sensing zone, even though the plate is actually a thin L shape path.

    One thing I found out. It is too sensitive. the sensor also detects if I place the board near my wooden table platform. You can actually fine tune the sensitivity by using a different capacitance component.

    Try reading the datasheet for further information on using QT100 touch sensor. You can find more tips on making your own touch sensing device.

    The following videos demonstrate the signal out put you can expect from QT100 touch sensor IC.

    MVI_4968.AVI

    Touch sensor is sensitive

    MVI_4970.AVI

    MVI_4969.AVI

     

     

     

    4. Touch Vibration Motion Sensor

     

     

    This is a simple vibration detection switch. The switch will make a contact upon slight vibration or motion.

    Typical application for this sensor
    – vibration detection (detect vibrate on an object)
    – touch sensor (motion touch of finger/hand)
    – knock sensor (door knocking)
    – centrifugal force sensor (detect the present of centrifugal force on a machine or motor)
    – detect sudden motion (sudden change in motion)

    click here to
    Buy Vibrate Sensor
    Available Now at the PIC-store

     

    A simple schematic of the vibrate sensor circuit under testing.

     

    The picture and schematic on the left presents a simpe circuit to test the sensor.

    The output signal is a digital on and off signal, like a random noise or glitches. The change of signal’s logic indicate that there is a vibration or knock present. The output state of the sensor at rest will be logic 1 (5V); the sensor is a open switch at rest position.

    When the sensor is subjected to a centrifugal force, the sensor will be at close position, with its output staying constant at logic 0 (0V).

    The output signal is quite raw, but can be easily intepreted from a micrcontroller to detect the vibration event.

    My finger giving the sensor a slight knock.

     

    The sensor is a very sensitive touch switch. Any finger knock on the physical sensor will trigger an output response.

    The following signal is taken from the output signal of the vibrate sensor. The output signal of various knock and vibration. Some slight touch, while some very hard hit on the sensor.

     


    slight knock


    slight knock


    slight knock (zoom in). It is actually a short negative pulse of about 5us.


    slight knock with a double pulse detected.


    harder knock


    harder knock


    vibration


    vibration

    A permanent logic 1 or 5V will occur when the sensor is subject to a centrifugal force.

     

     

     

    5. Piezo Touch Sensor

     

    Touch sensor using piezo was what I would have never though of. I know the many use of piezo, but using it as a touch is over-whelming to me.

    I have searched the website for more information about piezo, and managed to consolidate them below.

    This is how a plain piezo sensor looks like. It consist of two plate which can bend with input voltage (use as a speaker), and generate voltage when bend (use as a microphone).

    Using piezo as a buzzer.

    Alternating voltage is applied to the wire pair which will vibrate the sensor. In simple sense, it works like a speaker.

     

    A illustration of how the piezo sensor, 2 plate generate voltage when bend or how it bends when voltage is applied.

    Throat microphone using piezo.

    Normal microphone depend on the sound wave through the air. Sometimes noise from a distance can be pick up by the mic. A throat mic is held close to the throat, picking up the vibration from our voice. This can prevent the distance noise from being pick up, but it also has its own source of noise. Anything that can vibrate the throat mic will be the potential source of noise for the throat mic.

    Ultrasonic Transducer using piezo plate.

    This sensor is widely deploy on a vehicle as a parking sensor. The sensor will activate a warning buzzer when it detect an object behind the vehicle. The sensor generate an ultrasound wave and any object in the path of the wave will reflected the sound wave back to the sensor. A detection of the reflected sound will indicate an object in front of the sensor. It works is like the bat flying in the dark using their ear to navigate.

    taken from http://piezo-switch.com/index-2.html

     

    Piezo sensor as a touch switch.

    Using piezo as a touch switch has many advantages over other type of sensors.

    – durable, waterproof

    – easy to maintain, long lifespan

    – robust to RF, capacitance interference.

       
    The piezo schematic that I have tried out: My flat and ultra thin user button switch.

    ceramic back side of the plate.

    front side of the plate.

    side view showing the piezo, a very thin plate.

    Schematic making use of piezo plate as a touch button push switch. Switch will get activate with a light tap on the piezo plate.

    A simpler schematic to use the piezo plate as a switch.

       

    Some of the signal taken on the piezo output and also the processed switching signal.

     

    Ch1 (yellow) is the npn transistor output.

    Ch2 (blue) is the signal taken at the piezo out. Signal can reach as high as a few volts. When pressure is applied to the white ceramic back side, the signal will start off with a positive curve, followed by a negative smaller curve. The opposite signal will be generated if the pressure is applied from the front face.

     

    I managed to play around with various design. Some design, the signal decay slowly which result in glitches. Overall the piezo is quite simple to interface. Vibrate can activate the sensor, but not as bad as I had imagine. This undesirable noise can be filtered with proper design.

    Signal taken with my final op-amp schematic design as posted above. The square pulse has a much cleaner cut.
       

    Piezo touch sensor circuit taken from other website

     

     

     


    www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller



     

     

     

     

     

    Keyword: Touch sensor switch, proximity, capacitance, capacitive touch sensing, surface acoustic wave, resistive 4 wire 5 wire

     

RFID

NFC (Near Field Communication), RFID

It is all about NFC technology applications, RFID tags, ISO/IEC14443, ISO/IEC18092. Information about near field communication RFID technologies.

Edited by Lim Siong Boon, last dated 03-Mar-2012.

Topic Discussion Overview

  1. RFID Introduction
  2. RFID Tags
  3. Tag Packaging
  4. RFID Reader
  5. NFC
  6. Card Reader IC
  7. Magnetic materials

 

1. RFID Introduction

 

 

 




Having the Right Mindset for RFID technology.

RFID is known as Radio Frequency IDentification. The technology is able to wireless-ly picking up information from a RFID tag which can be embedded onto most object. Fast and reliable. RFID has helped to rise up our productivity.

The process starts with the RFID reader transmitting power and command wireless-ly. The RFID tag intecept the energy to power up itself. It starts to decode the request commanded and transmit the result back to the RFID reader. All these happen instantly with microseconds.

Many of the old technologies (bar-code, magnetic stripe, smart card) can be replaced by RFID system, but rate of adoption rate is slow. Examples of applications that the RFID have completely taken over are, security door access system and transportation payment card. Comparing RFID over the old technologies, it is perceive to be more expensive. The technology do has its advantages and disadvantages, which is why not all applications use RFID.

People likes to compare RFID to a bar-code system which is a cheaper alternative. The fact is, RFID tag will never be as cheap as a printed bar-code. It is more complex than bar-code. No matter how big the production volume will be, it will not be cheaper than the bar-code. Using a RFID to perform barcode application is analogy to hiring an engineer to do simple office cleaning work. No company would be in the right set of mind to invest in a expnsive solution to replace what a cheaper solution would solved.

People also think of RFID technology as a solution. RFID unique and good, but it can only solve part of the problem that we are facing in our life. You can analogy it to a very good engineer that you have hired. He/she has all the skills and know-how to design a quality system that no one else can, but there are no proper tools and equipments provided. Only a broom and a dustpan is provided. The engineer will be as good as a cleaner. RFID is designed to solve certain problem very efficiently. By itself, it cannot do any much. It has to work hand in hand with another good technology.

RFID has its own unique properties that no other technology is able replace it completely. Applying RFID technology to its advantage, to the right application will be the key to success adoption. If you want RFID system to be successful, you cannot think using a bar-code brain.

This site is dedicated to understand more about the properties of RFID technology, hence allowing us to apply its unique leading edge where no other technologies can replace. The focus will be mainly in the RFID for ISO/IEC14443 (HF 13.56MHz RFID system) which has a near perfect characteristic for interaction between humans and object; and also information on ISO/IEC18092 (NFC protocol implementation) which is the new trend on applying RFID technology. With the growing number of NFC mobile phones being launch, we can clearly see that the industry is committed in making our life more productive.

Let us start by a simple overview of various technologies that is related to RFID. We can easily see the advantages/disadvantages that the RFID can have in the application of tagging and identification.

 

 

Comparison chart of tagging/identification technologies

Description Form factor
can be like
like a thicker
credit card
Technology name LF RFID
(LF Passive)
HF RFID
(HF Passive)
UHF RFID
(UHF Passive)
Active RFID Tag
(UHF Active)
2D Barcode Barcode Smart Card Magnetic Stripe Light Sound
small in size
conceal easily
contain more information
attach to odd shaped object  
attach to object with metal surface or liquid content
store information
durable
passive (no need battery)
contactless
no need to be line of sight
retrieve data fast
secured communication
low cost
far reading distance
simple to manufacture
frequency
<135KHz
13.56MHz
868-950MHz
433-5.8GHz






read distance
low
0-15cm
low-medium
0-1.5m
0-15cm (NFC)
far
up to 10m
very far
more than 10m
to km






data rate
4-8kbps
6.7-848kbps


















 

 Selecting guide your RFID technologies. Click here -> rfid-guide.pdf

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

 

 

2. RFID Tags

HF RFID tag
125KHz / 13.56MHz

UHF RFID tag
860 – 960 MHz / 2.4Ghz

Click to enlarge the picture.

 


Basic RFID Tag

RFID tag, is also known as RFID Transponders. The tag is make up of three basic components. An IC chip, an antenna or coil, and a substrate that holds the chip and antenna/coil together.

The picture on the left shows two typical tag design. The one on the left is a coil design. It is mean for LF/HF RFID tag (low/high frequency) that operates in a low frequency range. The tag uses induction method as a means for power and communication. The UHF RFID tag (ultra high frequency) on the right uses a dipole antenna design. The tag uses RF transmission (radio frequency operating at a much higher frequency) method to obtain its power and achieve communication.

Higher frequency tag is able to transmit information faster, and need less energy to receive/transmit information compare to a tag that uses lower frequency; lower frequency takes more time. Antenna helps to transmit the signal can be smaller at higher frequency. With the signal transmitting out of the antenna, tag can be read at a further distance away.

At this stage in time, you may think that a UHF tag is better than a HF tag. You can be right and wrong. A tag that can be read at a far away distance can be good. The same property will not be good if you need to get hold of a specify tag but end up with all the rest of the tag nearby. There is little value in defining the good and bad. What is more important, is understanding the property of what it can or cannot do, and apply its properties to its advantage. This depends mainly on the application.

For the application of tagging an object, I have valued HF tags more than the other alternative technologies. Passive RFID tag using HF or NFC has a higher potential in solving problems relating to interraction betweeen living things and physical object. This which will be further presented as another topic in another site.

 

This is a finger that I have downloaded from the internet. Notice the black square dot on the middle of the finger. That is the RFID transponder IC chip which can be found on a RFID tag. You can hardly see it.

 

 

 

 

 

 

IC chip for RFID tag

The IC chip on the RFID tag is very very small; not much bigger than a gain of sand (see photo on the left). This makes the tag small enough for a lot of purpose. This IC contains memory which can store information. The cost of the chip is proportional to the memory size and functional it has. The IC chip needs power to operate. It will get its power from its antenna. The tag’s antenna will capture the energy transmitted by the RFID reader. The RFID reader will generate the RF energy from its own antenna when a read command is initiated.

There is a limit distance in which the antenna can effectively capture the RF energy for powering up the tag. This distance will depends on the transmitting power from the RFID reader, as well as the size of the tag’s coil. The bigger the coil on the tag, the further the distance. As a rule of thumb, a bigger tag is expected to achieve a further read distance than a smaller tag..

**pic of transmitting energy from induction stove, RFID reader. Coil with LED. big tag further distance. higher power further distance

When the tag received enough power to operate, the IC will immediately power up, and response to the command from the RFID reader. The tag will usually read the binary information contains in its memory and send them back to the reader. The basic form of read information will be the tag identification number. If the tag contains additional user data, the reader can issue command to read them all. All these process happens within micro seconds.

RFID tag is essentially similar to a memory card. Similar to the flash memory card that we have been using for our digital camera, the RFID tag is using wireless power/communication, and has much less memory. The memory available can be as little as a few bytes to store the tag ID, to about 8Kbyte to store other user’s data. Each alphabet letter takes about 1byte of space, so a 8Kbyte memory can store about 8000 characters. The higher memory capacity tag will usually cost a bit more.

The LF RFID tags that I have seen can only be read. HF tags can be read/write. It is also possible to protect the tag from data writing. Some IC chip is able to kill the tag, therefore prevent a read from the tag, rendering the tag useless.

Depending on the chip, tags can be pre-programmed during the manufacturing to contain the same or unique ID no. (identification number). An unique ID no. for each tags will enable the reader to differential the multiple tags read.

LF and HF tags uses induction method and has a short reading distance <10cm. UHF tags can go as far as 10m. The distance will varies with varies RFID reader’s transmitting power and antenna/coil size. A bigger size antenna will usually have a longer read distance.

 

 

Ferrite raw material in powder form
Ferrite bead commonly used for EMI on cable.
Ferrite sheet is form like a rubber mat and can be cut and place behind the RFID tag to improve readibility.

 

Fig 1. Magnetic field pattern of a typical RFID operation.
Fig 2. Magnetic field interference when RFID tag is stick close to a metal surface.
Fig 3. Improve magnetic field operation with a ferrite sheet between the tag and metal surface.

Fig 4. Cross section of the magnetic field detected

 

 

RFID operation with metalic or liquid objects

RFID has difficulty operating near metalic, liquid object (water bottle/ human body). Induction field around the tags will be collapse by these object. A minimum gap away from such object is required for proper operation. Metal surface can block/reflect RF signal, causing distortion to the signal, making it difficult to read the tag. There are special anti-metal tags (RFID Metal Pad) that allows RFID to operate under such tough condition. These tags are padded with a sheet of ferrite material behind the tag. The sheet actually forms the gap between the tag and the metal surface, allowing the tag to be read through the RF. The ferrite is itself a RF friendly material which permits the RF & field to sustain. With this padding, the tag readability can be improve slightly.

 

 

 

 

 

 

 

 

 

 

 

Ferrite sheet is available from:

TDK, FLEXIELD material

MARUWA, FLEX-u sheet

Active RFID tag

Active RFID tag with sensor attached

 

 

Active RFID tag with built-in sensor

Active RFID tag (sef powered, usually a battery) operates like a typically electronic transceiver device. Reading distance is a lot further than a passive RFID tag (not self power). The operations is similar to a passive tag where the reader will be able to retrieve the tag information when it is near enough. Some call the tag a signal beacon, where the tag keeps sending signal out. The tag can be read at a much further distance. This is because it has its own power source and do not need to harvest from the reader.

There are active tags that have built in sensor. The temperature/humidity sensor for example, will be operated by the RFID tag and send back the temperature read back to the reader. The battery usually last quite sometime, but it will definately need replacement one day.

Buy your NFC Tag Now at the PIC-store

 

Three typical standard among RFID tags
– LF tag (Low Frequency 125KHz) ISO11784 / ISO11785
– HF or NFC tag (High Frequency 13.56MHz) ISO/IEC 14443
– UHF tag (Ultra High Frequency EPC Class 1 Gen2)

Tag’s IC chip Standard Frequency Memory
EM4001   125KHz 64byte
EM4305 ISO11784/ ISO11785 125KHz 512byte
NXP Hitag 1   125KHz 2048bit
NXP Hitag 2 ISO11784/85 125KHz 256bit
NXP Hitag S ISO11784/85 125KHz 256/2048bit
Atmel Temic T5567 ISO11784/85 125KHz 363bit
Atmel Temic T5557 ISO11784/85 125KHz 363bit
       
NXP Mifare Ultralight, MF0 IC U1X

ISO/IEC14443A
NFC Forum Tag Type 2

13.56MHz

64byte
7 bytes tag ID
16pgx4b

NXP Mifare Ultralight C, MF0 IC U2X

ISO/IEC14443A,
NFC Forum Tag Type 2

13.56MHz 192byte
7 bytes tag ID
48pgx4b
NXP Mifare Classic Mini, S20 ISO/IEC14443A 13.56MHz 320byte
4 bytes tag ID
NXP Mifare Classic 1k, MF1 S50

ISO/IEC14443A

13.56MHz 1Kbyte
4 bytes tag ID
16 sectors x64b
NXP Mifare Classic 4k, MF1 S70

ISO/IEC14443A

13.56MHz 4Kbyte
4 bytes tag ID
32 sectors x64b
8 sectors x256b

NXP Mifare Plus S 2K, MF1 SPLUS 60
(replace Mifare Classic series )

ISO/IEC14443A 13.56MHz 2Kbyte
7 bytes tag ID
32 sectors x64b

NXP Mifare Plus S 4K, MF1 SPLUS 80
(replace Mifare Classic series )

ISO/IEC14443A
7 bytes tag ID
13.56MHz 4Kbyte
7 bytes tag ID
32 sectors x64b
8 sectors x256b

NXP Mifare Plus X 2K, MF1 PLUS 60
(replace Mifare Classic series )

ISO14443 13.56MHz 4Kbyte
7 bytes tag ID
32 sectors x64b
8 sectors x256b

NXP Mifare Plus X 4K, MF1 PLUS 80
(replace Mifare Classic series )

ISO14443 13.56MHz 4Kbyte
7 bytes tag ID
32 sectors x64b
8 sectors x256b

NXP Mifare DESFire EV1,
MF3 IC D21
MF3 IC D41
MF3 IC D81

ISO/IEC14443A
NFC Forum Tag Type 4

13.56MHz

2/4/8Kbyte
7 bytes tag ID
flexible file system

NXP SmartMX

ISO/IEC14443A
NFC Forum Tag Type 4

13.56MHz  
NXP MIFARE SAM AV2 ISO/IEC 14443A 13.56MHz  
Innovision Topaz

ISO/IEC14443A
NFC Forum Tag Type 1

13.56MHz 96byte
Sony FeliCa lite ISO 18092 13.56MHz  
Sony FeliCa

ISO 18092
NFC Forum Tag Type 3

13.56MHz 1/4/9Kbyte
TI TAG-IT lite   13.56MHz 256bit
TI TAG-IT ISO 15693 13.56MHz 2048bit
NXP ICODE EPC EPC 13.56MHz 136byte
NXP ICODE 1 ICODE 1 13.56MHz 512byte
NXP ICODE SLI-L ISO15693/ ISO18000/ EPC 13.56MHz 512bit
NXP ICODE SLI ISO15693/ ISO18000 13.56MHz 1024bit
NXP ICODE SLI-S ISO15693/ ISO18000/ EPC 13.56MHz 2048bit
Legic MIM256   13.56MHz 256byte
Legic MIM1024   13.56MHz 1024byte
Legic ATC-MV ISO15693 13.56MHz 128/256/1024byte
Legic ATC-MP ISO/IEC14443A 13.56MHz 0.5/2/4Kbyte
INSIDE PicoPass 2KS ISO14443B/ ISO15693 13.56MHz 2Kbyte
       
NXP UCODE HSL ISO18000-6B 2.4 GHz 2048 bit
NXP UCODE EPC Gen2 EPC Class 1 Gen2 860 – 960 MHz 512 bit
NXP UCODE G2XL EPC Class 1 Gen2 860 – 960 MHz 368 bit
NXP UCODE G2XM EPC Class 1 Gen2 860 – 960 MHz 880 bit
Alien Higgs 2   860 – 960 MHz  
Alien Higgs 3   860 – 960 MHz  
       
Innovision Jewel      
ISSI4442      
ISSI4428      
ISSIM1      
Infineon SLE5542      
Infineon SLE4428      
Infineon SLE4442      
Infineon SLE5528      
Infineon SLE6636      
Atmel 24C16/24      
Atmel 24C64/128      
Atmel 24C512/1024      
Atmel AT88SC0204C      
Atmel AT88SC0404C      
Atmel AT88SC1616C      
Atmel AT88SC3216C      
Atmel AT88SC0808C      
Atmel AT88SC1608      
       
Java      
JCOP      

Good RFID tag reference information, http://www.gorferay.com

 

RFID tag IC chip and standard

When dealing with RFID tags or reader, we will often come across various ISO standards. These ISO defines a common standard for the hardware or software to interact with one another.

The LF RFID (125Khz), ISO11784/ISO11785 is a common standard.

For UHF RFID, it is EPC Gen2 or EPCglobal UHF Class 1 Generation 2

For HF there are standard ISO15693, ISO14443 and ISO18092 (NFC). For NFC, we will focus on ISO14443 and ISO18092.


Some notes regarding NFC standards or ISO18092 (from website http://users.skynet.be/marc.sel/index-MTC.html)

In transport applications, cards suffer from daily use, for which reason contactless cards are preferred. Contact cards are more prone to hardware wear-out, hence contactless cards are better suited in the transport sector. This led to the creation of the RFID standard, ISO 14443, composed of 4 parts. It operates in the non-licensed 13.56 Mhz band. As there were two main “competitors”, there are two substandards:

  • ISO 14443 type A (origine: NXP)
  • ISO 14443 type B (origine: RATP)

Later under impetus from Sony, the NFC standard was established as ISO 18092. It’s a backward compatible extension to RFID, mainly aiming at use in mobile phones. It’s was actually proposed as ISO 14443 type C by Sony, based on FeliCa. It’s used e.g. in the Hong Kong Octopus and Singapore EZ-link systems. It did not make it to the 14443 standard, but came back as NFC.

Article for ISO/IEC 14443

 

Mifare Tag ID issues (tag ID unqiue?)

Mifare name comes from the “MIkron FARE Collection System”. Mikron was aquired by Philips (NXP) in 1998. Given the Mifare Classic tag ID of 4 bytes, will the tag ID run out of unique ID?

 

 

 

RFID tag/transponder IC manufacturer

NXP Semiconductors, Mifare RFID transponder IC manufacturer
Alien Technology, has many UHF tags
ST microelectronic
EM Microelectronic
Texas Instruments
Legic
Inside Contactless
Atmel
Siemens (infineon)
 

Innovation Research & Technology

  ISSI

 

 

 

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

 

 

3. Tag Packaging

 

Common RFID tag packaging

 

**Packaging (find chinese terms)
– inlay (wet/dry)

Reference:
http://www.skyrfid.com/RFID_Tag_Inlays.php

 

     

 

Inlay (dry)

Dry inlay is the fundenmental building block for RFID tag. They are usually be further packaged into RFID tag products. The term “dry” means that it does not have adhesive on it’s tag surface. The inlay can comes in roll or sheet form.

RFID in roll form

RFID in sheet form

 

Common size:
35x35mm
43x26mm
50x30mm
85.5x54mm

 

Inlay layer and thickness  
Layer:
IC:75um-150um
Al(TOP)30um
PET:38um
AL(Bottom):10um

 

Layer within a RFID card  
Different layer of a package RFID card. The RFID inlay is sandwiched between the PVC (Polyvinyl chloride) and next with printed PET/PVC (polyethylene terephthalate) finishing.

 

 

 

Inlay (wet)

Wet inlay means that the inlay has adhesive on one of its side. The tag will be attached to a pressure sensitive liner base.

– sticker label

 

 

 

IDCard/Badge

These are hard PVC card about 1mm thickness. The card printing can be customised. There is also a special printer that prints on these plain tags.

– PVC/Plastic card
– glossy, matt paper

 

RFID Cards and tags printer  

Zebra

Intermec

 

ezlink using CEPAS card

FlashPay using CEPAS card

Visa Paywave

octopus card octopus cardwww.octopus.com.hk

 

Payment Card (Singapore)

Ezlink, based on the Sony FeliCa smartcard technology

Flash Pay

payWave

CEPAS = ISO/IEC 14443-4 + ISO/IEC 7816-4: 2005

 

Singapore Standard, specification for contactless e-purse application

 

Octopus card, based on the Sony FeliCa smartcard technology

base on MIFARE DESFire EV1 card

  Label Stickers
key chain rfidkey chain rfidkey chain rfidkey chain rfid   Key Chain, Key Fob
  Waterproof Rubber Bracelet, Wrist band
  Patient Tag
  Lugagge Tag
  Button Tag, Washing Tag
  Disc or Ring Tag, Laundry Tag, Pucks
  Casino Game Token
  Fragile Tag, Security Tag
  Anti-Metal Tag
  Hard Tag
  Pill
  CD label

  UHF tags

 

RFID Tag manufacturer

HID

 

Intermec

 

Avery Dennison
Alien Technology, has many UHF tags

 

 

 

 

 

4. RFID Reader




 

RFID reader is getting more and more common. Nowsaday Windows & mobile phone OS has built in driver treating RFID reader as a standard device.

Common RFID interface
RS232
RS485
Wiegand
USB
Ethernet

 

 

USB RFID reader kit

  OEM board
  Door Access Security
  Mobile phone NFC / RFID reader
  Payment station
  UHF RFID reader and Antenna

 

RFID Reader manufacturer

HID

 

Intermec
Alien Technology, has many UHF tags
Motorola
   

 

   

 

 

 

5. NFC

 

NFC (Near Field Communication)

 

NFC phone to phone,

Phone to RFID tag

 

NFC currently use for Payment, transportation payment.

Instantly access to webpage,

Instant bluetooth/WiFi connectivity.


Reference:

NFC Tags A technical introduction, applications and products, R_10014

Understanding the Requirements of ISO IEC 14443

MIFARE Ultralight as Type 2 Tag, AN1303

NFC Type MIFARE Classic Tag Operation, AN1304

MIFARE Classic as NFC Type MIFARE Classic Tag, AN1305

MIFARE Type Identification Procedure, AN10833

 

 

6. Card Reader IC

 

 

13.56MHz RFID card reader IC

Reader IC Manufacturer Standards & Protocol Interface
CL RC663 NXP NFC Tag Type Reader
ISO14443A
ISO14443B
ISO15693
MIFARE Classic support
ICODE 1 protocol
HF EPC protocol
ISO 18092 (NFC)
SPI
2x IC
RS232
CL RC632 NXP NFC Tag Type Reader
ISO14443A
ISO14443B
ISO15693
MIFARE Classic support
ICODE 1 protocol
HF EPC protocol
SPI
8-bit parallel
MF RC531
NXP NFC Tag Type Reader
ISO14443A
ISO14443B
MIFARE Classic support
SPI
8-bit parallel
MF RC523 NXP NFC Tag Type Reader
ISO14443A
ISO14443B
MIFARE Classic support
SPI
IC
RS232
MF RC500
MF RC530
NXP NFC Tag Type Reader
ISO14443A
MIFARE Classic support
8-bit parallel
MF RC522 NXP NFC Tag Type Reader
ISO14443A
MIFARE Classic support
SPI
IC
RS232
CR95HF ST microelectronics   SPI
UART
TRF7970A Texas Instruments    
TRH033M-S 3ALogics    
       

 

 

Getting to understand RFID was quite a confussing experience, with so many technical jargon. This was the reason why this website is setup; to sort out all the technical stuff into bits and pieces.

Card Reader is another interest topic to looking. A card reader helps to read out the information in a tag. An RFID reader is not a different device to understand, but not the card reader.

What is the difference between an RFID reader and a card reader? The RFID reader reads RFID tag. There are many variety of RFID standards in the industry. This means that there are also many type of RFID reader to read each type of card. (The type of cards was already presented above).

The variety of reader is going to make things complicated for developer who are developing application. This call for an universal solution known as ISO 7816. This is a standard defined for interfacing application with all smart card devices.

From what I read in the internet, this standard goes way back to the smart card technology. The smart card unlike RFID card is using wired communication to read the information on the card. You can identify it by the contact pins as shown in the following pic.

It is possible that a card has both the smart card as well as RFID card.

With the introduction of new form of card like RFID, the ISO 7816 evolve over time. ISO 7816 defines a standard interface for the card reader. The communication standard to a card reader device becomes a standard.

Article for ISO 7816 (specification for interfacing with card reader)

AN4029, The DS8007 and Smart Card Interface Fundamentals

PCSC Personal Computer Smart Card is a standard framework for Smart Card access on Windows Platforms. This will make the job easier for application developers to interface to a card reader. To the developer, all card reader seems to work the same way.

The window operating system will automatically detects.

Interoperability Specification for ICCs and Personal Computer Systems

PCSC_Part1, Introduction and Architecture Overview.pdf.pdf
PCSC_Part2, Interface Requirements for Compatible IC Cards and
Readers.pdf

PCSC_Part3, Requirements for PC-Connected Interface Devices.pdf
PCSC_Part4, IFD Design Considerations and Reference Design
Information.pdf

PCSC_Part5, ICC Resource Manager Definition.pdf
PCSC_Part6, ICC Service Provider Interface Definition.pdf
PCSC_Part7, Application Domain and Developer Design
Considerations.pdf

PCSC_Part8, Recommendations for ICC Security and Privacy
Devices.pdf

 

My card reader

ACR122 NFC card reader from ACS.

Documentation
PPE_ACR122, presentation.pdf
API_ACR122U, Application Programming Interface.pdf
TSP_ACR122U_v2.5, Technical Specification.pdf

Win7 64bits driver
DIG_ACR122, Driver Installation Guide.pdf
ACR122U_MSI_Winx64_1120_P

 

This is the first NFC card reader that I have brought. I have purchased this reader without any development kit, and was struck wondering how I can read a RFID tag without any software.

After understand about ISO 7816 and PCSC, I managed to find a number of free software that can communication with this NFC card reader. They are designed to work with PCSC compliants card reader.

SCardToolSet, Smart Card ToolSet PRO v3.4
sq2075-ba, SpringCard PCSC Diag
online PCSC card reader program

The software are able to detect my card reader immediately. When my RFID tagis placed on the reader, the software detects it and display the tag information.

The very first unqiue string that was captured when I read the RFID tag is this string call ATR (Answer To Reset). It is a very weird name, because I was thinking that this should be the unqiue ID of the RFID tag. No it is not. This ATR string (as defined in ISO 7816) is telling us how we can communicate with the current tag found on the card reader.

This is the ATR string that I read when the tag (picture on the left) is on the reader

ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68

So what does this hexidecimal string of number means?

Byte Name Comments
0x3B TS Direction convention
0x8F T0  
0x80 TD1 Higher nibble 8 means: no TA2, TB2, TC2, only TD2 is following. Lower nibble 0 means T=0
0x01 TD2 Higher nibble 8 means: no TA3, TB3, TC3, only TD3 is following. Lower nibble 1 means T=1
0x80 T1 Category indicator byte, 80 means A status indicator may be present in an optional COMPACT-TLV data object.
0x4F Tk Application identifier Presence Indicator
0x0C Length Length = 12 data byte (from next byte to check sum byte)
0xA0 0x00 0x00 0x03 0x06 RID PC/SC Workgroup
0x03 Standard ISO14443A, part 3
0x00 0x03 Card Name

Mifare Ultralight

00 01 Mifare 1K
00 02 Mifare 4K
00 03 Mifare Ultralight
00 26 Mifare Mini
F0 04 Topaz and Jewel
F0 11 Felica 212K
F0 12 Felica 424K

FF [SAK] undefined

0x00 0x00 0x00 0x00 RFU RFU # 00 00 00 00
68 TCK Check Sum. Ex-OR of all the bytes T0 to Tk

 

With this ATR string provided by my card reader, I will know more about the RFID tag that I am actually dealing with. The RFID tag that I have place is using the Mifare Ultralight tag’s IC chip. ISO14443A is use for communication between the reader and the tag. The rest of the information seems not so useful to me.

 

To communicate with the card reader we will have to send a string of bytes to the card reader. The data format to communicate with the reader is known as APDU (Application Protocol Data Unit).

I have refered to the API (Application Programming Interface) datasheet provided by the card reader manufacturer. The first command to try is the command “Get Data”. The command will fetch the unique ID of the tag.

data send -> FF CA 00 00 04
where CA is the <Get Data> command.

The following response bytes are received.

data received <- 04 06 CD E2 90 00
where “90 00” is the response code (The operation completed sucessfully)
” 04 06 CD E2″ is the unique tag ID.

 

Next I tried to get the card reader firmware version.

data send -> FF 00 48 00 00
data received <- 41 43 52 31 32 32 55 32 31 30

The data received is “ACR122U210” in ascii format

 

 

 

 

 

Reading Mifare Ultralight tag 1, tag ID  

Another Mifare Ultralight tag1 was read for its ATR and tag ID

ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
APDU send -> FF CA 00 00 04 (read tag ID)
APDU received <- 04 AA 2C 79 90 00

 

Reading Mifare Ultralight tag 2, tag ID  

Another Mifare Ultralight tag2 was read for its ATR and tag ID

ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
APDU send -> FF CA 00 00 04 (read tag ID)
APDU received <- 04 2D 44 79 90 00

 

Reading Singapore Ezlink card (CEPAS card)

 

Next I tried another RFID tag. Our Singapore Ezlink card, which stores transportation logs in CEPAS format.

ATR = 3B 8C 80 01 50 72 23 AA 5E 1C 2D 94 11 F7 71 85 4F

When the tag is removed and placed on the reader again, the ATR string changes. This is unlike the previous tag where the ATR will remains the same for the same tag.

ATR = 3B 8C 80 01 50 21 0A 96 CF 1C 2D 94 11 F7 71 85 98
ATR = 3B 8C 80 01 50 B5 AE 55 A7 1C 2D 94 11 F7 71 85 03
ATR = 3B 8C 80 01 50 6D 83 67 F0 1C 2D 94 11 F7 71 85 93

The ATR tells us that it uses the application identifier 0x50. I don’t know what it means.

 

Next I proceed to send read tag ID command.

ATR = 3B 8C 80 01 50 5D 83 48 22 1C 2D 94 11 F7 71 85 5E
APDU send -> FF CA 00 00 04 (read tag ID)
APDU received <- 5D 83 48 22 90 00

ATR = 3B 8C 80 01 50 FE 15 0F A4 1C 2D 94 11 F7 71 85 AA
APDU send -> FF CA 00 00 04 (read tag ID)
APDU received <- FE 15 0F A4 90 00

The tag ID changes with the ATR string. A closer look review that the tag ID is the same data as the substring in the ATR.

 

Reading DESFire EV1 2K tag  

A DESFire EV1 card ATR string is unexpectedly short.

ATR = 3B 81 80 01 80 80

The ATR string remains the same when the tag is

APDU send -> 90 0A 00 00 01 00 00
APDU received <- 84 D9 62 65 A2 3C A7 C8 91 AF

APDU send -> 90 0A 00 00 01 00 00
APDU received <- 91 CA

APDU send -> 90 0A 00 00 01 00 00
APDU received <- F3 A2 3C CC 2A 89 6E 51 91 AF

APDU send -> 90 0A 00 00 01 00 00
APDU received <- 91 CA

APDU send -> 90 0A 00 00 01 00 00
APDU received <- EB F4 A2 15 88 41 0C 3C 91 AF

APDU send -> 90 0A 00 00 01 00 00
APDU received <- 91 CA

APDU send -> 90 0A 00 00 01 00 00
APDU received <- FF 15 CD 6C 73 F0 28 D5 91 AF

APDU send -> 90 0A 00 00 01 00 00
APDU received <- 91 CA

APDU send -> 90 0A 00 00 01 00 00
APDU received <- BA B1 7A 2A 9C 23 C8 B7 91 AF

APDU send -> 90 0A 00 00 01 00 00
APDU received <- 91 CA

Loading a key to Mifare Ultralight  

Load
APDU send -> FF 82 00 00 06 FF FF FF FF FF FF
APDU received <- 90 00 (90 00 means ok)

 

Reading Mifare Ultralight memory (64 bytes)  

Read binary Page 0x04, 4 bytes
APDU send -> FF B0 00 04 04
APDU received <- 31 39 30 39 90 00

Read binary Page 0x04, 16 bytes
APDU send -> FF B0 00 04 10
APDU received <- 31 39 30 39 2D 2D 53 49 4F 4E 47 20 42 4F 4F 4E 90 00 (each page consist of 4 bytes)

Read binary Page 0x00, 256 bytes
APDU send -> FF B0 00 00 FF
APDU received <- 63 00 (no information given)

Read binary Page 0x01, 256 bytes
APDU send -> FF B0 00 01 FF
APDU received <- 63 00 (no information given)

Read binary Page 0x00, 16 bytes
APDU send -> FF B0 00 00 10
APDU received <- 04 06 CD 47 E2 87 28 81 CC 48 00 00 00 00 00 00 90 00

Read binary Page 0x01, 16 bytes
APDU send -> FF B0 00 01 10
APDU received <- E2 87 28 81 CC 48 00 00 00 00 00 00 31 39 30 39 90 00

Read binary Page 0x04, 16 bytes
APDU send -> FF B0 00 04 10
APDU received <- 31 39 30 39 2D 2D 53 49 4F 4E 47 20 42 4F 4F 4E 90 00

Read binary Page 0x08, 16 bytes
APDU send -> FF B0 00 08 10
APDU received <- 20 4C 49 4D 00 00 00 00 00 00 00 00 00 00 00 00 90 00

Read binary Page 0x0C, 16 bytes
APDU send -> FF B0 00 0C 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00

Read binary Page 0x10, 16 bytes
APDU send -> FF B0 00 10 10
APDU received <- 63 00 (no information given)

Read binary Page 0x10, 1 bytes
APDU send -> FF B0 00 10 01
APDU received <- 63 00 (no information given, memory bank stop at page 0x0F)

Read binary Page 0x0F, 1 bytes
APDU send -> FF B0 00 0F 01
APDU received <- 00 90 00

Read binary Page 0x0F, 16 bytes
APDU send -> FF B0 00 0F 10
APDU received <- 00 00 00 00 04 06 CD 47 E2 87 28 81 CC 48 00 00 90 00 (16 bytes of data can be read from the last page 0x0F. There is no page 0x10, the data is actually from page 0x00)

Mifare tag memory data from page 0x01 to 0x0F read:

04 06 CD 47 E2 87 28 81 CC 48 00 00 00 00 00 00
31 39 30 39 2D 2D 53 49 4F 4E 47 20 42 4F 4F 4E20 4C 49 4D 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Total memory is 64 bytes.

Ascii message contains “1909–SIONG BOON LIM”

This tag is a Mifare Ultralight tag with memory of 64 bytes

byte 00 SN0 (serial number)
byte 01 SN1 (serial number)
byte 02 SN2 (serial number)
byte 03 BCC0
byte 04 SN3 (serial number)
byte 05 SN4 (serial number)
byte 06 SN5 (serial number)
byte 07 SN6 (serial number)
byte 08 BCC1
byte 09 Internal
byte 10 Lock0
byte 11 Lock1
byte 12 OPT0
byte 13 OPT1
byte 14 OPT2
byte 15 OPT3
byte 16 Data0
….
….
byte 64 Data47

Reading the tag ID full 7 byte serial number
APDU send -> FF CA 00 00 07 (read full tag ID 7 byte)
APDU received <- 04 06 CD E2 87 28 81 90 00

Actual Tag ID is in the following sequence (high address, high byte),
SN6 SN5 SN4 SN3 SN2 SN1 SN0
 81  28  87  E2  CD  06  04

Try read tag ID 8 byte, not a correct read
APDU send -> FF CA 00 00 08
APDU received <- 04 06 CD E2 87 28 81 90 90 00
Able to read a 0x90 data for the last byte but this data cannot be found within the tag’s memory.

Reading Mifare Ultralight C memory (168 bytes)  

Read binary Page 0x29, 4 bytes
APDU send -> FF B0 00 29 04
APDU received <- 00 00 00 00 90 00 (ok)

Read binary Page 0x2A, 4 bytes
APDU send -> FF B0 00 2A 04
APDU received <- 63 00 (not ok)

Total available page is 42 from 0x00 to 0x29.
Total memory is 42 pg x 4 bytes = 168 bytes

Reading Mifare Ultralight C memory (176 bytes)  

Read binary Page 0x2B, 4 bytes
APDU send -> FF B0 00 2B 04
APDU received <- 00 00 00 00 90 00 (ok)

Read binary Page 0x2C, 4 bytes
APDU send -> FF B0 00 2C 04
APDU received <- 63 00 (not ok)

Total available page is 44 from 0x00 to 0x2B.
Total memory is 44 pg x 4 bytes = 176 bytes

Reading Mifare 1K memory, part 1  

Reading tag ID
APDU send -> FF CA 00 00 04 (read tag ID, 4 bytes)
APDU received <- 2B 2C 1E 95 90 00

APDU send -> FF CA 00 00 07 (read full tag ID, 7 bytes)
APDU received <- 2B 2C 1E 95 07 00 00 90 00

APDU send -> FF CA 00 00 08 (try read incorrect tag ID length)
APDU received <- 2B 2C 1E 95 07 00 00 90 90 00

Read from block 0x04, 16ytes
APDU send -> FF B0 00 04 10
APDU received <- 63 00
Reading from location fails

Authentication with a type A (0x60), key number 0x00 for memmory block 0x04
APDU send -> FF 86 00 00 05 01 00 04 60 00
APDU received <- 90 00

Read from block 0x04, 16ytes
APDU send -> FF B0 00 04 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
Read ok.

Read from block 0x04, 16ytes
APDU send -> FF B0 00 04 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
Read again ok.

Card is removed and place back on the reader.
Read from block 0x04, 16ytes
APDU send -> FF B0 00 04 10
APDU received <- 63 00
Reading from location fails. The card will need to go through authentication again.

Reading Mifare 1K memory, part 2  

Authentication with a type A (0x60), key number 0x00 for memmory block 0x04
APDU send -> FF 86 00 00 05 01 00 04 60 00
APDU received <- 90 00

Read from block 0x04, 16ytes
APDU send -> FF B0 00 04 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
Read ok.

Read from block 0x05, 16ytes
APDU send -> FF B0 00 05 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
Read ok.

Read from block 0x06, 16ytes
APDU send -> FF B0 00 06 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
Read ok.

Read from block 0x07, 16ytes
APDU send -> FF B0 00 07 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
Read ok.

Read from block 0x08, 16ytes
APDU send -> FF B0 00 08 10
APDU received <- 63 00
Reading not ok.

Read from block 0x03, 16ytes
APDU send -> FF B0 00 03 10
APDU received <- 63 00
Reading not ok.

Authentication on block 0x04 can only allows reading of data for block 0x04 to 0x07 (which is on the same sector 1) for as many times without the tag leaving the card reader. Memory block 0x03, 0x08 cannot be read.

Mifare 1K tag memory block
Sector 00, Block 0x00 – 0x03 (16 bytes/block)
Sector 01, Block 0x04 – 0x07
….
….
Sector 14, Block 0x38 – 0x3B
Sector 15, Block 0x3C – 0x3F

 

Reading Mifare 1K memory, part 3  

Authentication with a type A (0x60), key number 0x00 for memmory block 0x3F
APDU send -> FF 86 00 00 05 01 00 3F 60 00
APDU received <- 90 00
Ok, reading the last block.

Read from block 0x3F, 16ytes
APDU send -> FF B0 00 3F 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
Read ok.

Authentication with a type A (0x60), key number 0x00 for memmory block 0x40
APDU send -> FF 86 00 00 05 01 00 40 60 00
APDU received <- 63 00
Not ok. (out of the 1K zone)

Reading Mifare 4K memory  

Reading Mifare 4K is the same as Mifare 1K. Only the memory map is different.

  Mifare 4K tag memory block
1K Sector 00, Block 0x00 – 0x03 (16 bytes/block)
Sector 01, Block 0x04 – 0x07
….
Sector 14, Block 0x38 – 0x3B
Sector 15, Block 0x3C – 0x3F
1K Sector 16, Block 0x40 – 0x43
Sector 17, Block 0x44 – 0x47
….
Sector 30, Block 0x78 – 0x7B
Sector 31, Block 0x7C – 0x7F
1K Sector 32, Block 0x80 – 0x8F
Sector 33, Block 0x90 – 0x9F
Sector 34, Block 0xA0 – 0xAF
Sector 35, Block 0xB0 – 0xBF
1K Sector 36, Block 0xC0 – 0xCF
Sector 37, Block 0xD0 – 0xDF
Sector 38, Block 0xE0 – 0xEF
Sector 39, Block 0xF0 – 0xFF


 

Writing Mifare Ultralight   Writing to block 0x04 with 4 bytes of data 00 01 02 03
APDU send -> FF D6 00 04 04 00 01 02 03
APDU received <- ?? ??
Reading Mifare Ultralight tag 1, containing NFC data  

Read binary Page 0x00, 16 bytes
APDU send -> FF B0 00 00 10
APDU received <- 04 AA 2C 0A 79 62 02 80 99 48 00 00 00 00 00 00 90 00 (ok)

Read binary Page 0x04, 16 bytes
APDU send -> FF B0 00 04 10
APDU received <- FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 90 00 (ok)

Read binary Page 0x08, 16 bytes
APDU send -> FF B0 00 08 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 (ok)

Read binary Page 0x0C, 16 bytes
APDU send -> FF B0 00 0C 10
APDU received <- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 (ok)

Read binary Page 0x10, 16 bytes
APDU send -> FF B0 00 10 10
APDU received <- 63 00 (not ok)

Data Memory in the tag
04 AA 2C 0A 79 62 02 80 99 48 00 00 00 00 00 00
FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Seems like no NFC data inside.

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller


 

6. Magnetic Materials    

Any material can influence magnetic, it is a matter of the intensity.

Strong Magnetic Materials (Ferromagnetic materials)
– Iron
– Nickel
– Cobalt

Not Strong (Paramagnetic materials)
– Aluminum
– Magnesium
– Platinum

Weak (Diamagnetic materials)
– Copper
– Lead
– Sliver

 

   
     

 

 


Abbreviations

AID Application ID
APDU Application Protocol Data Unit
ATR Answer to Reset
ATS
Answer to Select
AFI Application Family Identifier
CBC
Cipher Block Chaining
CID Card Identifier (logical card address, ISO 14443-4)
DES
Data Encryption Standard, for more details about DES refer to [3].
DSFID Data storage format identifier
EDC
Error Detection Code
EGT Extra Guard Time
EOF
End of Frame
ETU Elementary time unit
KTT Key Transfer Transponder
NAD Node Address (ISO 14443-4)
NDEF NFC Data Exchange Format
OSI Open System Interconnection
OTP One time programmable
PCB Protocol Control Byte (ISO 14443-4)
PCON Protocol Configuration byte of the reader
PPS Protocol and Parameter Selection
RATS

Request for Answer to Select
R-block Receive ready block
REQA Request ISO Type A
REQB Request ISO Type B
S-block Supervisory block
SID Station ID
SFGT Guard time after RATS
SN Serial Number of a tag (a 32 bit number)
SOF Start of frame
TDES Triple DES
Value block 32 bit data block format. Used in ticketing application


 

 

**Tag making video (or machine)

 

 

 

 




Reference:

Keyword: NFC (near field communication), RFID (radio frequency identification), RFID Reader/Writer, Internet of Things, Productivity


RF Transceiver

Written by Lim Siong Boon, last dated 06-Jul-08.

 

KRF-DTR401 FM Transceiver

                                          

    

    

My KRF-DTR401 is a low cost FM transceiver brought from Kingtronic RF Corp. It is brought together with the AM transceiver that I use for research in Teleradio Engineering. The AM transceiver seems working well with the signal generator, but I had never get to implement it to sent digital data. My test on KRF-DTR401 was a failure because I cannot get it to work. It was the discovery of the RF encoder and decoder IC, that motivated me to test my FM transceiver again. Subsequent transceiver test were successful and RF encoder/decoder were eventually used as a medium to send digital bits. In another term, RF encoder/decoder is like a modem. A modulation and demodulation for digital signal.

After working successfully on my first transceiver, I started souring for other transceiver for research purpose. It is at that time, I have noticed that some of the transceiver have similar specification. The circuit layout is compared and found very similar in various area. After further investigation, the IC chip they used in the PCB is the key to building this transceiver.

  

The circuit is simple and is mainly operated by the IC on the PCB board. It is actually originated from nRF401 IC from Nordic Semiconductor ASA.

The testing of the RF module couldn’t have taken place without the development of my own dc-dc converter. Commercial module is available but cost is high. Voltage regulator is necessary for most electronics circuits project. Therefore learning to build a dc-dc circuit from discrete components is worth the effort.

    

    

    

    

    

 

Schematic for Data Encoder MC145026, Decoder MC145027.

Problem

2006-03-xx: There is a problem that was found during the attempt to use this design on my robot. The wire link from the transceiver and the decoder IC cannot be too far apart. Data error rate seems to be very high, and reception is very poor. It could be due to the weak signal strength, which should be resolve by using a digital buffer. The signal is digital from the output of the transceiver. If it is a transmission issue, then it will be quite difficult to troubleshoot without proper equipment.

 

 

www.pic-control.com, Singapore Research & Development R&D

Singapore Customized, custom made Electronics Circuits & Kits

 

 

433Mhz AM Transceiver

 

 

 

433Mhz Transmitter

433Mhz Receiver

Dated: 2012-05-18

There are many RF transceiver module in the market. When the transmitting distance is a concern, my preference will be transceiver in the range of 80 ~ 500Mhz. Wireless module in the gigahertz range can achieve higher data transmission rate but transmission distance will be shorter, especially when deployed indoor.

433Mhz is a good choice for distance communication. These pair of wireless module form a one way communication. You can get these from PIC-STORE. Working in this frequency range, the antenna may be slightly long. The antenna can be just a simple wire. The interfacing can be easy as what is presented in this experiment, but in order to transmit useful information, data modulation will be recommended. Data modulation is a process which changes the physical signal to another format so that it is less prone to noise/error and is easier to decode.

The data rate for such a wireless setup is quite low, about 1~4Khz, but it is enough for most of the simple applications.

I have managed to setup a simple transmitter and receiver circuit. The schematic is attached below. The objective is to understand how the signal looks like. This will allows us to understand and make use of these raw transmitter/receiver for sending useful data. It is not so direct using these raw module. Pre-processing will be required in order to send information.

The picture shows two portion of the circuit. The left side is the 433Mhz transmitter, and a push switch (black). The right portion is the receiver which consist of the 433Mhz receiver and a LED indicator.

This is the schematic details of the simple setup. When the button is not pressed, the transmitter will send out logic 0. When the button is pressed, it will transmit logic 1.

The receiver will have a LED indicator which allows me to see the response when the button is pressed. When the receiver’s data output is low, the LED will light up. When it is high, the LED will be off.

I have attached a video of how the response is when the button is pressed.

Video of this setup. MVI_0275.AVI

In the video, you will be able to see that when the switch is not pressed (logic 0), the LED will blink continuously. When the button is pressed (logic 1) the LED will constantly light up (low output).

How the actual signal looks like? I managed to probe the data in of the transmitter, and data out of the receiver with my digital oscilloscope. They are presented in the following section.

Signal 1 (Transmitter, TTL input logic 0), Signal 2 (Receiver, TTL output pulsing signal)

The yellow line at the top is the signal input to the transmitter module (Signal 1). The blue line below is the signal output from the receiver module (Signal 2). The left scope display is the zoom out view, while the right is the zoom in view.

The transmitter is transmitting a logic 0. The output shows the periodic pulses indicating logic 0 or no transmission detected. This is the reason why the LED indicator keeps blinking. The receiver output is pulsing on and off.

The running pulse width is not consistent, ranging from 20ms to 30ms. The pulse period of 80ms is rather constant when I measure the falling edge.

Signal 1 (Transmitter, TTL input logic 1), Signal 2 (Receiver, TTL output signal pull down to 0.8V)

Now the transmitter is transmitting logic 1. The output signal is now constantly pull to 0.8V (I will consider it as logic 0). The logic 0 output will drive the LED constantly on, which is what we have observed earlier.

Signal 1 (Transmitter, transition from logic 0 to 1), Signal 2 (Receiver, output signal response)

This is how the transition looks like when the transmitter transmits from logic 0 to logic 1.

The response is pretty simple and within my expectation.

Signal 1 (Transmitter, transition from logic 1 to 0), Signal 2 (Receiver, output signal response)

This is how the transition looks like when the transmitter transmits from logic 1 to logic 0.

The response is a bit tricky. The receiver took some time to pulse it’s output periodically. There is a consistent delay between the first pulse and the subsequent pulse. First pulse width is able 50ms, followed by a 150ms delay, before the periodic pulses return.

The pulsing period of 80ms (12.5Hz) is going to cause some issue when decoding the transmitting data. It will be very slow differentiating logic 0 and 1 from the transmitter.

 

2012-05-19

The setup is further tested. The transmitter and receiver module is now 2m apart using separate power supply.

The experiment fails. The receiver did not response. Even when both circuit is place very near each other (10cm apart), the receiver fails to response. The pulsing signal is more random than the experiment above.

The antenna was then pulled very near the receiver module, the receiver starts to function properly as before.

I have came to read a relating article online. The symptom is very similar to what I have describe. The issue is due to improper tuning of the receiver. The module should works after proper tuning. I may have to verify this for my next experiment.

 

 

 

 

 

Experience on working with RF and magnetic field technology

During my work in Teleradio Engineering, I am task to research in the area of magnetic field. Eventually some ideas were came up with to test out on radiated electromagnetic field. Electromagnetic field is simply the energy form by magnetic and electric field. The theory details on electromagnetic field is very mathematically intensive as what I had go through during my diploma and degree courses. However the concept is actually quite simple. Mathematics is simply one of our human language which can accurately be used to describe the physical property of electromagnetic. The deriving of the mathematics has gone through a lot of work. Eventually electromagnetic can be accurately predicted by the famous Maxwell Equations.

Wow, you may think, four simple equation and they have describe almost over 90% of electrical and magnetic phenomenon. These four equation are headache to study.

Electromagnetic theory is a form of geometry mathematics. If you can understand the concept of volume, area and vector in school, you have the potential to master this subject. It is not as difficult as it seem to be. You will have to apply some imagination and interpret the electromagnetic concept because these thing is physically not visible.

A book that have great influence in my understanding in electromagnetic is “Electromagnetism for Engineers (An Introductory Course) 3rd Edition by by P.Hammond (University of Southampton, Southampton UK)“. This book is fully recommended for beginners like me, as it has minimum mathematics which is very easy to read and understand. Most importantly, the book is thin and have sufficient pictures illustration.

Electromagnetic theory is a very useful in practice. The learning experience is applicable to a lot of engineering problem. I had manage to apply the knowledge to resolve lightings issue during my research work in Teleradio Engineering. It all started when I was confronted with my first commercial system (UV3, Under Vehicle Surveillance System) that I build for the company. A new chassis design were already in place before I join the company. After a test run, it is found to have lighting problem. The lighting positioning is wrong, resulting in dark images captured. We have to resolve this immediately because the delivery date to our oversea buyer is near. I am confronted by a problem which I was not trained to resolve in school. Number of simple reflector were made for testing but it does not seems to work well. I decided calm down and rethink the problem all over again. All our office’s fluorescence lighting were switch off. The bulb is being switched on, as I observed the bulb glow, the radiation pattern of the bulb. Within the next few moment, electromagnetic concept surface in front of my mind. I had come up with a simple custom reflector design base solely on the radiation pattern and managed to resolve the lighting issue for delivery. Although the concept of reflector is quite simple, it took me over a year to be able to understand and explain the lighting’s intensity distribution from all the various reflectors I have designed. I have spent much of my time in Teleradio doing reflector design and lightings research for camera vision.

The illustration of the light radiation from a bulb is very much similar in a way to electromagnetic theory.

 

 

 

www.pic-control.com, Singapore Research & Development R&D

Singapore Customized, custom made Electronics Circuits & Kits

 

 

email:    contact->email_siongboon  

website: http://www.siongboon.com


 

 

 

 

 

RF reference:

 

RF IC chip manufacturer

http://www.nvlsi.no/

 

Encoder/decoder controller

MC145026 (encoder), or SC41343

MC145027 (decoder), or SC41344

MC145028 (decoder)

HT-12E (encoder)

HT-12D (decoder)

HT-12A, HT-640, HT-648L, DPC-64, DPC-2400

Kingtronic

http://www.kingtronic.com/

 

Hobby Website

http://www.glolab.com/encdec/mothol/mothol.html

http://jap.hu/electronic/codec.html

http://www.telecontrolli.com/eng/default-wproducts.htmlhttp://www.rfsolutions.co.uk/acatalog/Hybrid_Transmitter_Receiver_Modules.html

 

Shops

http://www.rfsolutions.co.uk/acatalog/Radio_Transceiver_Modules.html

 

 

RF transceiver (Transmitter & Receiver)

RXLC-434, TXLC-434, TR-900-SC-PA, TR-xxx-SC-P,

TWS-434A $6.60 each, RWS-434, TX-99 $9.00 each, RX-99

RF01TXRX1, RF01TX1, RF01RCX1
http://www.usbdeveloper.com/RFKit/USBDeveloper.RFKit.html#RF%20Communications%20Receiver%20-%20RF01RCX1

RXQ1, TRXQ1

http://www.telecontrolli.com/eng/default-wproducts.html

http://www.rfsolutions.co.uk/acatalog/Hybrid_Transmitter_Receiver_Modules.html

 

 

Keyword: FM transceiver, nRF401 IC, KRF-DTR401, Transmission RF radio frequency, communication, encoder, decoder, MC145026 MC145027, Electromagnetic, wireless remote control

 

 

 

LM2576 DC-DC Converter

DC-DC converter, switching regulator using
LM2576, LM2575 and more.

Written by Lim Siong Boon, last dated 08-Dec-09.

 

Kit Research History

 

LM7805, TO220 package

 

 

 

 

 

SD-50A-5

  SDM-30

PMA8811SF

UT70A

 

 

 

Various type of voltage regulator design

 

a) Zener diode voltage regulator.

Suitable only for very low power application.

 

For Vcc 24V
– Zener (Vout) = 12V 240mW, Iout(max) = 20mA, Rreg = 600ohm 240mW
– Zener (Vout) = 12V 120mW, Iout(max) = 10mA, Rreg = 1200ohm 120mW
– Zener (Vout) = 5V 100mW, Iout(max) = 20mA, Rreg = 950ohm 380mW

For Vcc 12V
– Zener (Vout) = 5V 100mW, Iout(max) = 20mA, Rreg = 350ohm 140mW
– Zener (Vout) = 3.3V 66mW, Iout(max) = 20mA, Rreg = 435ohm 174mW

Refer to the following website to compute zener, resistor value for a required Vout/Iout.
http://www.reuk.co.uk/Zener-Diode-Voltage-Regulator.htm

 

b) 3 rectifier diodes as voltage regulator.

Suitable only for very low power application.

 

c) Using voltage reference TL431 as a voltage regulator.

This is a very simple and useful adjustable voltage regulator. If the load is <100mA, this is a very attractive solution. For 5V output, R1=R2=10Kohm. TL431 datasheet.

LT431 voltage reference as regulator

 

d) Linear voltage regulator.

Suitable for application that requires low noise.

 

e) Switching voltage regulator.

Suitable for application that requires high power.

 

Circuit diagram taken from,

Power Supply Design for electronic circuit

A dc-dc regulator/converter or another name known as buck regulator or switching regulator, provides stable regulated output voltage to supply electronic circuits. Schematic, PCB layout and component list are available on this page.

LM2576 circuits perform same function as the commonly known voltage regulator LM7805 from National Semiconductor. The 7805 voltage regulator dissipates a lot heat. The higher input voltage, the more heat is generated. The extra input energy is converted to heat, keeping the output voltage regulated at 5V.

LM78XX series is available to regulate 5, 6, 8, 9, 12, 15, 18, 24V. If you want the output voltage adjustable, there is also a adj model. For -negative voltage supply, you can use LM79xx series. These regulator is able to support up to a maximum of 1A current rating.

LM7805 IC requires input voltage to be higher than output in order to regulate the output voltage. Input voltage needs to be at least 7V (up to a maximum of 20V) in order for LM7805 to regulate at an output of 5V. It is advisable to supply a voltage input range from 7.5V to 10V. Any higher input voltage is consider inefficiency, generating a lot of  heat.

A switching mode power supply such as LM2576 dc-dc converter, uses switching control to reduce the input dc voltage on average. This is equivalent to a lower input voltage resulting in minimum heat dissipated. The control results in better regulated output, less energy wasted through heat and the use for high current application. Nowadays dc-dc converter are getting smaller and comes in the TO-220 package too. You can simply change your LM7805 to dc-dc converter without any change in your design.

The first commerical module I tried is the SD-50A-5 from Meanwell rated at 5V 10A. It is very good and easy to use. However it is very big and bulky. If size is a constraint, you might consider the model SDM-30. It is able to handle up to 5V 5A and is a lot smaller than SD-50A-5. However it generates a lot of heat through its metal casing.

The best dc-dc I have tried before is PMA8811SF from Ericsson. It is by far the most compact (smaller than SDM-30) and most efficient dc-dc. Heat is also dissipated through it ceramic package, however it does not scalded your finger as much as SDM-30 do.  The IC package is surface mount however soldering is relatively easy because the IC leads are quite broad. It is rated at output 5Vdc 16A and generate far less heat. Each pieces cost about S$60, a lot more than the other converter model.

Through some research, I get to learn about commercial standard dc-dc IC that perform with only a few external components. The following article discuss on LM2576 IC with rating up to 5V 3A. LM2576 is one of the dc-dc IC product range from National Semiconductor. There are also various brand of dc-dc regulator IC available.

The interfacing of most dc-dc IC requires the use of inductor. This is the case for LM2576 too. Try sourcing your local electronics shop for one if possible. I am not stopping you to make your own inductor. Just that making your own inductor takes up time and it is very likely to cost you more than what a shop might be selling.

If you are interested in making your own coil, you might interested in this website, http://www.skylab.org/~chugga/mpegbox/coil/. The aurthor Jeff Mucha had demonstrated a simple and creative way to make inductive. One Long screw, 2 board flat washer, 2 nut, 1 ring spacer, glue, and XXX is all the tools that is require to make your own air core inductor. It is really interesting.

More article: home brew your own inductors

Jens Moller has contributed a program which generate a table of information for building air core inductor. Simply input the inductance value you need, the program will display a table containing the wire coil height radius and number of turns required. You need not have to understand formula to make your own inductor. Take a look at the following website, http://www.colomar.com/Shavano/inductor_info.html

A greenhorn when I first attempt to use inductor. It is a tough job building circuits using inductor. I do not have proper equipment to measure the inductor on hand. Never able to find out the inductance value I have. Fortunately, there is this inductance measurement product selling at an affordable price. UT70A from Uni-Trend Technology. It also function as a multi-meter, and can be used to measure voltage, current, etc… . Even with an inductance meter, it is not a easy task to measure inductance accurately.

 

 

 

 

 

Other reference:

The practical basic of building a power supply.

The Power Supply.pdf

http://www.talkingelectronics.com/

projects/ThePowerSupply/Page79PowerSupplyP1.html

 

 

www.pic-control.com, Singapore Research & Development R&D

Singapore Customized, custom made Electronics Circuits & Kits

 

2009-09-13 dc-dc step up, LED driver using 1.5V alkaline battery

The simplest DC-DC step up converter I have done. Typical LED requires about 2V to operate. This ciruict is able to drive the LED from a 1.5V battery. The transistor forms the oscillating circuit generating pulsing output. Although the output is pulsing, we can’t actually see it on the LED, as the switching is quite fast.

Click the picture to enlarge.

 

The voltage output is about 3Vpeak oscillating at about 33kHz.

 

 

 

 

 

 

Schematic

 

   

 

 

Singapore Electronic Kits, PIC-CONTROL

Singapore Customized, custom made Electronics Circuits & Kits

 

 

LM2576 dc-dc Circuits

 

Photos of DC-DC circuit built

 

 

This is the 1st successful DC-DC circuit I built.

There a variety of capacitors out there in the market. Capacitance, voltage rating, dielectric material, etc… . Choose a suitable voltage rating across the capacitor. The circuits deals with high current, therefore it will be better to choose a low ESR (equivalent series resistance) Aluminum electrolytic capacitor. As a general guide, a higher voltage rating has lower ESR rating.

The inductor coil use should be able to handle the current passing through the inductor coil. If the wire is too thin, the coil may be burn or just fail. My previous circuit uses small wattage inductor (package like a big resistor). The circuit couldn’t work and was later found to be IC problem. I have not yet do a test to check on the possibility of the inductor contributing to the failure.

Using a inductor meter to measure the inductance will be easier. Inductance value can be observe immediately for any modification to the coil of wire. The inductance value can also be calculated, depend on the coil size, number of turns, wire size used, dielectric of the core etc… .

The 1N5822 is a high current, high speed, schottky diode and is suitable for this digital switching circuit. Schottky diode (Schottky Barrier Rectifier), means that the forward voltage drop is low. For this application, a low forward voltage diode is necessary.

 

 

   
 

 

Schematics

   

PCB Bottom Layer (PCB trace)

Component Layout (Silkscreen)

   

Bill of Material (BOM) for LM2576 circuit

Part# Description Value Qty
C1 Electrolytic Capacitor (Axial) 100uF 75V x1
C2 Aluminum Electrolytic Capacitors (Axial) 1000uF 16V x1
D1 Schottky Diode (high current) 1N5822 x1
L1 Inductor 100uH x1
U1 7-40V to 5V DC-DC 3.0A LM2576T5 x1
R1 Resistor 1K x1
DS1 Typical INFRARED GaAs LED   x1
JP1 Header, 2-Pin   x1
JP2 Header, 2-Pin   x1
PCB PCB board 60x50mm 1 oz x1

 

 

LM2576 circuits that failed  
 

Failure, my first prototype circuit to test out the performance of LM2575, LM2576.

 

 

 

Some of the various sizes of inductor tested and seems to be working with LM2576.

 

Initially I thought that I had use the wrong type of inductor, resulting in the circuit malfunction. Initially I had used a smaller type of inductor (looks like a resistor). Realizing that this circuit drive high current load, I should use a thicker inductor coil. That’s why I modified the circuit with an inductor (enamelled wire, wound around the ferrite core).

Still it doesn’t work. I guess that both IC LM2575, LM2576 must have been damage by my previous attempt. The capacitor used is suspected because the datasheet call for low ESR capacitor. It is very difficult to find these in the local shops, therefore I use a normal capacitor instead.

One day, I visited a shop selling ready made inductors and brought LM2576 at the same time. The circuit was rebuild and it finally works. My deduction at that time was either the inductor or the capacitor is giving me the problem. After further testing, I find out that ordinary capacitor works as well. There is hardly any difference in performance. Various type of inductor were tested (except the resistor like type). All inductor works too, big or small. Quite weird actually, and I couldn’t figure it out the actual problem I had in my previous attempt.

The mystery is resolve finally. One fine day I went back to the shop where I first purchase my LM2576 and brought 2 additional LM2576 for more testing. A new circuit was build and the familiar failure was observed. The output voltage of 5V cannot be sustain and eventually drop when more than 1A of current is draw by the load. The lab power supply display a current loading limit warning. IC becomes very hot. The datasheet specify that LM2576 should be able to supply 3A without any  problem. Both brand new IC are tested to have the same problem.

This is weird, as the same inductor and capacitor previously tested do not result in this same old problem. However the circuit shows the same failure symptom. The next thing that comes to mind, is the IC. The IC LM2576 from the previous working circuit is then transfer over the new circuit board for testing. Everything works fine. It is then clear that the problem comes from the IC itself.

Checking up on the previous IC, I notice that they are from the same manufacturing batch number and believe that they are already damage in some way.

 

Sample of the 5Ω 50W aluminum house resistor used for testing 1A current performance.

Using various type of inductor and capacitor. The circuit is tested to draw 1A using a 5Ω 50W resistor as the load. Current drawn can be observe on my lab power supply current meter. It should shows 1A being drawn, since the LM2576 supply a constant 5V to the 5Ω load.

 

General tester for LM series dc-dc IC chip.

A multi purpose board is created to allow me to test various LM series IC chip. e.g. LM2575, LM2576, LM2596, LM2678, LM2679. Various combination of inductor, capacitor and diode can also be tested under this board.

 

More LM2576 Circuits built  

 

 

 

Some of the newly fabricated board built to support other prototype projects. It has been tested to support a RF transceiver operating at 5V without any issue observed.

 

 

 

 

   

 

This is the same dc-dc circuit shown above. The circuit is fabricated from photo-resist PCB board. For more information on making your own PCB board, you may like to visit, website “..\2005-09-07_home_pcb_fabrication“.

Home fabricated circuit board

 

Working on LM2575

 

 

It has been some time since I learn to use LM2576. The circuitry is able to handle a higher current at 3A 5V output. This translate to a higher cost and circuit size, since all component must be able to handle that high power capacity. These component include the LM2576, inductor and the diode. Since most electronics kit requires less than 1A power supply, it is wise learning how to apply a low power dc-dc regulator like LM2575. Cost can be reduce by 50%.

There is one day that I happen to come across this IC LM2575 while searching high and low for LM2576. LM2576 is actually quite difficult to find. There is only 2 shop I know of, but I have rule out one shop because they are selling a faulty batch of LM2576 IC. LM2575 seems very common from shops around and I decided to find out more about this chip. Indeed it is what I have been looking for, a low power regulator. So I purchase the IC and its component to try it out. When I started writing this acticle, only did I realize that I have actually tried it about 6 months ago. The experiment was forgotten after a series of failure.

But now, it is working once more. The experience in working with LM2576 has provided the confident to built LM2575. It is so fortunate that I managed to get this circuit working once again.

The following experiment is done during the 1st test on LM2575 circuit. The experiment compare between the performance of using different inductor. One using a wire coil inductor, and the other smaller one inductor that looks like a resistor with it’s color bands..

The photos on the left column shows the LM2575 circuit using the correct inductance value at 330uH but the inductor is low power rated. It is small and looks like a color coded resistor.

A few second after the left circuit is powered up, the small inductor turns very hot. The waveform observed at the output of the dc-dc regulator, contains a high amount of noise/ripple energy.

The photo on the right column shows the same circuit using a slightly higher inductance at 480uH but the coil is thicker and bigger in size.

The circuit using a high power rating inductor on the right shows a cleaner DC supply, although the inductance value is different from the design. There is still ripple at it’s output but I guess it will be minimum using an inductance value of 330uH with higher power rating. Too bad, I do not have the right inductor to experiment further. It is either coil one myself or buy one from shop.

12 June 2006, Lim Siong Boon

 

I have found this article regarding about the property of inductor Isat (current saturation) and Irms (continuous current). They are usually one of the important specification to take note while selecting inductor from datasheet.

Current saturation means the amount of current required that flow through the inductor, in order to reduce the inductance of the component.

Continuous current means the amount of current required to heat up the inductor to a certain temperature. If the amount current continue to flow through the inductor, the inductor is basically becoming a heater. The temperature depends on the amount of current flowing through it.

The following contains information that I learn from.

Isat_Irms explain.pdf

02 Dec 2008, Lim Siong Boon

 

 

LM2575 Schematic taken from National Semiconductor LM2575 datasheet

 

Bill of Material (BOM) for LM2575 circuit

Part# Description Value Qty
C1 Electrolytic Capacitor (Axial) 100uF 75V x1
C2 Aluminum Electrolytic Capacitors (Axial) 330uF 16V x1
D1 Schottky Diode (low current) 1N5819 x1
L1 Inductor 330uH x1
U1 7-40V to 5V DC-DC 1.0A LM2575T5 x1
R1 Resistor 1K x1
DS1 Typical INFRARED GaAs LED   x1
JP1 Header, 2-Pin   x1
JP2 Header, 2-Pin   x1
PCB PCB board 60x50mm 1 oz x1

 

click here to
Buy DC-DC Converter
Available Now at the PIC-store

 

 

 

 

 

Dealing with power supply noise

I happen to see this very good website, teaching about handling noise. There are many illustration which are easy to understand.

http://www.williamson-labs.com/480_byp.htm

 

04 Oct 2011, Lim Siong Boon

   

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

Singapore Customized, custom made Electronics Circuits & Kits

 

 

Quick Design Guide to

Switching Power IC

 

LM2575, LM2576, LM2596, LM2678

 

The following table provides a quick reference for power supply circuit. The circuit schematic and component list are selected from the manufacturer’s datasheet.

For exact component value design, you need to the datasheet. The following component value is design for typical input voltage of 12Vdc or 24Vdc drawing power at 75% of the current rating.

 

   

LM2575 (1A)

DC to DC step down voltage regulator.

Wide input voltage 8Vdc to 40Vdc.

 

 

Part number:

– LM2575-3.3 (3.3Vdc output)

– LM2575-5.0 (5Vdc output)

– LM2575-12 (12Vdc output)

– LM2575-15 (15Vdc output)

– LM2575-ADJ (1.23Vdc to 37Vdc output)



Alternative:

NJM2367

 

 

Package: TO-220(T)

 

 

click here to
Buy DC-DC Converter Available Now at the PIC-store

 

 

 

LM2575 datasheet

Click for LM2575-adj circuit

Component list

Symbol

Component  

C1

100uF (50V aluminium electrolytic)  

C2

330uF (16V aluminium electrolytic, low ESR)  
D1 1N5819 (schottky diode 1A)  
L1

330uH, 1A  <for LM2575-3.3, LM2575-5.0>

680uH, 1A  <for LM2575-12, LM2575-15>

 
R1, R2 “for LM2575-adj IC” 5kΩ multi-turn variable resistor, set to ratio to R1=1.25kΩ, R2=3.75kΩ for voltage output of 5Vdc before soldering.  

 

For 3.3V output

 

Commercial Resistor value

Actual Output

R1

R2

 

R1

R2

Vout

1.00kΩ

1.68kΩ

 

1.0kΩ

 

 

3.30kΩ

5.55kΩ

 

3.3kΩ

(3.24kΩ)

5.6kΩ

(5.49kΩ)

3.32V

4.70kΩ

7.91kΩ

 

4.7kΩ

 

 

1.96kΩ

3.30kΩ

 

 

3.3kΩ

 

2.79kΩ

4.70kΩ

 

 

4.7kΩ

 

3.33kΩ

5.60kΩ

 

3.3kΩ

(3.24kΩ)

5.6kΩ

(5.49kΩ)

3.32V

 

 

For 5.0V output

 

Commercial Resistor value

Actual Output

R1

R2

 

R1

R2

Vout

1.00kΩ

3.07kΩ

 

1.0kΩ

 

 

3.30kΩ

10.10kΩ

 

3.3kΩ

(3.24kΩ)

10.0kΩ

(10.00kΩ)

4.96V

4.70kΩ

14.40kΩ

 

4.7kΩ

 

 

1.08kΩ

3.30kΩ

 

 

3.3kΩ

 

1.53kΩ

4.70kΩ

 

 

4.7kΩ

 

1.83kΩ

5.60kΩ

 

 

5.6kΩ

 

3.26kΩ

10.00kΩ

 

3.3kΩ

(3.24kΩ)

10.0kΩ

(10.00kΩ)

4.96V

 

 

please refer to the table for resistors in parallel for more resistance design options.

 

 

Other voltage output base on commercial available resistors

 

Commercial Resistor value

Actual Output

   

 

R1

R2

Vout

   

 

1.0kΩ

4.7kΩ

7.011V

   

 

1.18kΩ

18kΩ

19.9927V

   

 

   

 

   

 

   

 

   

 

   

 

   

 

     
   

 

     

 

 

    Vout, R1 & R2 design selection calculator

    Vout=, R1=, R2=          where R1 between 1kΩ to 5kΩ.

    Design calculator might not work on some web browser.

 

   

LM2825 (1A)

DC to DC step down voltage regulator.

Wide input voltage up to 40Vdc.

 

 

Part number:

– LM2825-3.3 (3.3Vdc output)

– LM2825-5.0 (5Vdc output)

– LM2825-12 (12Vdc output)

– LM2825-ADJ (1.23Vdc to 37Vdc output)

 

 

Package: MDIP24

LM2825 datasheet

 

no external component required

   

LM2576 (3A)

DC to DC step down voltage regulator.

Wide input voltage 8Vdc to 40Vdc.

 

 

Part number:

– LM2576-3.3 (3.3Vdc output)

– LM2576-5.0 (5Vdc output)

– LM2576-12 (12Vdc output)

– LM2576-15 (15Vdc output)

– LM2576-ADJ (1.23Vdc to 37Vdc output)



Alternative:

NJM2367

 

 

Package: TO-220(T)

 

tested working on 2007-06-26

tested working on 2007-06-26

LM2576 datasheet

Click for LM2576-5.0 layout

 

Click for LM2576-adj circuit

Click for LM2576-adj layout

Reference:

AN-946, lm2576 as a charger

 

Component list

Symbol

Component  

C1

100uF (50V aluminium electrolytic)  

C2

1000uF (16V aluminium electrolytic, low ESR)  
D1 1N5822 (schottky diode 3A)  
L1

100uH, 3A  <for LM2576-3.3, LM2576-5.0>

220uH, 3A  <for LM2576-12, LM2576-15>

 
R1, R2 “for LM2576-adj IC” 5kΩ multi-turn variable resistor, set to ratio to R1=1.25kΩ, R2=3.75kΩ for voltage output of 5Vdc before soldering.  

 

Resistor value for Adj (adjustable version). Voltage reference is 1.23V

For 3.3V output

 

Commercial Resistor value

Actual Output

R1

R2

 

R1

R2

Vout

1.00kΩ

1.68kΩ

 

1.0kΩ

 

 

3.30kΩ

5.55kΩ

 

3.3kΩ

(3.24kΩ)

5.6kΩ

(5.49kΩ)

3.32V

4.70kΩ

7.91kΩ

 

4.7kΩ

 

 

1.96kΩ

3.30kΩ

 

 

3.3kΩ

 

2.79kΩ

4.70kΩ

 

 

4.7kΩ

 

3.33kΩ

5.60kΩ

 

3.3kΩ

(3.24kΩ)

5.6kΩ

(5.49kΩ)

3.32V

1.1kΩ 1.851kΩ   1.1kΩ 1.87kΩ 3.32V
1.2kΩ 2.020kΩ   1.2kΩ 2.05kΩ 3.33V
1.3kΩ 2.187kΩ   1.3kΩ 2.20kΩ 3.31V
1.5kΩ 2.524kΩ   1.5kΩ 2.55kΩ 3.32V

 

 

For 5.0V output

 

Commercial Resistor value

Actual Output

R1

R2

 

R1

R2

Vout

1.00kΩ

3.07kΩ

 

1.0kΩ

 

 

3.30kΩ

10.10kΩ

 

3.3kΩ

(3.24kΩ)

10.0kΩ

(10.00kΩ)

4.96V

4.70kΩ

14.40kΩ

 

4.7kΩ

 

 

1.08kΩ

3.30kΩ

 

 

3.3kΩ

 

1.53kΩ

4.70kΩ

 

 

4.7kΩ

 

1.83kΩ

5.60kΩ

 

 

5.6kΩ

 

3.26kΩ

10.00kΩ

 

3.3kΩ

(3.24kΩ)

10.0kΩ

(10.00kΩ)

4.96V

 

 

    please refer to the table for resistors in parallel for more resistance design options.

    please refer to above for design calculator for resistance value selective

 

   

LM2594 (0.5A)

DC to DC step down voltage regulator.

Wide input voltage 8Vdc to 37Vdc (up to 60V for HV version).

 

 

Part number:

– LM2594-3.3 (3.3Vdc output)

– LM2594-5.0 (5Vdc output)

– LM2594-12 (12Vdc output)

– LM2594-ADJ (1.23Vdc to 37Vdc output) (57V for HV version)

 

 

Package: SOIC8, DIP8

LM2594 datasheet

 

Component list

Symbol

Component  

C1

68uF (50V aluminium electrolytic)  
C2

120uF (16V aluminium electrolytic, low ESR)

 
D1 1N5817 (schottky diode 1A)  
L1

100uH, 0.5A

 
     
     

 

   

LM2596 (3A)

DC to DC step down voltage regulator.

Wide input voltage 8Vdc to 40Vdc.

 

 

Part number:

– LM2596-3.3 (3.3Vdc output)

– LM2596-5.0 (5Vdc output)

– LM2596-12 (12Vdc output)

– LM2596-ADJ (1.23Vdc to 37Vdc output)

 

 

Package: TO-220 (T)

LM2596 datasheet

 

Component list

Symbol

Component  

C1

680uF (50V aluminium electrolytic)  
C2

330uF (100V aluminium electrolytic, low ESR) <for LM2596-3.3, LM2596-5.0>

180uF (100V aluminium electrolytic, low ESR)<for LM2596-12>

 
D1 1N5824 (schottky diode 4A)  
L1

33uH, 3A  <for LM2596-3.3, LM2596-5.0>

68uH, 3A  <for LM2596-12>

 
     
     

 

   

LM2678 (5A)

DC to DC step down voltage regulator.

Wide input voltage 8Vdc to 40Vdc.

 

 

Part number:

– LM2678-3.3 (3.3Vdc output)

– LM2678-5.0 (5Vdc output)

– LM2678-12 (12Vdc output)

– LM2678-ADJ (1.2Vdc to 37Vdc output)

 

 

Package: TO-220

LM2678 datasheet

 

Component list

Symbol

Component  

C1

45uF (50V aluminium electrolytic) + 0.47uF  

C2

10nF (50V ceramic, low ESR)  
C3

360uF (100V aluminium electrolytic, low ESR) <for LM2678-3.3, LM2678-5.0>

220uF (100V aluminium electrolytic, low ESR)<for LM2678-12>

 
D1 6TQ045S (schottky diode 6A)  
L1

15uH, 5A  <for LM2678-3.3, LM2678-5.0>

22uH, 5A  <for LM2678-12>

 
     
     

 



LM2574 (0.5A)

DC to DC step down voltage regulator.

Wide input voltage 4.5Vdc to 42Vdc.

 

 

Part number:

– LM2574-5.0 (5Vdc output)

– LM2574-ADJ (1.2Vdc to Vin output)

 

Alternative:

NJM2369A, NJM2374A

 

Package: Wide-SOIC14

wide_soic14

 lm2574-adj circuit
LM2574 datasheet




Component list

Please see the section for LM2574, LM2576. They are similar.




LM22674 (0.5A)

DC to DC step down voltage regulator.

Wide input voltage 4.5Vdc to 42Vdc.

 

 

Part number:

– LM22674-5.0 (5Vdc output)

– LM22674-ADJ (1.2Vdc to Vin output)

 

 

Package: PSOP8

LM22674 datasheet

 

Component list

Symbol

Component  

C1

22uF (50V aluminium electrolytic) + 1uF (50V ceramic, low ESR)  

C2

10nF (50V ceramic, low ESR)  
C3 22uF (50V aluminium electrolytic) + 1uF (50V ceramic, low ESR)  
D1 1N5819 (schottky diode 1A)  
L1 39uH (>0.5A)  
R1, R2 <For 3.3Vout> R1=976Ω, R2=1.54kΩ (1/8watt)  

for Vout R1 R2 computation reference, refer to LM22676 section
     

 

   

LM22675 (1A)

DC to DC step down voltage regulator.

Wide input voltage 4.5Vdc to 42Vdc.

 

 

Part number:

– LM22675-5.0 (5Vdc output)

– LM22675-ADJ (1.285Vdc to Vin output)

 

 

Package: PSOP8

LM22675 datasheet

 

Component list

Symbol

Component  

C1

22uF (50V aluminium electrolytic) + 1uF (50V ceramic, low ESR)  

C2

10nF (50V ceramic, low ESR)  
C3 120uF (16V aluminium electrolytic) + 1uF (50V ceramic, low ESR)  
D1 1N5822 (schottky diode 2 to 3A)  
L1 22uH (>1A)  
R1, R2 <For 3.3Vout> R1=976Ω, R2=1.54kΩ (1/8watt)  

for Vout R1 R2 computation reference, refer to LM22676 section
     

 

   

LM22676 (3A)

DC to DC step down voltage regulator.

Wide input voltage 4.5Vdc to 42Vdc.

 

 

Part number:

– LM22676-5.0 (5Vdc output)

– LM22676-ADJ (1.285Vdc to Vin output)

 

 

Package: PSOP8

TO-263 thin (7 pin)

LM22676 datasheet

 

Component list

Symbol

Component  

C1

22uF (50V aluminium electrolytic) + 2.2uF (50V ceramic, low ESR)  

C2

10nF (50V ceramic, low ESR)  
C3 120uF (50V aluminium electrolytic) + 2.2uF (50V ceramic, low ESR)  
D1 50WQ03 (schottky diode 5.5A)  
L1 8.2uH (>5.5A)  
R1, R2 <For 3.3Vout> R1=976Ω, R2=1.54kΩ (1/8watt)  
  <For 5.0Vout> R1=1kΩ, R2=2.89kΩ  




The following guide uses typical resistor value.


<For 3.21Vout> R1=1kΩ, R2=1.5kΩ
<For 3.26Vout> R1=1kΩ, R2=1.54kΩ
<For 3.31Vout> R1=976Ω, R2=1.54kΩ
<For 3.34Vout> R1=1kΩ, R2=1.6kΩ
<For 3.39Vout> R1=1.1kΩ, R2=1.8kΩ
<For 3.41Vout> R1=2kΩ, R2=3.3kΩ
<For 3.47Vout> R1=3.3kΩ, R2=5.6kΩ
<For 5.06Vout> R1=1.6kΩ, R2=4.7kΩ
<For 5.14Vout> R1=1kΩ, R2=3kΩ
<For 5.14Vout> R1=1.1kΩ, R2=3.3kΩ
<For 5.16Vout> R1=1.54kΩ, R2=4.64kΩ
<For 5.21Vout> R1=1.54kΩ, R2=4.7kΩ
<For 5.23Vout> R1=976Ω, R2=3kΩ





Formula for LM22676-ADJ version (for Vout < 5V)
R1=(R2/((Vout/VFB)-1))
R2=R1((Vout/VFB)-1)
Vout=VFB((R2/R1)+1),     where VFB=1.285V,
                                         R1+R2 is about 3kΩ & must be <10kΩ

 

   

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller



LM22678 (5A)

DC to DC step down voltage regulator.

Wide input voltage 4.5Vdc to 42Vdc.

 

 

Part number:

– LM22678-5.0 (5Vdc output)

– LM22678-ADJ (1.285Vdc to Vin output)

 

 

Package: TO-263 thin (7 pins)

 

LM22678 datasheet

 

Component list

Symbol

Component  

C1

22uF (50V aluminium electrolytic) + 2.2uF (50V ceramic, low ESR)  

C2

10nF (50V ceramic, low ESR)  
C3 180uF (16V aluminium electrolytic) + 2.2uF (50V ceramic, low ESR)  
D1 50WQ03 (schottky diode 5.5A)  
L1 4.7uH (8.5A)  
R1, R2 <For 3.3Vout> R1=976Ω, R2=1.54kΩ (1/8watt)  

for Vout R1 R2 computation reference, refer to LM22676 section

     

 

   

MC34063 (1.5A)

DC to DC step down/up.invert voltage regulator.

Wide input voltage 3.0Vdc to 40Vdc.

 

 

Part number:

– MC34063A, MC33063A

– SC34063A, SC33063A

– NCV33063A

 

 

Package: SOIC-8, PDIP-8, DFN8 (8 pins)

 

mc34063 pinout

mc34063 package

 

 

mc34063 pic

mc34063 pic

Load regulation performance measured seems poor. Ideally, this is a 5V 0.5A voltage regulator.

1) Vin=10V, Vout=4.92Vdc, Load=opened circuit (0A)

R2=10kΩ, R1=3.3kΩ, Rsc=0.33Ω 0.5W, L=330uH

2) Vin=10V, Vout=4.10Vdc, Load=15Ω (0.27A)

3) Vin=10V, Vout=3.00Vdc, Load=10Ω (0.3A)

 

Seems that the circuit can only handle 0.1-0.2A load. The voltage regulation is quite poor. According to the document, it is ok for the inductance to be higher. Could it be that my R1 & R2 value being too high? I need to check it up.

 

 

Circuit 1: Step down dc-dc 25Vin -> 5Vout (0.5A) mc34063 circuit1

Current rating can be boost by using external transistor to drive the load.

Adjustable Vout computation (very similar to LM2576, LM2575) with Vref = 1.25V

Vout = 1.25 [1+(R2/R1)]

R2 = R1 [(Vout/1.25)-1)]

<For 3.3Vout> R1=3.3kΩ, R2=5.6kΩ
<For 5.0Vout> R1=3.3kΩ, R2=10kΩ

<For 0.5A Iout> Rsc = 0.3 / (2*Iout) = 0.3 / (2*0.5A) = 0.3Ω (0.075W), please note that Iout < 1.5A using internal driver.

Circuit 2: Step up dc-dc 12Vin -> 28Vout (0.175A) mc34063 circuit2

 

Circuit 3: Step up inverting dc-dc 4.5-6Vin -> -12Vout (0.1A) mc34063 circuit3

mc34063 ic circuit

 

 

MC34063A-D datasheet

MC34063 project example.pdf

MC34063 AN10360, Schottky rectifiers for DCDC converters.pdf

MC34063 AN920-D, Theory and Applications.pdf

MC34063 slva252b, Application Switching Regulator.pdf

 

   

NCP3063 (1.5A)

DC to DC step down/up.invert voltage regulator.

Wide input voltage up to 40Vdc. Almost similar to MC34063 dc-dc ic.

 

 

Part number:

– NCP3063, NCP3063B, NCV3063

 

 

Package: SOIC-8, PDIP-8, DFN8 (8 pins)

 

NCP3063 pinout

.NCP3063 package

NCP3063 is very similar to MC34063. Please refer to MC34063 for some handy information.

NCP3063 circuit

NCP3063 ic circuit

NCP3063 datasheet



LMZ14203 (3A)

DC to DC step down voltage regulator.

Wide input voltage 6Vdc to 42Vdc.
 

 

Part number:

– LMZ14203TZ-ADJ (0.8Vdc to 6Vdc output)



Package: TO-PMOD (7 pins)


lmz14203 package

lmz14203 circuit
LMZ14203 datasheet
   

LMZ14201 (1A)

DC to DC step down voltage regulator.

Wide input voltage 6Vdc to 42Vdc.
 

 

Part number:

– LMZ14201H (5Vdc to 30Vdc output)



Package: TO-PMOD (7 pin)

 

lmz14201H

lmz14201h

 

LMZ14201H datasheet

 

   

LMZ12003 (3A)

DC to DC step down voltage regulator.

Wide input voltage 4.5Vdc to 20Vdc.

 

 

Part number:

– LMZ12003TZ-ADJ (0.8Vdc to 6Vdc output)


Package: TO-PMOD (7 pin)

lmz12003 package
lmz12003 circuit
LMZ12003 datasheet
   

LM3102 (2.5A)

DC to DC step down voltage regulator.

Wide input voltage 4.5Vdc to 42Vdc.

 

 

Part number:

– LM3102MH

 

Package: TSSOP (20 pin)

LM3102 datasheet

   

LM2577 (3A)

DC to DC step up voltage regulator.

Wide input voltage 3.5Vdc to 40Vdc.

 

 

Part number:

– LM2577-12 (12Vdc output)

– LM2577-15 (15Vdc output)

– LM2577-ADJ (1.23Vdc to 37Vdc output)

 

 

Package: TO-220 (T)

 

tested working on 2006

tested working on 2007-06-21

tested working on 2007-06-21

LM2577 datasheet

Click for LM2577-adj circuit

Click for LM2577-adj layout

 

Component list

Symbol

Component  
0.1uF  
0.33uF  

680uF (50V aluminium electrolytic)

 
1N5822 (schottky diode 3A)  

100uH, 3A

 
2.2kΩ 1/4W resistor  
“for LM2577-adj IC” 20kΩ multi-turn variable resistor, set to ratio to R2=2kΩ, R1=18kΩ for voltage output of 12Vdc before soldering.  

 

   
MAX1708 (2A, 10W)

DC to DC step up voltage regulator.

Low input voltage 0.7-5.0Vdc

to output voltage 2.5-5.5Vdc

Suitable for battery powered circuit.

 

 

Part number:

– MAX1708EEE

 

 

Package: QSOP16

Front (tested with current up to 0.05A. Perheps the inductor used is not correct.)

QSOP IC mounted at the back of PCB.

MAX1708 datasheet

Click for MAX1708 circuit

 

 

   
NCP1400a (0.1A)

DC to DC step up voltage regulator.

Low input voltage from 0.8Vdc

to output voltage 1.9-5.5Vdc

Suitable for battery powered circuit.

 

 

Package: SOT23-5

 

Not tested.

2005-NCP1400a datasheet.pdf
   
MCP1640 (0.8A)

DC to DC step up voltage regulator.

Low input voltage from 0.35Vdc

to output voltage 2.0-5.5Vdc

Suitable for battery powered circuit.

 

 

Package: SOT23-6, DFN

 

Not tested.

Output 3.3V from a 1.2V alkaline battery using MCP1640

Output 5.0V from a 3.2V LI-ION battery using MCP1640

 

MCP1640.pdf

   
LM2731 (1.8A) 

DC to DC step up voltage regulator.

Low input voltage from 2.7-14Vdc

to output voltage up to 20Vdc

Suitable for battery powered circuit.

Li-Ion, Li-Po

NOTE!!! (!SHDN pin does not shutdown the output. When shutdown pin is activated, Vout=Vin-0.2V. Vout will be close to Vin instead of pumping up to a higher voltage when shutdown pin is pull to low.)

 

 

 

Package: SOT23-5

 

5V output version

This board uses inductor from BOURNS SDR0403-6R8ML (RMS Current (Irms): 1.41A, Saturation Current (Isat): 2.1A )

12V output version

LM2731.pdf

Note: The size of the inductor plays an important part in determine the load’s max current.(applies to all switching regulators)

 

   
LM3478

DC to DC step up voltage regulator.

Low input voltage from 2.97Vdc

to output voltage up to 40Vdc


 

Package: SOIC-8, VSSOP-8

lm3478 pin out

lm3478%20circuit1.JPG

lm3478%20circuit2.JPG

dc-dc 5V to 12V
LM3478 datasheet
LM3478 5V-12V application notes


lm3478%20circuit%20layout.jpg

Load used (Ohm)Vout with 100uF, 47uFVout with 100uF, 47uF, 47uF, 100nF
1kohm
Input = 5V, ??A
Output = 12.4V, 12mA
lm3478%20TEK0000,%201Kohm%20load.giflm3478%20TEK0004,%201kohm%20with%20more%20capacitors.gif
12ohm
Input = 5V, 2A
Output =  10.7V, 0.9A
lm3478%20TEK0001,%2012ohm%20load.giflm3478%20TEK0002,%2012ohm%20load.giflm3478%20TEK0005,%2012ohm%20with%20more%20capacitors.gif
24ohm
Input = 5V, 1.5A
Output =  12.0V, 0.5A
lm3478%20TEK0003,%2024ohm%20load.giflm3478%20TEK0009,%2024ohm%20with%20more%20capacitors.gif




LT1308 (1A)

DC to DC step up voltage regulator.

Low input voltage from 1Vdc

to output voltage up to 3.3V 0.3A, 5.0Vdc 1A)

Suitable for battery powered circuit.

Li-Ion, Li-Po, NiCd

 

 

 

Package: SOIC-8

 

 

LT1308.pdf

   
LT1301 (0.12A)

DC to DC step up voltage regulator.

Low input voltage from 1.8Vdc

to output voltage 5V or 12Vdc 120mA

Suitable for battery powered circuit.

Li-Ion, Li-Po

 

 

 

Package: SOIC-8

 

LT1301.pdf

   
SN6501  5V (0.35A), 3V (0.15A)
Switching driver for tranformer isolated power supply.

 

 

 

Package: SOT23-5


SN6501 isolated power supply

SN6501.pdf

Transformer 760390015.pdf



Simple DC-DC step up voltage IC

MAX662A 4.5-5.5V to 12V (30mA), no need inductor

MAX734 4.75V – 12V to 12V (120mA)

MAX761 2-16.5V to 12V (150mA)

MAX732 4V – 9.3V to 12V (200mA)

MAX762 2-16.5V to 15V/Adj (150mA)

 

 

 
Ultra Low Drop Regulator MIC5219 (good for Li-Po battery which has a very low voltage)  
 

 

 

www.pic-control.com, Singapore Research & Development R&D

Singapore Customized, custom made Electronics Circuits & Kits

 

 

Diode selection references  

Schottky diode (1A)

1N5817, 1N5818, 1N5819, MBR120P, MBR130P, MBR140P, MBR150, MBR160, SR102, SR103, SR104, SR105, SR106, 11DQ03, 11DQ04, 11DQ05, 11DQ06

(smd alternative to 1N5819) MBRS140T3G, SS12, SS13, SS14, SK12, SK13, SK14

Schottky diode (3A)

1N5820, 1N5821, 1N5822, MBR320, MBR330, MBR340, MBR350, MBR360, SR302, SR303, SR304, SR305, SR306, 31DQ03, 31DQ04, 31DQ05, 31DQ06

(smd alternative to 1N5820, 1N5821, 1N5822) MBRS320T3, MBRS330T3, MBRS340T3, SS32, SS33, SS34, SK32, SK33, SK34

Schottky diode (4A-6A)

1N5823, 1N5824, 1N5825, 50WQ03, 50WQ04, 50WQ05, 50WR06, 50SQ060, MBR340

 

Diode references from Diotec     

diotec diode cross reference list.pdf

diotec diode case reference.pdf

diotec diode smd selection.pdf

diotec transistors-diodes zener selection.pdf

diotec diode bridges selection.pdf

diotec smdbridges.pdf

diotec diode axial.pdf

diotec hv-diac.pdf

diotec arrays-special.pdf

 

Resistor selection references

 

 

 

 

 

 

Resistor Colour Codes

 

Images taken Farnell.

 



for EIA codes for SMD resistors,

please check out this link.

EIA marking code

 

 

 

 

 

 

Introducing the types of resistors

W series- Vitreous enamelled wirewound resistors offering high power, high stability and reliability. Suit for use in harsh environment.

WH series- Aluminium clad resistors for applications where high power dissipation in a small space is required.

MFR series- High stability metal film resistors offering higher performance than carbon film with very low noise levels and high reliablility.

RC series- Very high stability metal film resistors offering very high reliability and tight tolerances.

WCR series- Surface mount resistors suitable for automatic placement. Features include nickel barriers, wide ohmic range and high reliability.

The DC-DC converter design for the adjustable IC version, you may need the following resistor standard EIA decade resistor values for references. Long time ago, when technology is not so advance, resistor manufacturing is not unable to produce precise resistor value, as in today. Due to its large variation in tolerance, the resolution of the range of standard resistor value is limited. Example is E3 series having tolerance of 50%, which have only resistors in decade of 100, 220, 470. There is not much point to define or differential between 100Ω and 101Ω, having a tolerance of 50%. With such high tolerance, there is hardly any difference between 100Ω and 101Ω. They should both belongs to the same class of 100Ω

The standard EIA decade resistor value is group into different series. Each is grouped according to their tolerance level. The higher the tolerance, the higher the resistor value resolution will be. The common resistor value range would be the E24 (tolerance 5%) and E96 (tolerance 1%) series.

To find the range of resistor value that is available in the industrial, multiply the normalise standard found in the table in terms of 100, 1000

– Example: E24 series referring to normalise value 1.0

   It means that under E24 series, you should be able to find these Ω range 100Ω, 1000Ω, 1kΩ, 10kΩ, 100kΩ, 1MΩ, 10MΩ, 100MΩ. Other resistor value under E24 can be determine from the rest of the normalised value in the table below. Lower Ω are not available in the series as they should be in resistor package for higher wattage

 

Standard EIA Decade Resistor Values

E24 (preferred standard resistor values with 5% tolerance)

1.0 1.1 1.2 1.3 1.5 1.6 1.8 2.0 2.2 2.4 2.7 3.0
3.3 3.6 3.9 4.3 4.7 5.1 5.6 6.2 6.8 7.5 8.2 9.1

E96 (preferred standard resistor values with 1% tolerance)

1.00 1.02 1.05 1.07 1.10 1.13 1.15 1.18 1.21 1.24 1.27 1.30
1.33 1.37 1.40 1.43 1.47 1.50 1.54 1.58 1.62 1.65 1.69 1.74
1.78 1.82 1.87 1.91 1.96 2.00 2.05 2.10 2.15 2.21 2.26 2.32
2.37 2.43 2.49 2.55 2.61 2.67 2.74 2.80 2.87 2.94 3.01 3.09
3.16 3.24 3.32 3.40 3.48 3.57 3.65 3.74 3.83 3.92 4.02 4.12
4.22 4.32 4.42 4.53 4.64 4.75 4.87 4.99 5.11 5.23 5.36 5.49
5.62 5.76 5.90 6.04 6.19 6.34 6.49 6.65 6.81 6.98 7.15 7.32
7.50 7.68 7.87 8.06 8.25 8.45 8.66 8.87 9.09 9.31 9.53 9.76

Tolerance Codes

B=0.1%, C=0.25%, D=0.5%, F=1%, G=2%, J=5%, K=10%, M=20%

website references:

http://sound.westhost.com/miscc.htm

http://www.logwell.com/tech/components/resistor_values.html

Most common resistance stock available:
0, 1, 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 75, 82, 100, 120, 150, 180, 200 ,220 ,270, 330, 390, 470, 560, 680, 750, 820, 1k, 1.1k, 1.2k, 1.3k, 1.5k, 1.8k, 2k, 2.2k, 2.7k, 3.3k, 3.9k, 4.7k, 5.6k, 6.8k, 7.5k, 8.2k, 10k, 11k, 12k, 13k, 15k

Second common resistance stock available:
0.1, 0.15, 0.22, 0.33, 0.47, 0.68, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2, 11, 20, 49.9, 51, 62, 110, 124, 160, 240, 249, 300, 360, 392, 430, 475, 499, 510, 620, 681, 910, 1.02k, 1.24k, 1.33k, 1.62k, 1.82k, 2.21k, 2.4k, 2.49k, 2.74k, 3k, 3.01k, 3.24k, 3.32k, 3.6k, 3.92k, 4.02k, 4.22k, 4.3k, 4.75k, 4.87k, 4.99k, 5.1k, 5.11k, 5.62k, 5.76k, 5.9k, 6.04k, 6.19k, 6.2k, 6.34k, 6.49k, 6.65k, 6.81k, 7.32k, 8.06k, 8.25k, 9.1k, 9.53k, 10.2k

 

Commercial Stock Availiability Statistics from element14 24 Oct 2013, for resistor value >40 types availability.

10Ω 12Ω 15Ω 18Ω 22Ω 27Ω 33Ω 39Ω 47Ω 56Ω 68Ω
46 81 50 66 44 62 49 59 51 62 51 60
                       
75Ω 82Ω 100Ω 120Ω 150Ω 180Ω 200Ω 220Ω 270Ω 330Ω 390Ω 470Ω
41 54 100 61 79 59 48 67 60 70 53 78
                       
560Ω 680Ω 750Ω 820Ω 1KΩ 1K1Ω 1K2Ω 1K3Ω 1K5Ω 1K8Ω 2KΩ 2K2Ω
56 62 48 64 132 48 67 43 89 64 69 80
                       
2K4 2K7 3K 3K3 3K9 4K7 5K1 5K6 6K2 6K8 7K5 8K2Ω
45 64 39 76 63 87 41 67 39 80 51 63
                       
10KΩ 11KΩ 12KΩ 13KΩ 15KΩ 18KΩ 20KΩ 22KΩ 24KΩ 27KΩ 33KΩ 39KΩ
132 52 70 45 88 63 63 75 40 61 73 62
                       
47KΩ 51KΩ 56KΩ 62KΩ 68KΩ 75KΩ 82KΩ 100KΩ 110KΩ 120KΩ 130KΩ 150KΩ
79 39 61 39 63 48 57 122 41 47 44 68
                       
180KΩ 200KΩ 220KΩ 270KΩ 330KΩ 390KΩ 470KΩ 560KΩ 680KΩ 820KΩ 1MΩ  
46 49 57 46 58 46 55 46 51 44 70  


Table for resistor in parallel

This resistor table is interesting. While dealing with circuits prototype, I often need to use resistor value that may not be common. To keep sufficient stock for all resistor range is a bit too much to manage. A larger and better storage system will be needed. I find it difficult to manage the wide range of resistor. This brings me the idea of forming the required resistance from two commonly stocked resistor connecting in parallel. This means that I can keep fewer resistance range and easily stock larger quantity for each value.

On the following table, the 1st row and column represents the common resistor value that I normally keep stock. The rest of the cells present the various possible resistance I can obtain by having the resistance in parallel from the respective row and column. The computation is done in the microsoft excel sheet. formula: “=($A2*B$1)/($A2+B$1)”. Those value highlighted in yellow are quite useful when designing my adjustable DC-DC circuit when I do not have the stock for the resistor that is not commonly in use.

0Ω 10Ω 47Ω 100Ω 120Ω 330Ω 470Ω 560Ω 1kΩ 3k3Ω 4k7Ω 5k6Ω 10kΩ 100kΩ 1MΩ
10Ω 5                          
47Ω 8 24                        
100Ω 9 32 50                      
120Ω 9 34 55 60                    
330Ω 10 41 77 88 165                  
470Ω 10 43 83 96 194 235                
560Ω 10 43 85 99 208 256 280              
1kΩ 10 45 91 107 248 320 359 500            
3k3Ω 10 46 97 116 300 411 479 767 1k65          
4k7Ω 10 47 98 117 308 427 500 825 1k94 2k35        
5k6Ω 10 47 98 117 312 434 509 848 2k08 2k56 2k80      
10kΩ 10 47 99 119 319 449 530 909 2k48 3k20 3k59 5k00    
100kΩ 10 47 100 120 329 468 557 990 3k19 4k49 5k30 9k09 50k0  
1MΩ 10 47 100 120 330 470 560 1k00 3k29 4k68 5k57 9k90 90k9 500k

 

Common Size of Resistor (depending in its wattage)
(This is only a guideline. Always check with the datasheet for the correct wattage.)
(Resistor guide reference website)
Wattage
SMD (length)
Axial resistor size (length)
1/16W
0603 (1.55mm)

1/8W
0805 (2mm)
1.8 x 3mm, lead 0.45
1/4W
1206 (3.2mm)
2.5 x 6.5mm, lead 0.6
1/2W
1210 (3.2mm)
3.2 x 8.5mm, lead 0.6
1W
2512 (6.35mm) 5 x 11mm, lead 0.6
2W
2512 (6.35mm)
3W
2512 (6.35mm)




Capacitor selection references
Typical aluminum electrolytic capacitor size
Capacitor Vishay datasheet
Capacitor selection (Panasonic)
Capacitor selection( Rubycon)
Type of capacitors, advantages and disadvantages explain.

Standard Capacitor Size

Panasonic/Vishay
(Rubycon) -> capcitor dia to lead pitch relationship (dia, lead dia, pitch) (5, 0.5, 2), (6.3, 0.5, 2.5), (8, 0.6, 3.5), (10, 0.6, 5.0), (12.5, 0.6, 5.0), (16, 0.8, 7.5), (18, 0.8, 7.5) -< confirm standard same as Panasonic/Vishay as well.

Cr
6.3V
10V
16V
25V
35V
50V
63V
100V
0.1uF





5×11 5×11
0.22uF





5×11 5×11
0.33uF




5×11 5×11
0.47uF




5×11 5×11 5×11
1uF





5×11 5×11 5×11
2.2uF




5×11 5×11 5×11
3.3uF




5×11 5×11 5×11
4.7uF





5×11 5×11 5×11
10uF

5×11


5×11 5×11 6.3×11
22uF

5×11

5×11 5×11
(6.3×11)
6.3×11
(8×11.5)
33uF

5×11 5×11
5×11 5×11
(6.3×11)
6.3×11 8×11.5
(10×12.5)
47uF

5×11 5×11 5×11
(6.3×11)
6.3×11 6.3×11
(8×11.5)
10×12
(10×16)
100uF
5×11 5×11
(6.3×11)
6.3×11 6.3×11
(8×11.5)
8×11.5 10×12
(10×12.5)
10×20
(12.5×20)
220uF 5×11 5×11 6.3×11
(8×11.5)
8×11.5 8×11.5
(10×12.5)
10×12.5
(10×16)
10×16
(10×20)
13×25
(16×25)
330uF 6.3×11 6.3×11 8×11.5
8×11.5
(10×12.5)
10×12.5
(10×16)
10×16
(10×20)
10×20
(12.5×20)
13×25
(16×25)
470uF 6.3×11 6.3×11 8×11.5
(10×12.5)
10×12.5
(10×16)
10×16
(10×20)
10×20
(12.5×20)
13×20
(12.5×25)
16×25
1000uF 8×11.5
10×12
(10×12.5)
10×16
(10×20)
10×20
(12.5×20)
13×20
(12.5×25)
13×25
(16×25)
16×25
(16×31.5)
18×35.5
2200uF 10×16
(12.5×20)
10×20
(12.5×20)
13×20
(12.5×25)
13×25
(16×25)
16×25
(16×31.5)
16×31.5
(18×35.5)
18×35.5

3300uF 10×20
(12.5×20)
13×20
(12.5×25)
13×25
(16×25)
16×25
(16×31.5)
16×31.5
(18×35.5)
18×35.5


4700uF 13×20
(16×25)
13×25
(16×25)
16×25
(16×31.5)
16×31.5
(18×35.5)
18×35.5



6800uF 13×25
(16×25)
16×25
(16×31.5)
16×31.5
(18×35.5)
18×35.5




10000uF 16×25
(16×31.5)
16×35.5
(18×35.5)
18×35.5





22000uF 18×40
(18×35.5)







size dia x L in mm

hover to get the case code pin size, pitch



Standard size:

Case Size
Case code
5×11 11
6.3×11 12
8×11.5 13
10×12 14
10×16 15
10×20 16
13×20 17
13×25 18
16×25 19
16×31 20
16×35 21
18×35 22
18×40 23








   

 

 

 

www.pic-control.com, Singapore Circuit Design & PCB fabrication

Singapore Customized, custom made Electronics Circuits & Kits

 

 

Other Step up DC-DC conversion
 

Ultra-Miniature High Voltage Power Supplies

Q Series

Q01-5 (5Vdc to 100Vdc)

 

 

 

 

Keyword: Buck Regulator, voltage regulator, switching mode power supply, High efficiency, voltage supply, dc-dc converter, LM2576 LM2575 IC, regulated 5Vdc output, Shottky diode, 100uH, 330uH inductor, Low cost, 1A 3A.

 

Inductor

Inductor is the most difficult component to understand, compared to resistor and capacitor.

I would like to try making this component easier to understand.


Edited by Lim Siong Boon, last dated 20-Dec-2012.

Topic Discussion Overview

  1. Inductor Introduction

 



Inductor Introduction

 

 

Typical symbol of the inductance.

 

Inductor is simply a piece of wire coil. A striaght wire do not have inductance. A slight bend in the wire will starts to introduce inductance on the wire. I have been working on electronics for quite some time, but have not understand the practical aspect of inductance on a circuit.

An inductor makes no impact on a DC (direct current) Voltage or Current. Like a capacitor, it affects the AC (alternative current) components. Inductor allows DC or lower frequency components to flow through it while it block AC or higher frequency components. For this reason, inductor is often used in line with a wire carrying power supply, to block any noise on the supply line.

The inductance of a inductor is affected by the following parameters,
– the area size of the coil
– the number of turns to make up the coil
– the diameter size of the wire or the length of the coil

Formula for inductance, L = (r x o x N x N x A) / L

where,
r – normalised permeability (/o)
o – magnetic constant (4π 10−7 H/m)

No. of Turns
Loop , D
Wire , d
Core (r) Inductance Increase in inductance when
1
10mm
1mm
Air (1.0) 15nH reference
2
10mm
1mm
Air (1.0) 59.9nH increase in turns no.
1
20mm
1mm
Air (1.0) 38.3nH increase , D
1
10mm
2mm
Air (1.0) 10.6nH reduce , d
1
10mm
1mm
Ferrite, manganese zinc (640.0) 9.6uH increase material permeability

         

         

Normalised Permeability (r),
of Air is about 1.0
of Ferrite is about 640

Reference:
Coil Inductance Calculator, http://www.eeweb.com/toolbox/coil-inductance
Air Cored Inductor Calculator, http://www.m0ukd.com/Calculators/air_core_inductor_calculator/

 

The reference table above computes the inductance of a wire coil for each change in the parameters. An increase in the number of turns increases the magnetic field through the coil, hence increases in inductance value by quite a lot. An increase in the coil (D) increases the coil circumference, hence more surface area contributing to the field within the coil resulting in an increase of the inductance. Inserting a high permeability material into the coil provides a lower resistance for the magnetic field which helps to increase the inductance.

??????
The increase in the wire (d) while all parameters remains, reduces the resistance, however reduces the inductances. This also means that if the wire is a perfect conductor (0Ω or no resistance), there will be no inductance. Inductance needs resistance to exists. This is something that I need to understand.
??????

 

 

 

 

Inductor impedance formula

XL = 2π x f x L

XL -> Inductance Reactance
π -> 3.14159
f -> frequency
L -> Inductance

 

 

Capacitive reactance Xc = 1 / (2 π f C)
Resonant frequency f0 = 1 / (2 π √(L C))

   
Brands Available



   

   
   

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller




   


 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller





Keyword: Inductor, Inductance

Electronics Tools and Equipment

My Electronic Lab Tools & Equipments

Written by Lim Siong Boon, last dated 06-Jul-08.

 

   

 

Kikusui variable DC power supply PAD 35-10L 0~35V 10A

Tektronix 2445A 150Mhz Oscilloscope

Tektronix 466 100Mhz Oscilloscope

Leader LAG-120B Audio Generator

Electrical Hand Drill

Soldering Iron

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller


 

  My DC Variable Power

The most important equipment that is required for electronics project. If you are looking into buying some equipment for doing electronics stuff, this should be the first one you should invest in. A good power supply can help you detect problem circuit quickly.

Some good must have features in a power supply,

– able to support high current and wattage.

– current and voltage meter.

– current limiting function.

Of course there are more high tech advance features, but these are the 3 most important function that I cannot live without.

With a higher current/voltage or wattage rating, you can power up wider range electronics devices.

Type of Usage Voltage Range (V) Current Range (A)
small scale electronics circuit testing 3 – 15 1 – 2
small to medium size motor, or large scale electronics circuit testing 3 – 24 3 – 6
motor and halogen bulb 12 – 24 6 – 12

 

Before connecting any load to the power supply, it is a good practice to adjust the current limit to a range which you think the load consume. When connecting to any unknown load or load that you suspected may have problem, it is a must to set a current limit, to prevent over drawing of current from the power supply. If there are short circuits in the load, current limiting can prevent huge current from flowing through and therefore reducing the chance of burning the whole circuit down. With proper limit, a short circuit wire could be warm rather than burning with red hot fire. A lot of the problem can be detected by observing the amount of current being drawn.

 

Specification

KIKUSUI ELECTRONICS CORP

Regulated DC Power Supply

 

Model: PAD 35-10L 0~35V 10A

Voltage range:

0Vdc – 35Vdc

Current range:

0A to 10A

 

Function

 

<1> adjustable current limit

To limit the current up to a value. If the current drawn is greater than the value set. The power supply will seize further current supply, such that the current supplied will not exceed the limit. With some voltage adjusted, press current limit button <5>, and turn, <1> to the required current limit.

<2> adjustable voltage

Adjusting the open terminal voltage to the requirement. This also sets the voltage limit of the power supply.

<3> over current indicator (C.C)

LED lights up if current drawn is greater than the limit set.

<4> over voltage indicator (C.V)

LED lights up if voltage at the terminal is greater or equal than the voltage setting. With open terminal (not connecting any load/circuit), the C.V LED should be lighted up. When loaded, the C.V LED should be off.

<5> current/Voltage limit button

Press the button to see the current limit being set.

<6> OVP function (over voltage protection)

Adjust a limit to the voltage, such that if the system’s voltage exceed the setting, the own power supply equipment will be shut down, and OVP LED will be lighted up. A reset (Off/On) will be required to reset the power supply to normal working conditions. This is a safety feature in case the voltage at the terminal is greater than expected unintentionally.

<7> voltage meter zeroing

see voltage calibration

<8> current meter zeroing

see current calibration

<9> V.FS (voltage full scale)

see voltage calibration

<10> A.FS (current full scale)

see current calibration

<11> V.OS (voltage offSet)

see voltage calibration

<12> I.OS (current offset)

see current calibration

<13> Voltage display

see voltage calibration

<14> Current display

see current calibration

 

 

 

 

 

Setting up the power supply for use:

1) Always turn current/voltage knob to minimum (anti-clockwise) before switching on the power supply.

2) Switch ON the power supply.

3) Adjust the voltage knob to the voltage required. It is important to verify the voltage using a multi-meter. Do not rely solely on the voltage reading on the power supply equipment.

4) Press the current limit button <5>, and turn the current limit knob to the maximum current allowed. Always keep the current limit as low as possible to prevent over driving faulty circuit, which may result in burning/fire.

5) Switch OFF the power supply.

6) Connect up your circuits.

7) Switch ON the power supply.

8) If the voltage and current when switched on is not of expected, switched off the equipment and think over what is happening.

 

 

Calibrating the voltage display <13>:

1) Make sure the power supply is switch OFF.

2) Adjust the OVP <6> to maximum, to prevent the protection mode from activating.

3) Adjust the voltage knob to minimum (anti-clockwise).

4) Switch ON the power supply..

5) Insert a digital VOLTAGE-meter and it should read 0V across the +ve -ve terminal.

6) If it does not read zero volt, adjust V.OS <11> until the digital multi-meter reads 0V. adjustment should be small and slow as the reading needs about a minute to be stable.

7) After the digital multi-meter reads 0V, it means that the output voltage at 0V has been tuned. Check the power supply voltage display 0V too. If the display does not show 0V, adjust the voltage meter zeroing <7> to 0V reading on the power supply equipment.

8) Adjust to increase the voltage to exactly 30V shown on the multi-meter. The voltage display on the power supply may not shows the 30V. Adjust V.FS <9> to adjust the voltage display to show the 30V on the equipment. Note that adjusting V.FS do not change the voltage output from the power supply equipment.

9) The equipment should be calibrated. Adjust to varies voltage to check if the voltage display tally the reading shown on your multi-meter.

 

Calibrating the current reading <14>:

1) Make sure the power supply is switch OFF.

2) Adjust the voltage/current knob to minimum (anti-clockwise).

3) Insert a digital CURRENT-meter and it should read 0V across the +ve -ve terminal. Make sure the priority is correct or else your meter will be damaged. +ve probe connected to the +ve terminal, while the -ve probe to the negative. This forms a short circuit across the power supply terminal as a amp-meter is 0 ohm.

4) Switch ON the power supply. The C.C <3> indicator will light up to indicate over current. This is because the current limit knob is turn minimum, limiting the current.

5) Increase the current knob by a bit. This should turn off the C.C indicator.

6) Increase the voltage knob by a bit. The C.C indicator could be lighted up, with a current reading on the display <14>. The display reading should reads the same as your digital CURRENT-meter. Adjust to varies current limit to check if they are of the correct reading.

7) If the reading is incorrect, A.FS <10> and I.OS <12> will need to be adjusted as it is done for the voltage calibration. The procedure will be slightly more complicated as current measurement is not as direct as voltage measurement, however the priciple is still the same. Tuning the offset first followed by the meter zeroing, and lastly the full scale tuning.

 

 

 

 

 

 

 

 


www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller




My Tektronix 2445A 150Mhz Oscilloscope

Features    
Volts measurement cursors Specification  
Time measurement cursors Form Factor Benchtop
Cursor tracking Bandwidth 150 Mhz
Alphnumeric Readouts Rise time 2.33 ns
Time Measurement Number of Channels 4 ch
Voltage Measurement Min. Vertical Sensitivity 2 mV/div
CRT Readouts Maximum Vertical Sensitivity 5 V/div
  Vertical(or Deflection Factor) Accuracy 2 %
  Input Coupling AC,DC,GND
  Input Impedance 1 MOhm
  Input Impedance (alternate) 50 Ohm
  Maximum Input Voltage 400 V(dc+p)
  Maximum Input#2 (for Impedance #2) 5 Vrms
  Main time base – lowest 10 ns/div
  Main time base – highest 1 s/div
  B Sweep Time Base (low) 10 ns/div
  B Sweep Time Base (high) 50 ms/div
  Time base Magnification factor (X?) x10
  Timebase accuracy 0.6 %
  Trigger Source External,Internal
  Trigger Modes AC,Auto,DC,HF-REJ,LF-REJ,Normal,Single
  Display Type Color CRT
  Display Size 12.7 cm
  User Interface Proprietary
  Out of Production

Nov-01-2000

  CE Compliance Not on file
  UL Compliance Not compliant
  Power Requirements, Input Power Universal (Auto Sense and Switch)
  Physical Dimensions

Width: 330 mm

Height: 190 mm

Length: 434 mm

Weight: 9.3 kg(20.5 lb)

For more information regarding the use and operation of an oscilloscope, you can refer to the following document, the XYZ’s of Oscilloscopes  from Tektronix.

XYZs of Oscilloscopes, Tektronix 03W_8605_2.pdf

 

 

My Tektronix 466 100Mhz Analog Storage Oscilloscope

scan version of the manual for tektronix 466 oscilloscope is available in *.pdf format.





www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller



 

 

Electronic Exhibition

Written by Lim Siong Boon, last dated 06-Jul-08.

 


System Integrator Exhibition, Interactive Electronic Display




I had this chance to visit Singapore Polytechnic on their open house during my secondary school days. From what I recall, this is the 1st electronic PCB project I ever build. It is a basic LED blinker. The blinking rate can be adjusted with the variable resistor on board. I had build a working circuit without knowing much about electronics at that time.
This is a electronic dice circuit board. Basically it will generate a random number 1 to 6 when the push button is pressed. I couldn’t remember how I got this circuit.
My first electronic audio project build during my first semester course “Diploma in Electronics, Computer and Communication” in Singapore Polytechnic. It is call a Melody Generator. Basically the IC contains a number of music tune. Passive component and transistor amplifier are interfaced to the IC to generate the music. The switches is for selecting operation mode, while the red push button is to activate the function.

As you can see, the PCB board is quite large, but I manage to squeeze the circuit traces onto a quarter of the board space. We start off with component purchase, PCB board routing design, PCB board fabrication, soldering up to troubleshooting in this project. My first taste of a full electronic project run through.

 

 


www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller





My first home build power supply. 15Vdc 1A rating. I have been trying to look out for high current power supply circuit with current limit function, but failed to find one good one. All component are rather cheap except the voltage and current meter which is about S$10 each.

 

This a signal / function generator I build during my second year in my diploma course.

 

The function generator can generate sin, square and triangle signal for system testing. It is power by a signal generator IC, while the rest of the component on the PCB interface to the IC. For this project, we are involve in more engineering process from Computer Aided Design for the PCB layout, PCB fabrication, component purchase, chassis design and fabrication, soldering and troubleshooting.

 

My brother’s work. He is also study in electronics.

 

 

Component side

 

 

Wiring side.

Parallel port, Input/Output I/O interface board. This multiplex I/O interface is control through the parallel through a computer. The circuit uses the IC 74HC245 (bi-directional octal bus transceiver buffer), 74HC138 (active low, 3 to 8 line decoder demultiplexer) & 74HC574 (octal d-type latch flip flop, positive edge trigger) to multiple the 8 bits port into 32 bits port. The circuit is taken from a electronic cook book, “101 Circuits”.

It is one of my first few home build project that I have done. I managed to squeeze all component onto the PCB board. As seen from the photos, there is hardly any space between the components. The wiring side is very dense, as there is almost a wire soldered to each pad on the board. Quite proud of myself for this achievement.

 

This is suppose to be a inductor measurement circuit. The circuit uses logic gates to generate frequency for the inductor measurement. By reading the dc output voltage, we should be able to tell the inductance of the component. I didn’t really do much test to check if it is working well.

 

test circuit 1.

 

test circuit 2.

 

Op amp test circuit.

 

I am still sourcing for an affordable storage system for my components. Any suggestion?

 

Basic Components for Electronic Circuit Project

 

More Components

 



System Integrator Exhibition, Interactive Electronic Display


 

by Lim Siong Boon

 

 

DTMF Circuits

Telephony Communication
DTMF decoder using MT8870DE.
A telephone controlled device interface.

DTMF decoder using MT8870DE.

A telephone controlled device interface.

Written by Lim Siong Boon, last dated 06-Jul-08.

This circuit detects the dial tone from a telephone line  and decodes the keypad pressed on the remote telephone. The dial tone we heard when we pick up the phone set is call Dual Tone Multi-Frequency, DTMF in short. The name was given because the tone that we heard over the phone is actually make up of two distinct frequency tone, hence the name dual tone. The DTMF tone is a form of one way communication between the dialer and the telephone exchange.

A complete communication consist of the tone generator and the tone decoder. In this article, we are use the IC MT8870DE, the main component to decode the input dial tone to 5 digital output. These digital bits can be interface to a computer or microcontroller for further application (eg. remote control, phone line transfer operation, etc…).

 

 

 

 

Keypad Dial Tone Frequency Table

  1209 Hz 1336 Hz 1477 Hz 1633 Hz
697 Hz 1 2 3 A
770 Hz 4 5 6 B
852 Hz 7 8 9 C
941 Hz * 0 # D

 

 

 

 

Kit Research History

In the early days, our phone system used to be operated by human operator in a telephone exchange room. The caller will pick up the phone, giving instruction to the operator to connect their line to the destination over the other end of the telephone. As more and more people find phone technology a useful communication tools, line connection use human operator has become a tedious task.

As technology matures, pulse/dial tone method was inverted for telephony communication. It uses electronics and computer to assist in the phone line connection. Basically on the caller side, it is a dial tone generator. When a key is being pressed on the matrix keypad, it generate a unique tone consisting of two audible tone frequency. For example, if the key ‘1’ is being press on the phone, the tone you hear is actually consist of a 697hz & 1209hz sine signal. Pressing key ‘9’ will generate the tone form by 852hz & 1477hz.  The frequency use in the dial tone system is of audible range suitable for transmission over the telephone cable.

On the telephone exchange side, it has a decoder circuit to decode the tone to digital code. For example, the tone of 941hz + 1336hz will be decoded as binary ‘1010’ as the output. This digital output will be read in by a computer, which will then act as a operator to connect the caller’s telephone line to the designated phone line. The telephone exchange center will generate a high voltage signal to the receiving telephone, so as to ring the telephone bell, to notified the receiving user that there is an incoming call.

This project article focus on a simple DTMF (dual tone multi-frequency) decoder circuit. This circuit can be interface to a computer, allowing caller to computer interaction. Many communication application can be build for example, a computerize call receiving/diverting phone network system. Remote control to Home/Office electrical appliances using a telephone network.

DTMF is a popular project especially in DSP (digital signal processing) subject. DSP software algorithm can be implement to generate as well as to decode DTMF tone. It is very interesting, and I will try to cover that aspect in near future. For now we do the hardware way.

   

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

Singapore Customized, custom made Electronics Circuits & Kits

 

 

 

 

Photos of DTMF circuit built.

DTMF Circuits

This the first DTMF circuit I build. Very small, roughly about my thumb size.

   

Output Logic behavior from the DTMF decoder IC.

 

 

 

 

 

 

 

no button press

TOE: Logic 0

  Q4: Logic 0

  Q3: Logic 0

  Q2: Logic 0

  Q1: Logic 0

 

‘1’ press and hold

TOE: Logic 1

  Q4: Logic 0

  Q3: Logic 0

  Q2: Logic 0

  Q1: Logic 1

 

release from button ‘1’

TOE: Logic 0

  Q4: Logic 0

  Q3: Logic 0

  Q2: Logic 0

  Q1: Logic 1

 

‘2’ press and hold

TOE: Logic 1

  Q4: Logic 0

  Q3: Logic 0

  Q2: Logic 1

  Q1: Logic 0

 

release from button ‘2’

TOE: Logic 0

  Q4: Logic 0

  Q3: Logic 0

  Q2: Logic 1

  Q1: Logic 0

 

‘0’ press and hold

TOE: Logic 1

  Q4: Logic 1

  Q3: Logic 0

  Q2: Logic 1

  Q1: Logic 0

Detection of dial tones is reflected on the bit TOE, while the output Q4, Q3, Q2, Q1 indicate the dial tone that is being detected on the telephony system. A complete table of the decoded digital output for individual dial tone is available in the coming section.

 

 

Key Tone Output Logic
Q4 Q3 Q2 Q1
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
0 1 0 1 0
* 1 0 1 1
# 1 1 0 0
A 1 1 0 1
B 1 1 1 0
C 1 1 1 1
D 0 0 0 0

 

 

These are the decoder output table for the given dial tone detected. Notice that there are key tone for A B C and D. These are special tone which are normally not found on our telephone. It is a common standard build into the decoder chip.

The circuit is relatively simple and straight forward, and all components can be easily found.

Schematics and BOM is provided below for your reference.

 

 

 

MT8870 datasheet

MT8870 application notes

Schematics (Click on the picture for enlarge view)

   

Component Layout (Silkscreen)

PCB Bottom Layer (PCB trace)

 

 

 Home fabricated circuit board

 

 

Bill of Material (BOM)

Part# Description Value Qty
C1, C2 Capacitor

should be 100nF not 100pF.

100pF, 250V x2
D1 High Conductance Fast Diode 1N4148 x1
D2, D3 1.3 Watt Power Zener Diode Zener 5.6V x2
DS1, DS2, DS3, DS4, DS5 Typical RED GaAs LED   x5
R1, R2 Resistor 56KΩ x2
R3 Resistor 150KΩ x1
R4 Resistor 47KΩ x1
R5 Resistor 330KΩ x1
R6 Resistor 100KΩ x1
R7 Resistor 68KΩ x1
R8, R9 Resistor 56KΩ x2
R10, R11, R12, R13, R14 Resistor 470Ω x5
U1 Integrated DTMF Receiver MT8870DE x1
U1 IC holder 18 pins x1
Y1 Crystal Oscillator 3.5795Mhz x1
JP1, JP2 Header, 2-Pin   x2

 

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller

Singapore Customized, custom made Electronics Circuits & Kits

 

 

Telephone Ring Detector Circuit Interface to Microcontroller

 

 

 

Other DTMF Tone Generator or dialer, NTE1690, TCM5589N, TP5089N (NEETRON Sim Lim Tower #B1), 5088, 4089 (YH Radio Sim Lim Tower #B1), LC7366

Other DTMF Tone Decoder 8870, SSI-202, LC7385, KT3170 (alternative to 8870 from YH Radio Basement 1 simlim)

Other DTMF Tone Generator + Decoder, 8888, 8889, 8880, HT9170C

 

 

Other Circuit References  

circuit7-LS1240, ringer.pdf
circuit8-PQUP11084YA Panasonic telephone KX-TS3MXW.pdf

 
   
   
   
   

 

 

www.pic-control.com, Singapore Network Ethernet WiFi RS232 RS485 USB I/O Controller


 

Keyword: circuit detects dial tone, telephone line, decodes keypad remote telephone, Dual Tone Multi-Frequency, DTMF, two distinct frequency tone, communication, remote control, tone generator, tone decoder, IC MT8870DE, digital output, interface computer microcontroller, Telephone Ring detector.