DIY a simple Line Follower Robot

October 15, 2009 by admin · 7 Comments
Filed under: electronics 

A Line Follower machine is most probably the very first step of most of the students in the field of Autonomous Robotics. It is obvious that for best outcome; we need 3-4 sensors and a microcontroller. But dont worry if you are not familiar to microcontroller programming and designing. You can design your own Line Follower Robot without using any kind of programmable device like microcontroller. Belive me by some tricks, you can get the outcome nearly similar to that by using Microcontrollers. Here i am going to present a circuit which gives a very fine output for Black line follower. You can see the output in the video.

This robot uses two sensors, based on comparator, LDR & LED and a L293d Dual Hbridge to control motor direction.

As we are using two sensors we can get maximum of 4 output conditions as shown in table below.

Left Sensor

Right Sensor

Decision

Action

White (0)

White (0)

No Error

Move Forward

White (0)

Black (1)

Left Misalign

Stop right motor

Black (0)

White (0)

Right Misalign

Stop Left Motor

Black (1)

Black (1)

Not Possible

Stop both motors

How to make sensors ???

sensors are based on simple comparator logic. The IC used to make sensor modules is LM324 quad Op-Amp. sensor includes a transmitter section consist of a high intensity red LED with current limiting resistance of 330E.sensor

lighttx


Final circuit diagram using l293d and two sensors

linefollower

For any problem contact me devesh@electroons.com

DSCN0353DSCN0360

AVR development using tools with UBUNTU 8.10

September 9, 2009 by admin · 4 Comments
Filed under: Microcontrollers, electronics 

Electronics freaks all around the world are rapidly moving toward Linux based free tools for thier development work. Most of the newbies find it difficult to switch fully to linux as the lack of availability of window counterpart tools in linux. Here i am giving you an idea how to start AVR development while you are using some Linux distro as your OS. Now a days UBUNTU is one of the most popular Linux distro for beginners because it is very easy to use, and most of the necessary tools are packed with the distro. Here i am describing how to write a program, compile a program and burn the AVR in UBUNTU. I checked this procedure on UBUNTU Desktop edition 8.10 it should be compatible with others also but i didnt try. So lets start your embedded world on linux too…

To start with AVR development on linux you need following four packages.

1. avr-gcc

2. avr-binutils

3. avr-libc   // standard AVR C library

4. avr-dude  // basic package that transfers ur ihex to MC.

The whole installation procedure is explained in this post, but first i will explain you what these above 4 packages actually are;

avr-gcc is the ‘C’ cross compiler for AVR which generates

avr-binutils- The binutils package provides all the low-level utilities needed in building and manipulating object files. Once installed, your environment will have an AVR assembler (avr-as), linker (avr-ld), and librarian (avr-ar and avr-ranlib). In addition, you get tools which extract data from object files (avr-objcopy), dissassemble object file information (avr-objdump), and strip information from object files (avr-strip). Before we can build the C compiler, these tools need to be in place.

avr-libc- it is the satndard function used while programming for AVR in C. It consistes of header files for utilizing the features of AVR like Interrupts, EEPROM, I2C, SPI, UART etc. For more info go to AVR-libc home http://www.nongnu.org/avr-libc/

avr-dude-

AVR-DUDEi is an open source utility to download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers using the in-system programming technique (ISP). For more info try this : http://www.nongnu.org/avrdude/

That is all about what AVR specific tools you need to do your stuff but first thing you need is some editor where you can type your code. I use gEdit as a text editor on my machine. Below is the command to install gEdit.

Installing gEdit text editor..

gedit

This command will ask for your root pasword enter it !!! then it will start building dependency tree for the package.

gedit2After this process get complete you have gEdit install on your machine. Now you can run gEdit by typing ‘gedit’ on your terminal.

Now there is an utility called embedded terminal which can be plugged in with gEdit so that you can run commands right from the editor’s bottom pane.

To install embedded terminal you need to run a command below…

embeddedterm

Now follow these simple steps to embed the terminal with gEdit.

  1. Run gEdit by typing gedit on terminal
  2. Noe in gEdit goto menu Edit >> Preferences >> Plugins tab choose Embedded terminal

plugingedit

Now Press Close button and the command line is added with gEdit, so that now you can type, make and burn your code from a single window.

gEdit screenshot electroons.com

Now we have our Text editor Done !!! Lets move onto installing avr specific utilities..

Installing AVR-gcc cross compiler ???

1. Run the command as shown in images below.

avrgcc

2. Enter sudo password.

3.Now AVR-Gcc is installed on your PC

Installing AVR-libc ???

1. Run the following commands as shown in the screen shot below.

installavrlibc

Installing AVR dude ???

avrdude

Now we are almost done with all the necessary tools installed…Lets see how to compile, debug and burn the source code…

Few Final Steps…

1. Write your code inside editor.

2. After writing your code go to embedded terminal at bottom pane and change your path to the directory where the source files and MAKE file is stored.(My case /home/deveshsamaiya/Documents/LCD/)

3. On embedded terminal prompt type “make clean” ; this will remove all the previosly compiled project, object files. it is quite necessary if the source is newer.

4. Now time to compile your code and to find Bugs. Run command ‘make all’ in terminal. This will find any error in the source if the source is error free it will create the iHex file and other interface files.

5. Now suppose your source is compiled successfully without error/warnings. Now we need to transfer the iHex file into AVR flash. Here comes the role of AVRdude which is already installed as disscussed earlier. First you need to specify the type of programming harware you are using for transferring the code.

If u r using parallel port BSD programmer modify programmer as bsd in MAKE file. I used a serial programmer so i wrote programmer as ‘ponyser’ similarly u can use different names for programmers like USBasp etc. we will disscuss the role of MAKE file in AVR-gcc after doing this.

Finally issue command ‘make program’ to transfer the data onto flash.

IF the above last process get completed successfully then you are done your AVR Micro is ready to perform the programmed task.

Below are some settings for MAKE file (programmer and PORT), i used programmer as ‘ponyser’ and port as ‘/dev/ttyS0′ its com1.

Download a Sample MAKE File Here

If you have any queries and if found any trouble while developing AVR on ubuntu do ask by commenting here or my email id is: devesh@electroons.com

Thanx for visiting, i hope u enjoyed this articlea

« Previous PageNext Page »