Autonomous_Bot_Making

51
www.robotix.in

description

basics | DP workshops

Transcript of Autonomous_Bot_Making

Page 1: Autonomous_Bot_Making

www.robotix.in

Page 2: Autonomous_Bot_Making

Locomotion System Power Supply Sensors Microcontrollers Motor Driver Speed Control Line Follower-Algorithm

www.robotix.in

Page 3: Autonomous_Bot_Making

DIFFERENTIAL DRIVEA differential drive is the most basic drive, which consists of two sets of wheels that can be driven independently.

www.robotix.in

Page 4: Autonomous_Bot_Making

MOTION LEFT WHEEL RIGHT WHEELForward

Backward

Left Turn

Right Turn

Page 5: Autonomous_Bot_Making

Drives

www.robotix.in

Page 6: Autonomous_Bot_Making

Our power supply consists of the rectifier circuit and the transformer.

A rectifier is an electrical device that converts alternating current (AC), current that periodically reverses direction, to direct current (DC), current that flows in only one direction.

www.robotix.in

Page 7: Autonomous_Bot_Making

www.robotix.in

Page 8: Autonomous_Bot_Making

www.robotix.in

Page 9: Autonomous_Bot_Making

www.robotix.in

Page 10: Autonomous_Bot_Making
Page 11: Autonomous_Bot_Making

Comparator CircuitLED-LDR Circuit

www.robotix.in

Page 12: Autonomous_Bot_Making

www.robotix.in

Comparator

Page 13: Autonomous_Bot_Making

www.robotix.in

LM339, LM393 and LM311 They consist of more than one comparator. LM311 consists of single comparator

Page 14: Autonomous_Bot_Making

www.robotix.in

Page 15: Autonomous_Bot_Making
Page 16: Autonomous_Bot_Making
Page 17: Autonomous_Bot_Making

www.robotix.in

Page 18: Autonomous_Bot_Making

www.robotix.in

A line follower is basically a robot or a machine that takes external inputs (sensory feeds) and decides whether it is on the path or off it. As a point of approach let us consider that we are trying to follow a certain white line on a black background. How would the bot decide whether it is on the white line? The sensors come into the picture here. For detecting a white line on a black surface the bot must be able to distinguish between the colours. In an electric circuit distinguishing a difference in any field is achieved using difference in voltages. The sensors basically provide this voltage difference. Here we take the example of a differential drive with a LED-LDR sensor array for line following.                               

Page 19: Autonomous_Bot_Making

www.robotix.in

           The LED                and            The LDR

Page 20: Autonomous_Bot_Making

www.robotix.in

An LED-LDR sensor can easily be used for following white lines on black surfaces, as is the case in this event. These are used for detecting surfaces that reflect light at intensity different from the adjoining surfaces.

Basically, an LED (Light Emitting Diode) is a small elongated bulb-like object that emits light. They are available in various colors such as red, green, white etc.

An LDR (Light Dependent Resistor) is a small resistor, the resistance of which depends upon the intensity of light incident on it. More the intensity of light falling on it, lesser is its resistance. The resistance usually varies in the range of about 10k ohms. Hence a 10k ohm resistance should be used in series with a LDR.

Page 21: Autonomous_Bot_Making

www.robotix.in

Light Sensing Module using LED-LDR combination. Now as more intensity of light falls on the LDR, its resistance drops and the potential at -ve terminal of comparator increases. If this potential is less than that at the +ve terminal, a high signal is obtained as output.

Sensor Interfacing

Page 22: Autonomous_Bot_Making

www.robotix.in

The Light Dependent Resistor (LDR), as the name suggests, changes its resistance depending on the intensity of light that is incident on it. Therefore with light (from the LED) reflected from the white surface being more brighter (i.e. more intense) than the light being reflected from the black surface the LDR provides two separate resistances, hence two different voltages, thus separating white from black. Using these two voltages a mean voltage is decided which is used as the “reference” voltage. This is termed as calibration. The reference voltage is used in the comparator circuit which converts these voltages into “highs” and “lows”.

Page 23: Autonomous_Bot_Making

www.robotix.in

Page 24: Autonomous_Bot_Making

www.robotix.in

Circuit has 4 sensors Each is connected to a comparator of the IC Each should have its own potentiometer for

thresholding

Page 25: Autonomous_Bot_Making

www.robotix.in

Page 26: Autonomous_Bot_Making

www.robotix.in

Page 27: Autonomous_Bot_Making

www.robotix.in

Page 28: Autonomous_Bot_Making

The Microcontroller: Brain of the autonomous robot

Has it’s own microprocessor, RAM and static flash storage

ATMEGA 16 is used here. ATMEGA 16: 16MHz processor, 1KB internal

SRAM and 16KB of in-programmable memory 40 pins-8 are reserved for various functions;

