June 8, 2009


After a long struggle with never ending commands and long lists of packages, not forgetting some tedious circuitry, we finally managed to blink an LED using an Atmel ATMEGA16 microcontroller. I’ll explain what we did in some simple steps.
1. Building a programmer (hardware) to program the Microcontroller( MuC )

2. Installation of necessary packages, for compiling and burning the MuC.

3. Burning the MuC

4. Sample program

All the installation and applications are  based on GNU Linux Debian / Ubuntu . Please bear with it.

I. Building a Programmer.
We need a hardware circuit to interface the MuC with a PC via its parallel port so that we can transfer our program from the latter to the former. We have used a circuit compatible with Uisp programming application. The circuit is available here.

The hardware on the bottom right hand side is that for supplying Vcc.
Pin 9 is RESET (active low) and so it is always kept HIGH by connecting it to Vcc via 10k resistor as shown.
Make sure that the GND of Parallel port and that of Power supply are shorted.
Q1 is 4MHz crystal for clock.

II. Packages
Several packages/libraries need to be installed on linux for compiling our program(specifically for MuC) as well as uploading it onto the microcontroller’s (flash) memory using the programmer we discussed above. They are build-essential, avr-libc, gcc-avr, binutils, uisp. To install these packages, type as root user :

#apt-get install  build-essential avr-libc  gcc-avr  binutils uisp

You may skip rest of this section if the above command worked fine!!!

If any error creeps up showing invalid repositories or something similar, we may need to update the repositories file of aptitude (apt). The new repositories to be added for Debian are:

deb http://http.us.debian.org/debian testing main
deb http://www.uk.debian.org/debian stable main contrib non-free

These are to be added/written to the file sources.list in the directory.


( Check whether the current repositories of your apt have the packages  or not, even if your distro is/is not Debian/ Ubuntu. And if needed you may have to find out the necessary ones from the internet )

With our new repositories in place, we need to update our apt with this command:

#apt-get update

If you end up with an error indicating wrong key or something like below


Reading package lists… Done
W: There is no public key available for the following key IDs:

try the following commands :

#gpg –keyserver pgpkeys.mit.edu –recv-key your-key

/* in this particular case, ‘your key’ is 9AA38DCD55BE302B */

#apt-key add /root/.gnupg/pubring.gpg

The second command should give a result OK. Else try this one also.

#gpg –export your key | apt-key add –

A possible screen-shot:

#gpg –keyserver pgpkeys.mit.edu –recv-key 9AA38DCD55BE302B

gpg: requesting key 55BE302B from hkp server pgpkeys.mit.edu
gpg: key 55BE302B: public key “Debian Archive Automatic Signing Key (5.0/lenny) <ftpmaster@debian.org>” imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)

# apt-key add /root/.gnupg/pubring.gpg

So we are done with updating apt-get. Now the next step is installing the packages. Retype the first command of this section.

The installation part is done!

III. Burning the MuC
Several commands are listed below, which will compile a file ‘a.c’ for running on a MuC, create ‘a.hex’ and burn it onto the MuC. They are as follows

To compile and make a.out :
#avr-gcc -mmcu=atmega16 -Os a.c

To convert it into a.hex
#avr-objcopy -j .text -j .data -O ihex a.out a.hex

To detect MuC

#uisp -dprog=dapa .

To erase any existing program:
#uisp -dprog=dapa -dlpt=0x378 –erase

To load it into MuC
#uisp -dprog=dapa -dlpt=0x378 –upload –verify if=a.hex

#uisp -dprog=dapa
Atmel AVR ATmega16 is found

#uisp -dprog=dapa -dlpt=0x378 –erase
Atmel AVR ATmega16 is found.
Erasing device …
Reinitializing device
Atmel AVR ATmega16 is found.

# uisp -dprog=dapa -dlpt=0x378 –upload –verify if=a.hex
Atmel AVR ATmega16 is found.
Uploading: flash
Verifying: flash

