You are on page 1of 91

ARDU 2005 Arduino-based Multifunction

Mobile Ground Robotics

Instructor

Dafizal Derawi
PhD candidate (UTM), B. Eng with Honours (Australia)
CEO of Drabot
Founder of Arduino Drabot Community

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Dafizal Derawi
• CEO, Robotic Systems Enterprise
• Founder of Arduino Drabot Community

 PhD candidate, Universiti Teknologi Malaysia (UTM), 2013 –


present.
 Research Visitor, Autonomous Control Systems Laboratory,
Chiba, Japan, Dec 2014 – Dec 2015.

 Research Assistant, Computer Vision & Robotic Research


Group, Australian National University (ANU), 2012
 Tutor, Introduction to Electronics course, Research School of
Engineering, Australian National University (ANU), 2012
 Bachelor of Engineering with Honours majoring in
Mechatronic Systems, ANU, 2011

 Diploma in Electrical Engineering (Mechatronics) with Vice


Chancellor Award, UTM, 2009
 Founder & President of Research & Innovation Club (RIC),
UTM KL, 2008

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Our activities….
www.facebook.com/drabot.robotics

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Store Department (Online Shop)
https://www.facebook.com/pg/drabot.robotics/shop/

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
“Learn how to be a developer,
rather than a user!”

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 1
UNMANNED GROUND
VEHICLE (UGV)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Introduction
• An unmanned ground vehicle (UGV) is a
vehicle that operates while in contact with the
ground and without an onboard human
presence (pilot).

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
A Gladiator Tactical Unmanned Ground Vehicle

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Remote-Operated
• controlled by a human operator via interface.
• actions are determined by the operator based
upon either direct visual observation or
remote use of sensors such as digital video
cameras.

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Autonomous
• Guardium used by the Israel Defense Forces to
operate as part of the border security
operations.
• uses its sensors to develop some limited
understanding of the environment, which is
then used by control algorithms to determine
the next action to take in the context of a
human provided mission goal

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 2
INTRODUCTION TO
ARDUINO

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
2.1 What is Arduino?
• Google now!!!!

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
2.1 What is Arduino?

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
More details…
• www.arduino.cc
• Training module

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Comparison…
• Parallax Basic Stamp, Netmedia's BX-24, MIT's Handyboard,
and many others offer similar functionality.

• BUT, Arduino:
– Inexpensive
– Cross-platform: Windows, Macintosh OSX, and Linux
operating systems
– Simple, clear programming environment
– Open source and extensible software
– Open source and extensible hardware

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Complete
Arduino-based
system overview

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
2.2.1 Arduino UNO (USA only) &
Genuino UNO (outside USA)

Arduino UNO (USA only) &


Genuino UNO (outside USA).

The price is around RM 96 -


RM 105

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Technical Specification

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
2.2.2 UNO compatible board
(used in this course)

DRABOT UNO
PRODUCT CODE: 201603032

PRICE: RM 40 ONLY

- Arduino Uno R3 Compatible


- USB Type A to B connector
(USB Cable is given)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Arduino UNO vs UNO compatible board

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
1.3 Arduino Software (IDE)
• You can tell your Arduino what to do by
writing code in the Arduino programming
language and using the Arduino development
environment.
• You can download Arduino Software from
– https://www.arduino.cc/en/Main/Software
• For those attend this course, please find
Arduino software inside the Software folder

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 3 COMPONENTS
& ELECTRICAL
FUNDAMENTAL

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
• Open picture of overall system in your training
module folder…

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Arduino Sensor Shield v5.0

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Ultrasonic HC-SR04

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Servo motor (9g Micro Servo)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Bluetooth Transceiver HC-05

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Motor Driver L298N

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
DC Brush Motor

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Compass Module

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Infrared Sensor (IR sensor)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Infrared Receiver & Transmitter
(Remote Control)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Battery

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Electrical Fundamentals

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Analog to Digital Converter
(ADC)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Pulse Width Modulation (PWM)
• To control speed.
• Increase PWM value in order to increase
speed.
• PWM value: 0 – 255 only!!!!

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Serial Communication

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 4
ARDUINO PROGRAMMING
LANGUAGE

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Introduction
• The Arduino language is based on C/C++.
Arduino programs.
• Three main parts:
1) Basic
2) Variables and constants
3) Functions
4) Control Structure

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Basic

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Syntax

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
#include
• #include is used to include outside libraries in your sketch. This
gives the programmer access to a large group of standard C libraries
(groups of pre-made functions), and also libraries written especially
for Arduino.

• Similar to #define, has no semicolon terminator, and the compiler