other 32 pins are general purpose pins which may be used for general input and output.

www.robotix.in

Page 29: Autonomous_Bot_Making

www.robotix.in

Page 30: Autonomous_Bot_Making

Pins operate in highs and lows. +5 volt is termed as ‘high’; ground potential is ‘low’.

Code designates pins as ‘input’ pins or ‘output’ pins. Input Pins: Used to take input from surroundings,

say, by hooking up with the output of a sensor Output Pins: Used to control external actuators such

as motors (via a motor driver). ATMEGA 16 comes with several advanced features

like timers, interrupts and analog to digital converters.

Code is burnt onto microcontroller using a programmer.

www.robotix.in

Page 31: Autonomous_Bot_Making

It is an electronic circuit which enables a voltage to be applied across a load in either direction.

It allows a circuit full control over a standard electric DC motor. That is, with an H-bridge, a microcontroller, logic chip, or remote control can electronically command the motor to go forward, reverse, brake, and coast.

Page 32: Autonomous_Bot_Making

H-bridges are available as integrated circuits, or can be built from discrete components.

The term "H-bridge" is derived from the typical graphical representation of such a circuit, which is built with four switches, either solid-state (eg, L293/ L298) or mechanical (eg, relays).

Page 33: Autonomous_Bot_Making

S1 S2 S3 S4 Result 1 0 0 1 Motor rotates in one direction 0 1 1 0 Motor rotates in opposite direction 0 0 0 0 Motor free runs (coasts) 0 1 0 1 Motor brakes 1 0 1 0 Motor brakes

Page 34: Autonomous_Bot_Making

To power the motor, you turn on two switches that are diagonally opposed.

Page 35: Autonomous_Bot_Making

www.robotix.in

DC Motor Direction Control H – Bridge Circuit Diagram

S1

S3

S2

S4

M1 2

VCC

Page 36: Autonomous_Bot_Making

www.robotix.in

H – Bridge Working

Page 37: Autonomous_Bot_Making

The current provided by the MCU is of the order of 5mA and that required by a motor is ~500mA. Hence, motor can’t be controlled directly by MCU and we need an interface between the MCU and the motor.

A Motor Driver IC like L293D or L298 is used for this purpose which has two H-bridge drivers. Hence, each IC can drive two motors

Note that a motor driver does not amplify the current; it only acts as a switch (An H bridge is nothing but 4 switches).

Page 38: Autonomous_Bot_Making

www.robotix.in

Page 39: Autonomous_Bot_Making

www.robotix.in

Page 40: Autonomous_Bot_Making
Page 41: Autonomous_Bot_Making
Page 42: Autonomous_Bot_Making

Drivers are enabled in pairs, with drivers 1 and 2 being enabled by the Enable pin. When an enable input is high (logic 1 or +5V), the associated drivers are enabled and their outputs are active and in phase with their inputs.

When the enable pin is low, the output is neither high nor low (disconnected), irrespective of the input.

Direction of the motor is controlled by asserting one of the inputs to motor to be high (logic 1) and the other to be low (logic 0).

To move the motor in opposite direction just interchange the logic applied to the two inputs of the motors.

Page 43: Autonomous_Bot_Making

Asserting both inputs to logic high or logic low will stop the motor.

Difference between L293NE and L293D: Output current per channel = 1A for L293 and 600mA for L293D.

Vs is used to power the motors while Vss powers the L293NE. 

Page 44: Autonomous_Bot_Making

To control motor speed we can use pulse width modulation (PWM), applied to the enable pins of L293 driver.

PWM is the scheme in which the duty cycle of a square wave output from the microcontroller is varied to provide a varying average DC output.

What actually happens by applying a PWM pulse is that the

motor is switched ON and OFF at a given frequency. In this way, the motor reacts to the time average of the power supply

Page 45: Autonomous_Bot_Making
Page 46: Autonomous_Bot_Making
Page 47: Autonomous_Bot_Making

A line follower is a robot capable of tracking a line drawn on a surface

Optical sensors capture the line position at the front end of the robot

The robot is steered to keep it always over the line

Page 48: Autonomous_Bot_Making
Page 49: Autonomous_Bot_Making

www.robotix.in

How many LED-LDR pairs are required to create an autonomous line following robot?

Page 50: Autonomous_Bot_Making
Page 51: Autonomous_Bot_Making

Left Sensor

Right Sensor

Left Motor

Right Motor

1 1 1 10 1 0 11 0 1 0

If we hold an LED-LDR sensor or an IR sensor above the white line (light reflecting), the intensity of reflected light falling on the LDR will be much more than the intensity when it is held above the black floor (light absorbing). This phenomenon is used for line following.There is a minimum of two sensors required for this task, one for detecting each edge of the line. If the sensor gives a high when above the floor and a low when above the ridge, then the simple algorithm for line following will be :