IV.Sample Program

Here is a sample program for testing the MuC, The LED to be blinked has to be connected as per the diagram given above, on the 19th PIN. Remember, this is just a sample program. So don’t jump into conclusions straight away if you are new to programming a MuC

#include <avr/io.h>
#define LED PD5

int main(void)
/ * enable PD5 as output */

while (1) {
PORTD=(1<<LED); /* LED ON */
PORTD=(0<<LED); /* LED OFF */
return 0;

Note : It is two separate ‘-‘ characters where it appears to be one long ‘-‘ eg: ‘–erase’ is actually – – erase without spaces. ( wordpress magic it seems! )

January 16, 2009


Filed under: Gadgets,Projects — Rohith @ 11:44 pm
Tags: ,

At last we made a robot!

Here is our effort.

Theme :

Basically, you can think of this as a remote controlled toy car, on three wheels. You can control the two backwheels using your remote. The front wheel is free-rotation type. To move our robo forward, the two backwheels rotate forward, to move it left our left wheel rotates backward and our rightwheel rotates forward( imagine!) and similarly other two movements can be achieved.


Components :

To drive the two rear-wheels, we use two motors, which can be independently controlled. When we supply HIGH to a motor’s red and LOW to black wire, it rotates in clockwise direction. And in anti-clockwise direction vice-versa. So in this way we control the motors.(Here HIGH is +12V of battery. LOW is zero or negative of DC battery.)

We have to control these motors using a remote control. Thats our mission. The circuitry we are going to discuss about just enables us to do that. First, transmission of data( in bits, HIGH- 1, LOW -0). This transmission is done using RF(Radio Frequency) modules- RX+TX kit. We have a transmitter and a receiver in this kit. On our remote control, we can generate a signal 10,10 or 10,01 or so on with switches( HIGH- LOW /ON-OFF thingy!). Then we have to transmit this signal to the robot’s motors. The way it is done is that, its first encoded (using an encoder IC)and then fed into the transmitter of our remote, which transmits the signal. This encoded signal is received by a receiver(on the robot), which is fed into a decoder IC and the output is at its four o/p pins. So, say if we give a 1001(HIGH LOW LOW HIGH ) using the remote-control, we should get 1001 at the o/p pins of the decoder IC of the robot. This information is then used to drive its motors accordingly. The table below gives what signals we have to give to both the motors (Left- L, Right- R) simultaneously to control the direction.



10 10


10 01


01 10


01 01


But these motors need 9-12V supply, whereas our decoder only provides 5V at its o/p. So to drive the motors,instead of providing the decoder output directly to the motors, we use another IC( L293NE) . The working is discussed below.

List :

1. Chasis for the bot (Try to make one !)2. Wheels(2) 3. One Free wheel in front( Castor wheel) 4. Breadboard 5. RF modules( RX + TX kit) 6. Encoder +Decoder ICs (HT12D, HT12E ) 7. L293NE 8. 7805 Voltage Regulator (for +5V Vcc) 9. Resistors 10.Geared Motors (60 RPM) 11. Switches 12. PCB (or Option 4 or Both) 13. Single stranded Wires

Circuit + Working :


The above diagram is a simplified flowchart of our transmitter receiver setup. Now we’ll explain the circuit diagram.



So,in simple words, if we are to supply a 1001 to S1,S2, S3,S4 in the transmitter , we should get it at D1,D2, D3,D4 at the receiver.

Note : The Input and output pins of the transmitter and receiver ICs are Active Low type

Next step is driving the motors. We could connect D1 D2 to the first motor (10) and D3 D4 to the second motor(01). But we can get only a maximum of 5V from the o/p pins(D1-D4), whilst the motors require atleast 9V-12V for optimum performance. So to negotiate this, we use a motor driving IC L293NE.

l293pinoutIt works like this. When we supply a HIGH at Input1, we get the voltage Vc ( pin8 ) supplied by the battery, at the Output1(and zero for LOW i/p). And similarly at the other three inputs as well. For this, we have to keep the ‘Chip Inhibit’ (or Enable) labelled pins 1 & 9 HIGH.

Now, we connect D1 to Input1 and D2 to Input2. (1,0 here). When we make Pin 1 HIGH, we get the voltage Vc(9V or 12V, as supplied) at Output1 and zero at Output 2. These two signals can drive one motor. Thus we can drive two motors using one L293.

So, if all goes well, we should be able to drive our robot using our remote control.



Under Rs 1300/- or $30( Robokits)

PS : 1. BRAINs stands for Back Row Association Inc.

2. Any(if) reader who wishes to implement this circuit is expected to have atleast basic knowledge in electronics and ICs.

October 11, 2008


Filed under: Open Source Software — Rohith @ 12:10 am
Tags: ,

My dear state Kerala is going to be the face of Free and Open Source Software in India. 

The Kerala State Information Technology Mission is keen to set up the proposed International Centre for Free and Open Source Software (ICFOSS) by December this year.

Concurrent with the launch of the Centre, the government will hold an international seminar on ‘Free Software, Free Society: Freedom in Computing, Development and Culture’ with a view to highlighting the State’s feats in FOSS. It is also aimed at formulating a consortium of FOSS-related organisations the world over.

For the complete story :


September 29, 2008

Hardware Specifications- Beagleboard

Filed under: Beagleboard,Embedded systems,Gadgets — Rohith @ 10:39 pm
Tags: , ,

The hardware specifications of the Beagleboard is given below:

  • ARM 600MHz Cortex A-8 processor, OMAP3530 Architecture
  • 128MB DDR RAM
  • 256MB NAND
  • High Speed USB 2.0 OTG
  • S-Video (TV out)
  • DVI-D
  • Stereo Audio Out & In
  • 8-bit SD/MMC

Complete Technical Reference Manual for OMAP3530 processor is open and freely accessible to all


Software is made open and freely available to all



September 22, 2008


Hello World!

Here I am, starting off my blog with a post on a seminar which I had attended on 20th Sept,at the CEDT Department, IISc Bangalore. It was an Embedded Linux Training Session for students conducted by Texas Instruments Pvt. Ltd (India) featuring their latest gadget Beagleboard.

Registration had started at around 9.30-9.45 and there was an introductory speech by Mr. Khasim Syed Mohammed. Some beagleboard.org volunteers gave a short ‘Basic GNU Linux concepts’ class for a part of the audience who were absolutely new to this environment( commands like ls, cd, etc). But a thing which is still vibrating in my mind is that one among the guys who gave us this short intro was repeatedly saying ‘laa-yi-nux’ for ‘li-nux’ … (hmm…well..which is true ? and better ?)

A tea break followed 🙂

At 11.45, the next session kicked off with Mr Khasim introducing us with the OMAP3 architecture which underlines our Beagleboard.

Beagle Board is an Ultra-low cost high performance, Low power OMAP3 based platform form Beagleboard.org. It is basically intended for students ,hobbyists and desktop developers looking to get into low-power, small-form-factor applications. It has the electronic industry’s highest performance ARM 600MHz Cortex-A8 processor with graphics and video accelerators. And a surprising thing about it is that its just a 3″-3″ USB powered board. Cool ain’t ?

The session which followed gave us an overview about the software components of it. It was primarily a Hands ON session with the kernels and drivers , bootloaders and compilation steps involved.

Now to make the board working, first they cross-compiled the u-boot and x-loader bootloaders. Then linux kernel and the required drivers were compiled and file system was written. Now this is just an outline. Do read this if you want to know more:


They connected basic I/O devices and played a movie ( King Kong 🙂 ) on that board for us


All the tools and softwares used were Open Source Software. Its really an amazing piece of electronic marvel. Do visit http://beagleboard.org/

For more pics :


Create a free website or blog at WordPress.com.