Mini Desktop Robot Arm
With Arduino UNO R3
Controller
Organizer : Kolej Vokasional Kuching
Trainer : Circuit Ideas Resources
Venue : Makmal Komputer
Date : 22 -23 October 2015
TOPICS
DAY 1
Arduino Uno hardware description
Arduino installation and configuration
Arduino IDE, Sketch
Digital and analogue input/output
Constant/variable/functions
PWM(Pulse width modulation)
DAY 2
RC Servo
LCD Shield: Hardware Description
Keypad
PC communication with Arduino
DAY 3
Motor Driver Shield : Hardware Description
Line Trekking robot
Wireless Control Shield : Hardware Description
Android Smartphone with Arduino
DAY 4
PS2 2.4Ghz Communication with Arduino
MotoDuino: Hardware Description
(Innovation by Circuit Ideas Resources)
HANDS ON LABS
Lab1-ON LED
Lab 2-LED Blinking
Lab 3-Buzzer beeping
Lab 4- LDR Analog read serial
Lab 5-Smart lamp using LDR
Lab 6-Read a Switch
Lab 7-Spinning a Motor
Lab 8-RC Servo basic
Lab 9-RC servo with potentiometer
Lab 10-LCD Shield ‘Hello world’
Lab 11- Keypad
Lab 12- PC communication with Arduino
Lab 13-Line Trekking robot
Lab 14- Android Communication with Arduino
(using bluetooth communication)
Lab 15- PS2 2.4GHz to control the robot
Lab 16- Control Relay and Buzzer
WHAT IS AN ARDUINO ?
Arduino is an open-source physical computing
platform designed to make experimenting with
electronics, more fun and intuitive.
Arduino has its own unique, simplified programming
language, a vast support network, and thousands of
potential uses, making it the perfect platform for both
beginner and advanced DIY enthusiasts.
THE ARDUINO WAY
The Arduino philosophy is based on making designs
rather than talking about them. It is a constant search
for faster and more powerful ways to build better
prototypes. We have explored many prototyping
techniques and developed ways of thinking with our
hands.
CO-FOUNDER
Massimo Banzi is co-founder of Arduino
Arduinoteam
(David Cuartielles, David Mellis,Gianluca Martino
and Tom Igoe)
BASIC INPUT AND OUTPUT
a) Digital Input
This allows us to read the state of simple sensor, like pushbuttons
or switches.
b) Digital Output
We used it to control an LED but, with the proper circuit it can
be used to control motors, make sounds and a lot more.
c) Analog Input
We can read signals from sensor that send a continuous signal
that’s not just on or off, such as a potentiometer or light sensor
d)Analog Output
This gives us the ability to control the brightness of the LED,
not just turn it on or off.
we can even control the speed of a motor with it.
e)Serial Communication
This allow us to communicate with a computer and exchange
data or simply monitor what’s going on with the sketch that’s
running on the Arduino
ARDUINO BOARD
14 Digital I/O pins(pins 0-13)
6 Analogue In pins (pins 0-5)
6 Analogue Out pins(3,5,6,9,10,11)
PWM
ARDUINO PIN DESCRIPTION
ARDUINO SPECIFICATION
Arduino- Open source hardware platform.
Easy to use hardware+software
Based on ATMEGA328P microcontroller
FEATURES
Using ATmega16U2 for USB to Serial driver instead of
FTDI chip
Flash memory 256KB, 8KB used by bootloader
SRAM 8KB
EEPROM 4KB
Clock speed 16MHZ
WHY IS THE NEED OF A
ARDUINO/MICROCONTROLLER?
Simple electronic system
+ve
Resistor
Push Button
LED
-ve
ARDUINO MAKES IT
SMARTER
A system that can receive information (input data) ,
manipulate the data according to preset algorithms
(instructions) and send command (output data) can
be considered as smart.
15
THE SOFTWARE(IDE)-SKETCH
GUI-GRAPHICAL USER INTERFACE
SKETCH-BASIC
INPUT AND OUTPUT
FUNCTIONS
Arduino includes functions for handling input and output.
a) pinMode(pin, mode)
Reconfigures a digital pin to behave either as input or and output.
Example;
pinMode(7, INPUT); //turns pin 7 into an input
pinMode(8, OUTPUT); //turns pin 8 into an output
b) digitalWrite(pin, value)
Turns a digital pin either on or off.
Example;
digitalWrite(8,HIGH); //turns on digital pin 8
digitalWrite(8,LOW); //turns off digital pin 8
INPUT AND OUTPUT
FUNCTIONS
c) int digitalRead(pin)
Reads the state of an input pin, returns HIGH if the pin senses
some voltage or LOW if there is no voltage applied
Example;
val = digitalRead(7); //read pin 7 into val
d) int analogRead(pin)
Reads the voltage applied to an analog input pin and returns a
number between 0 and 1023 that represents the voltages between
0 and 5V.
Example;
val = analogRead(0); //read analog input 0 into val
INPUT AND OUTPUT
FUNCTIONS
e) AnalogWrite(pin, value)
Changes the PWM rate on one of the pins marked PWM. Pin
may be 11,10,9,6,5,3. value may be a number between 0 and 255
that represents the scale between 0 and 5V output voltage.
Example;
analogWrite(9, 128); // Dim an LED on pin 9 to 50%.
f) Delay(ms)
Pauses the program for the amount of miliseconds specified.
Example;
delay(500); //stops the program for half a second
ARDUINO SOFTWARE-LAYOUT
Latest software can be downloaded from http://arduino.cc/en/Main/Software
PORT IDENTIFICATION-
WINDOWS
ARDUINO SOFTWARE-DETAILS
List of driver for arduino board
List of examples
List of bootloader for arduino board.Development purpose
Java properties
Libraries for prebuild functions and etc
References
Arduino exe files. Copy this and paste at desktop as shortcut
Settings and properties for arduino software. Not
accessible
DIGITAL INPUT AND OUTPUT
What is digital input or digital output?
Ref: allaboutcircuits.com
LAB 1-ON LED
Resistor
LED
Lab1- ON led
DIGITAL INPUT AND OUTPUT
We begin with assign constant “led” and connect to
digital pin 13
Don’t forget to put
semicolon
data type Constant Pin
number(hardware)
What does these means?
*Note: The programmable LED in
hardwired to pin 13 on the board.
Lab1- ON led
DIGITAL INPUT AND OUTPUT
Void setup, means there are no return variables in the loop
As you can see, the word
colour change to Blue
Orange color
means the word
is predefined in
the library Next, we create the setup loop.
Format
pinMode(constant name / pin# , behaviour)
What does these means?
In setup loop, normally we put the hardware configuration and assign variables,
input/output pin and etc
Lab1- ON led
DIGITAL INPUT AND OUTPUT
Void loop is mandatory.
Endless loop. While(1)
Format:
digitalWrite(pin# or constant,behaviour)
Then, we create the main loop. This loop
is mandatory. Inside this loop, we can put
endless loop while(1).
Why digital write?
Digital write means, we set 5V at corresponding pin. Here
the digital pin is #13.
Lab1- ON led
Overall source code
DIGITAL INPUT AND OUTPUT
Summary:
Now you should know the basic
structure when program the
arduino.
Step 1: //assign any constant here.
Step 2: void setup(){
//your program here
}
Step 3: void loop(){
//your program here
}
Get it? Now let’s download the
source code into your arduino.
Lab1- ON led
DOWNLOADING….
How to install the driver???
Connect your arduino to the computer
Step 1: Install driver to your PC. USB port…
Open,device manager..To see which
com port of your arduino.
The computer found
the arduino
controller
DOWNLOADING…
Lab1- ON led
.
Choose your correct board..
Lab1- ON led
DOWNLOADING…. Select Com port
DOWNLOADING…
Lab1- ON led
.
Compile your source code..
Checking the errors..
Click here to download the
code.
Click here to compile your
source code.
If no error, you should get this
notification
LAB 2-LED BLINKING
Resistor
LED
Lab 2: Blinking LED
NOW, THAT’S THE BASIC..LET’S MOVE
TO THE NEXT LAB..
Add a delay function inside the loop.
Format:
delay(x);
Where x is value in mili
seconds
DONE.. Easy
LAB 3-BUZZER BEEPING
BUZZER
LED
LED AND BUZZER AS OUTPUT
LAB 4-LDR ANALOG READ SERIAL
LED
LDR
Resistor
LDR- LIGHT DEPENDENT
RESISTOR
LAB 5-SMART LAMP
LED
LDR
Resistor
SMART LAMP/LED
LAB 6- READ A SWITCH
LED
SWITCH
BUZZER
READ A SWITCH
LAB 7 – SPINNING A MOTOR
MOTOR 2 MOTOR 1
2A MOTOR SHIELD
SPINNING A MOTOR
LAB 8 – LINE TREKKING ROBOT
MOTOR 2 MOTOR 1
2A MOTOR SHIELD
LINE TREKKING ROBOT
THANK YOU
KAMALLUDIN BIN MANSOR
GENERAL MANAGER
kamalludin.circuitideas@gmail.com
019-2396672
+603-21410787 (office)
+603- 21410722(fax)