rb002 ppt basic elec.pdf
TRANSCRIPT
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 2/45
BASIC ELECTRONICS &CODING
iBOT Session 2; RB 002 (Remember RB 001!)
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 3/45
Why?
Electronics on the robot is the brain of the robot.
Is useful in taking decisions
The start of Artificial Intelligence.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 4/45
SOME BASIC COMPONENTS
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 5/45
Multimeter
Measure parameters (Voltage, Current, Resistanceetc.)
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 6/45
BreadBoard
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 7/45
Potentiometer
Variable Resistor
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 8/45
Diode
Allows current in only one direction
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 10/45
IR LED Pairs
Transmitter and RecieverAnalog Output
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 11/45
Comparator
LM324V1 > V2, Vout = +VccV1 < V2, Vout = -Vcc+Vcc = 5V-Vcc = 0V
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 12/45
Voltage Regulators
iBOT
12
Step down DC voltagesOutput voltage is fixedInput Voltage may fluctuateNomenclature ( 78xx)When and when notto use?
Dissipative type
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 13/45
Types of sensors
iBOT
13
TSOP/ obstacledetection sensorsSound SensorsBump SensorsTilt sensors
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 14/45
IR Sensor
Circuit for IR sensor
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 15/45
Motor Driver
Commonly used motordriver: L293D,mc33886.Interface betweenmicrocontroller andmotors. 16 pin IC
Can control 2 motors,bidirectionSupports PWM
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 17/45
MICROCONTROLLER
It’s a small computerhaving a simple cpu,timers and i/o ports.
Can perform functionsdepending on theinputs given.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 18/45
MICROS WE USE
The micros generallyused in the insti — PICAVRs
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 19/45
AVR MICROS
Atmega micros are in large numbers and areclasified under tinys and megasMost used in the insti are ATMEGA 8 and 16The number in the micro specifies the memory of themicrocontroller.Each micro has a fixed number of ports and each
port generally consists of 8 pins
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 20/45
ATMEGA 16- SPECIFICATIONS
Atmega 16 is a 40 pin microcontroller.Has four ports used for i/o operations.Available in two kinds…….surface and boardmounts.Used for various purposes like hardware interfacing,analog to digital conversion etc.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 21/45
PIN CONFIGURATION
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 22/45
CODING A MICRO
Writing the code and converting it to assemblylanguage can be done by using —
1. AVR STUDIO2. PROGRAMMERS NOTEPAD
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 23/45
WORKING WITH WINAVR
Install Win Avr on your computer
Open winAvr to find the following window.
Write the code and save it as a (.c) extensionex-mycode.c
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 24/45
CODING IN PROGRAMMERS NOTEPAD
Go to mfile generator,enter the name and microtype(mycode,atmega 16).
Enter USB Tiny in the programmer options and clock
frequency.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 26/45
save as Makefile in the same folder as the code.
Go to programmers notepad and press makeall tocompile and program to burn the micro.
Make sure usb tiny Programmer is connected.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 27/45
The bottom most pin of the programmer should beconnected to the ground of atmega 16.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 29/45
CODING BY USING AVR STUDIO
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 30/45
Select avr gcc and write ur projectname
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 31/45
Select avr simulator and atmega 8 or16
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 33/45
Write the code in the dialog box in the center.
Once the code is done, go to build and select build.
To simulate the code, select start debugging indebug option and give suitable conditions for pins
and ports.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 37/45
LINE FOLLOWER
12 v to 5 v Read data fromsensors
Process dataFrom sensors
Give output tomotor driverConverts 5v
signal to 12v ofsuitable current
Connect tomotors
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 38/45
Writing Codes
Libraries to be included:
#include <avr/io.h>
#include<util/delay.h>(If delay is used)
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 39/45
Syntax
DDR(A,B,C,D)=0b10101010;Specifies the data direction1 means the pin is output.0 means the pin is input.
PORT(A,B,C,D)=0b00001111;Specfies the value of the output pins.
1 means 5v and 0 means 0 vmake sure only pins given 1 in DDR can giveoutputs.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 40/45
Binary And
0b??????11 & 0b00000010== 0b00000010;
So we use binary and operation to remove theunnecessary pins from comparing.
Hence in an if statement ,syntax is
if(PINA & 0b00000011)=0b00000011;to see if PINA0 and PINA1 are high.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 41/45
CODE
Same as a c code u genarally write.
Include libraries.
Use proper syntax for if,for and while loops.
Use while(1) to run a code indefinitely.
8/10/2019 RB002 PPT Basic ELEC.pdf
http://slidepdf.com/reader/full/rb002-ppt-basic-elecpdf 42/45
EXAMPLE CODES-LINE FOLLOWING