will yield cryptic error messages if you add one

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
#define
• #define is a useful C component that allows the programmer to give
a name to a constant value before the program is compiled.

• Syntax:

#define constantName value


//Note that the # is necessary

• Example:

#define ledPin 3
// The compiler will replace any mention of ledPin with the
// value 3 at compile time

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Maths operators

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Comparison operators

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Compound operators
• x++ means x = x+ 1
• x-- means x=x-1

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Variables

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Data Type RAM Number Range

void keyword N/A N/A

boolean 1 byte 0 to 1 (True or False)

byte 1 byte 0 to 255

char 1 byte -128 to 127

unsigned char 1 byte 0 to 255

int 2 byte -32,768 to 32,767

unsigned int 2 byte 0 to 65,535

word 2 byte 0 to 65,535

long 4 byte -2,147,483,648 to 2,147,483,647

unsigned long 4 byte 0 to 4,294,967,295

float 4 byte -3.4028235E+38 to 3.4028235E+38

double 4 byte -3.4028235E+38 to 3.4028235E+38

string 1 byte + x Arrays of chars

array 1 byte + x Collection of variables

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Functions: Digital

Write this in Write this in


Initialize this in void loop() void loop()
void setup() This function for This function for
Digital Output Digital Input

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Functions: Analog Input &
PWM (a.k.a Analog Output)

NO Initialization in Write this in Write this in


void setup() void loop() void loop()
This function for This function for
PWM Analog Input
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Control Structure
• Control structure
– if
– if…..else
– for
– while
– do…while

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
if
• if, which is used in conjunction with a comparison
operator, tests whether a certain condition has been
reached, such as an input being above a certain
number.

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Format

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
if…else
if (pinFiveInput < 500)
{
// action A
}
else
{
// action B
}

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
if (pinFiveInput < 500)
{
// do Thing A
}
else if (pinFiveInput >= 1000)
{
// do Thing B
}
else
{
// do Thing C
}

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
for
• To repeat a block of statements enclosed in curly braces.
• An increment counter is usually used to increment and
terminate the loop.
• Useful for any repetitive operation, and is often used in
combination with arrays to operate on collections of
data/pins

• There are three parts to the for loop header:

for (initialization; condition; increment) {


//statement(s);
}

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 5
GETTING STARTED
(WINDOWS)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
1) Get an ARDUINO UNO / UNO
compatible board and USB cable

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
2) Download and install the
Arduino Software (IDE)
• https://www.arduino.cc/en/Main/Software
• You can choose between the Installer (.exe) and the Zip packages.
• We suggest you use the first one that installs directly everything
you need to use the Arduino Software (IDE), including the drivers.
• With the Zip package you need to install the drivers manually.
• For those attend this course, please find the Arduino Software
inside the Software folder. You don’t need to download this
software.

• When the download finishes, proceed with the installation and


please allow the driver installation process.

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
3) Install the board drivers
• UNO compatible board user (used in this
module)
– You may have to install extra drivers for CH340.
– For those attend this course, please find this
driver inside the Software folder. You only need
to double click on the driver file and then
Windows will finish up the driver installation
from there

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
4) Connect the board
• The USB connection with the PC is necessary to
program the board and not just to power it up.
• The Uno and Mega automatically draw power from
either the USB or an external power supply.
• Connect the board to your computer using the USB
cable. The power LED should go on.

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
5) Launch the Arduino Software (IDE)

• Double-click the Arduino icon (arduino.exe)


created by the installation process. (Note: if
the Arduino Software loads in the wrong
language, you can change it in the preferences
dialog. See the Arduino Software (IDE) page
for details.)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
6) Open the blink example
• File > Examples >01.Basics > Blink

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
7) Select your board

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
8) Select your serial port
• Select the serial device of the board from the
Tools | Serial Port menu.
• This is likely to be COM3 or higher (COM1 and
COM2 are usually reserved for hardware serial
ports).

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
9) Upload the program
• click the "Upload" button in the environment.
• Wait a few seconds - you should see the RX
and TX leds on the board flashing.
• If the upload is successful, the message "Done
uploading." will appear in the status bar.

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Congratulation!!!

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 6
TUTORIAL
(refer module)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 6
TUTORIAL
(refer module)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
CHAPTER 7
Project
(refer module)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
THANK YOU!!!!
training@drabot.com
011-10880900
(WhatsApp/SMS)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Utusan, 17 Jan 2017
http://www.utusan.com.my/sains-teknologi/teknologi/drabot-bangkit-minat-robotik-1.432619

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics
Drabot in Metro Ahad today (4 Dec 2016)

www.drabot.com Robotic Systems Enterprise - Arduino Drabot Community - Expert in Aerial Robotics

You might also like