Http://students.iitk.ac.in/roboclub. Main Components: Sensors Micro controller Motor drivers ...

31
http:// students.iitk.ac.in/ roboclub

Transcript of Http://students.iitk.ac.in/roboclub. Main Components: Sensors Micro controller Motor drivers ...

http://students.iitk.ac.in/roboclub

Main Components: Sensors Micro controller Motor drivers Chasis

LINE FOLLOWING ROBOT

SENSORS

How IR Led sensors work??

On the basis of variation in reflection property of Different Colours

MICRO CONTROLLERS

Atmega

Difficulties with Atmega

• Software is not User Friendly

• Many softwares required :• CVAVR – Editor and Compiler• AVR Studio – Transfer code to Atmega

• External Programmer required

So is there a better solution

ARDUINO – Open Source Platform

What is Arduino??• Open-source physical computing platform.

• Physical Input / Output board (I/O) with programmable Integrated Circuit (IC)

• Contains Atmega series Micro controller

Why Arduino ??• Easy to use

• Provides a number of libraries to program the microcontroller easily

• Hardware platform already has the power and reset circuitry setup

• Hardware provides circuitry to program and communicate with the microcontroller over USB

• Arduino has a great community of users that you can get help from

Getting Started

• Check out: http://arduino.cc/en/Guide/HomePage1. Download & install the Arduino environment

(IDE)2. Connect the board to your computer via the

USB cable3. If needed, install the drivers.4. Launch the Arduino IDE5. Select your board6. Select your serial port7. Open the blink example8. Upload the program

Arduino IDE

See: http://arduino.cc/en/Guide/Environment for more information

Try It: Connect the USB Cable

Select Serial Port and Board

A Little Bit About Programming

• Code is case sensitive

• Statements are commands and must end with a semi-colon

• Comments follow a // or begin with /* and end with */

• loop and setup

Our First Program

Terminology

Digital I/0

pinMode(pin, mode)Sets pin to either INPUT or OUTPUT

digitalRead(pin)Reads HIGH or LOW from a pin

digitalWrite(pin, value)Writes HIGH or LOW to a pin

MOTOR DRIVER

Why MOTOR DRIVER ???

• Micro controllers (Atmega ,Arduino) require 5-10 mA while motors require 150 mA and above so Motor Driver is used .

• For driving motor at different rpm by using PWM

H-Bridge

An electronic circuit that enables a voltage to be applied across a load in either direction.

What is PWM ??

Known as Pulse Width Modulation

Simple method of obtaining analog output of any value between 0 and 5V

• Suppose we need 3V for our device at aspecified pin.

We supply 5V on it for (3/5)* 100 % = 60% of the time period and 0V for the remainingtime period

The average voltage at the pin for a timeperiod becomes 3V

If this step is repeated very fast (T is verysmall), then the output behaves as a analogsignal of 3V.

Programming for Motor Driver in Arduino

ALGORITHM

BLOCK DIAGRAM

Both the sensors detect the line then both motors rotate at same pwm.Hence the bot moves forward .

When the right sensor detects the line , left motor is given more speed .Hence the bot moves towars right.

When the left sensor detects the line , right motor is given more speed.Hence the bot moves towards left.

Line following using 2 sensors

PWM of Left motor=MEAN PWM –(kp*deviation)

PWM of Right motor=MEAN PWM +(kp*deviation)

Kp – Constant of ProportionalityDerived experimentally