Search Engine Submission - AddMe TRUE-BUS: LINE FOLLOWER IS EASY TO MAKE

Senin, 05 Oktober 2009

LINE FOLLOWER IS EASY TO MAKE

LINE FOLLOWER IS EASY TO MAKE

Specification:
Microcontroller ATmega16 with 16 kbyte flash, 512 byte EEPROM and 1kbyte SRAM or ATmega8535 with 8 kbyte flash, 512 byte EEPROM and 1 kbyte SRAM have 8 channel 10 bit A/D converter
12 Mhz or 16 Mhz crystal ( the ATmega experience is good on 16 Mhz )
4 push on are connected on PD 4-7 as input pull-up
LCD LM016 2x16 display characters is connected on PB as output set to LCD configuration are there too.

Pin LCD number 15 is connected to VCC or 5 volt and number 16 is connected to PORTB 3 as output set on high.
LED LCD on if PORTB.3 = 0
LED LCD off if else it
Photodiodes and infrareds are connected with PINA as ADC.
ADC value are gotten from reading photodiode as H/L on white/black on track. A/D converters are activated too with thick ADC ENABLE and USE 8 bit then chose clock to 750 Khz and ADC reference (V.ref ) on AVCC or AREF pin, therefore AVCC and AREF is connected with power high logic.
Read_ADC(); is already to use.
Reading sensor:
You have to insert a ADC variable to reverence of reading sensors 8 bit an example X variable. Cause x use 8 bit so you must set to unsigned char.
Unsigned char x;
Being easy and simple take this var on array.
Unsigned char x[8];
Building the C codes

n=0;
While (n==8){
n++;
sample=read_adc[n];
if (sample<255){ l="sample;}">0){
H=sample;}
x[n]=(((H[n]-L[n])/2)+L[n]);
delay_ms(10);}


Then saving ADC ref value on EEPROM or on SRAM
The values keep better in EEPROM than SRAM because with just 1 time to looks for reference ADC values and not necessary any time here to update values ADC reverence.
Making bit or scan sensors bit manipulation
n=0;
While(n==8){
n++;
If (read adc(n)>x[n]){sensor=sensor+2n;}
delay _us(50);}
sprint(buff,”<%x>”,sensor)
lcd_gotoxy(0,1);lcd_puts(buff);

Motor drivers is connected on PORTD 0-3. Motor drivers contain of two H-bridge transistor set in IC ld298 or make yourself this H-bridge from FET / TR. You must necessary to chose FET / TR so it works not better expected. Chose the FET or TR with low resistance , that can constrain current leave to motors.
The motors can run CW or CCW from generating PWM on timer set. Generating PWM can use time 0 / 2 interrupt overflow or time 1 16 bit too.
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{/*xcount++;
if (xcount<=lpwm) //on gedex blog ( gedex PID ) enki=1; //6 pin include ENABLE L&R else enki=0; if (xcount<=rpwm) enka=1; else enka=0; TCNT0=0xFF;*/ counter++; if (counter>=L){ //good performance
Lback=1;} //4 pin without ENABLE
else{ Lback=0;}
if (counter>=R){
Rback=1;}
else{ Rback=0;}
OCR0=0xff;}

H bridge FET driver search on this ( using keywords ).
ISP PROGRAMER.
PORTC is unused , you can configure to other control function such as sensors affix with comparator, wheel encoder, sensors ON/OFF control with super bright led can allowed you want.
-

-          BELAJAR MIKROKONTROLLER : HOME
-          MEMBUAT DOWNLOADER USB SENDIRI
-          DASAR SIMULASI PROTEUS 7
-          CODEVISION AVR / CVAVR
-          MIKROKONTROLER
-          BILANGAN HEXADESIMAL
-          BILANGAN DIGITAL
-          PID ALGORITM / ALGORITMA PID
MEMBUAT ROBOT LINE FOLLOWER