Arduino Robotics Workshop Day 1 Sudar Muthu (@sudarmuthu) http://hardwarefun.com/arduino-workshop http://github.com/sudar
Who am I? Research Engineer by profession Build’s robots as a hobby Playing with Arduino for more than 3 years Blog about Arduino at http://hardwarefun.com Moderator for Arduino India forum http://hardwarefun.com 2
Special Thanks Anil and Sysplay http://hardwarefun.com 3
Objective Introduce Arduino Learn about robotics Learn about sensors Build a small bot Make it autonomous Fully hands on Details at http://hardwarefun.com/arduino-workshop http://hardwarefun.com 4
Basics of Robotics http://hardwarefun.com 5
Anatomy of a Robot Sensors Motors Processor
Sensors (Input)
Motors (Output)
Processor (Brain)
Getting to know your Robotics Kit http://hardwarefun.com 10
Can you identify the different components in the kit? http://hardwarefun.com 11
Breadboard Basics http://hardwarefun.com 12
How to use a breadboard The first two and the last two rows are connected In all the other rows, columns are connected Connect the first and last row to power Connect the second and second last row to ground http://hardwarefun.com 13
Arduino http://hardwarefun.com 14
Different Arduino types Arduino Uno (The one used for this workshop) Arduino Mega Arduino Due Lillypad Arduino BT Arduino Ethernet .. and clones http://hardwarefun.com 15
Getting to know your Arduino http://hardwarefun.com 16
Identify these components in Arduino Microcontroller Power jacket USB jacket Digital pins Analog pins Reset button http://hardwarefun.com 17
Identify these components in Arduino Voltage Regulator Power Pins (how many are there?) Ground Pins (how many are there?) Vin Pin Rx and Tx Pins ICSP Headers http://hardwarefun.com 18
Identify these components in Arduino Power Led Rx and Tx Led’s Test Led Crystal Anything else? http://hardwarefun.com 19
Powering up Arduino http://hardwarefun.com 20
Different ways to power up Arduino Using USB cable Using DC power jacket Giving voltage directly into Vin pin Giving regulated voltage directly into 5V pin http://hardwarefun.com 21
Setting up Arduino http://hardwarefun.com 22
Testing the setup with a “Hello World” program http://hardwarefun.com 23
Blinking LED http://hardwarefun.com 24
Making a LED blink Insert a LED in pin 13 Open File->Examples->Basics->Blink Select Tools->Boards->Arduino Uno Select File->Upload (or press ctrl+u) You should get the message “Done upload” Your Led should blink Congrats you can program Arduino now  http://hardwarefun.com 25
Anatomy of an Arduino sketch http://hardwarefun.com 26
Printing values through Serial Uno has one UART hardware port, using which we can exchange information with computer Very useful for debugging Works at a specified baud rate Use Serial Monitor to read values SoftwareSerial is also available http://hardwarefun.com 27
Digital Input and output http://hardwarefun.com 28
Digital Input http://hardwarefun.com 29
Digital Output The LED blink that we did at “setting up Arduino” is Digital output http://hardwarefun.com 30
Analog Input http://hardwarefun.com 31
Reading Analog values from sensors Connect the LDR on pin A0 and Gnd LDR’s resistance varies based on the amount of light present Read the current value using analogRead() Print the value in Serial Monitor http://hardwarefun.com 32
Control an LED based on light void setup() { pinMode(13, OUTPUT); } void loop() { int val = analogRead(A0); if (val > 50) { digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); } }
Analog Output http://hardwarefun.com 34
Analog Output What is PWM? Analog like behavior using digital output Works by switching the LED on and off regularly Changing the brightness of a Led http://hardwarefun.com 35
Introduction to Batteries http://hardwarefun.com 36
Main Concepts What is voltage? What is current ratting? Rechargeable Don’t ever short circuit it http://hardwarefun.com 37
Different types of batteries http://hardwarefun.com 38
Can you identify the battery which is part of the kit? http://hardwarefun.com 39
Let’s get some Food http://hardwarefun.com 40
Introduction to Motors http://hardwarefun.com 41
Dc Motor vs stepper motor http://hardwarefun.com 42
Identify the motor in the kit http://hardwarefun.com 43
H-Bridge http://hardwarefun.com 44
Understanding the pins of H- Bridge http://hardwarefun.com 45
Connecting motors to H-Bridge http://hardwarefun.com 46
Let’s assemble the bot
Teaching robot to crawl Move Forward Both motors rotate in the forward direction Move Backward Both motors rotate in the reverse direction Turn left Left motor stops. Only right motor rotates forward Turn Right Left motor moves forward. Right motor stops
Putting everything together You have your first fully autonomous robot ready. Now take her for a walk 
What we will see tomorrow Varying the speed of the motor How IR works Making use of IR to find obstacles Make the bot avoid strangers Making it autonomous Future ideas http://hardwarefun.com 50
Links  Arduino – http://arduino.cc  Asimi – A simple bot using Arduino http://hardwarefun.com/project/asimi  Getting started with hardware programming http://hardwarefun.com/tutorials/getting-started-with- hardware-programming  Getting started with Arduino http://hardwarefun.com/tutorials/getting-started-with- arduino-and-avr  Workshop Details http://hardwarefun.com/arduino- workshop
Questions Thank You Sudar Muthu (@sudarmuthu) http://hardwarefun.com/arduino-workshop https://github.com/sudar/arduino-robotics-workshop

Arduino Robotics workshop Day1