This document summarizes Day 1 of an Arduino robotics workshop. It introduces the instructor and provides an overview of the workshop objectives, which are to introduce Arduino, teach robotics fundamentals, have participants build and program a small autonomous robot. The workshop covers basics like breadboards, Arduino components, circuits, coding blink programs. It also demonstrates using sensors, motors, an H-bridge motor controller to build a crawling robot that can move and turn in different directions.
Arduino Robotics Workshop
Day 1
Sudar Muthu (@sudarmuthu)
http://hardwarefun.com/arduino-workshop
http://github.com/sudar
2.
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
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
How to usea 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
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
Identify these componentsin
Arduino
Microcontroller
Power jacket
USB jacket
Digital pins
Analog pins
Reset button
http://hardwarefun.com 17
18.
Identify these componentsin
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
19.
Identify these componentsin
Arduino
Power Led
Rx and Tx Led’s
Test Led
Crystal
Anything else?
http://hardwarefun.com 19
Different ways topower 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
Making a LEDblink
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
26.
Anatomy of anArduino sketch
http://hardwarefun.com 26
27.
Printing values throughSerial
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
Reading Analog valuesfrom 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
33.
Control an LEDbased 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
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
Teaching robot tocrawl
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
What we willsee 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
51.
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
52.
Questions
Thank You
Sudar Muthu (@sudarmuthu)
http://hardwarefun.com/arduino-workshop
https://github.com/sudar/arduino-robotics-workshop