ieee robotics
Post on 05-Apr-2018
228 Views
Preview:
TRANSCRIPT
-
7/31/2019 IEEE Robotics
1/38
7/20/20
IEEE Iraq section: Introduction to
robotics
In this course we cover the following topics:
What is a robot
Differences between mechatronic and robotics
Micro controllers and the Arduino programminglanguage
Sensors and motors
Control systems and land stations
International robotic projects
Ethics
Introduction
(Lecture 1)
Dr. George T.
Mr. Rezhan S.
In this lecture we will cover
What is a robot
What are the differences between
Mechatronics and Robotics
Robot is an Input Process Output system
Introduction to electronics
Learning outcomes
The aim of this lecture is to help students gain an understanding of
what is a robot, the differences between mechatronic and robotics
systems and basic concepts of electronics
Definitions
The Word Robot
Robot is derived from the Czech word Robota,
meaning
labor
First appeared in a 1920 play R.U.R.
(Rossums Universal Robots)
According to the Robot Institute of America (1979) a robot is:
A reprogrammable, multifunctional manipulator designed to move
material, parts, tools, or specialized devices through various programmed
motions for the performance of a variety of tasks
What is a Robot?
The International Standard Organisation defines a "robot" as:
An automatically controlled, reprogrammable, multipurpose, manipulator
programmable in three or more axes, which may be either fixed in place or
mobile for use in industrial automation applications.
-
7/31/2019 IEEE Robotics
2/38
7/20/20
A Robot must have the following properties
Artificially created.
Can sense its environment.
Can manipulate things in its environment.
Be Autonomous, ability to make choices basedon the environment, or automatic control.
Is programmable.
What is a Robot?
Mechatronics is a multidisplinary between mechanical, electronics and computer
engineering.
Robotics is part of Mechatronics
The main difference is inputs are "provided" to mechatronics systems whereas robotics
systems "acquire" inputs by their own.
Mechatronics system is provided with inputs whereas robotics system acquires inputs by their own
Mechatronics system is automatic whereas robotics system is autonomous
Robotics system does not necessary have a human look to be a robotics system, but whether it will
think differently with human look is a different story
MECHATRONICS VS ROBOTICS
Automatic VS Autonomus
http://www.ronynovianto.com/index.php/web
log/4-uncategorised/7-mechatronics-vs-
robotics-automatic-vs-autonomous
For example, most traffic lights and washing machines aremechatronics system. Human presses button at traffic light whenthey want to cross the street and at washing machine to settemperature, time, etc in washing machine. Even if the traffic lightswork automatically without any buttons are pressed, it is still amechatronics system because the input (e.g. time to change thelights) is provided. This process is called automatic.
In contrast, if the traffic light uses a camera and moves its camera todetect people who want to cross the street and change its lightsaccordingly, it is then a robotics system. This process is calledautonomous.
MECHATRONICS VS ROBOTICS
Examples
http://www.ronynovianto.com/index.php/web
log/4-uncategorised/7-mechatronics-vs-
robotics-automatic-vs-autonomous
Is a Robot an IPO system?
Robots are Input Process Output systems.
Input: sensors, network, other devices
Process: microcontroller, PC, Landstation
Output: motors, screens, other devices
Application of Robotics
Manipulators
Entertainment
Production Lines
Exploration
EducationHousework
DefenseMedical
Basic concepts of electronics
The materials used in this section were taken from
http://library.thinkquest.org/16497/intro/index.html
http://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://library.thinkquest.org/16497/intro/index.htmlhttp://library.thinkquest.org/16497/intro/index.htmlhttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomoushttp://www.ronynovianto.com/index.php/weblog/4-uncategorised/7-mechatronics-vs-robotics-automatic-vs-autonomous -
7/31/2019 IEEE Robotics
3/38
7/20/20
Atoms and Electrical Charge
Everything is made out of Atoms
Atoms made up of protons, neutrons, and electrons
Electrons have negative (-) charge
Protons have the same amount of charge like the
electrons but they have positive (+) charge Neutrons are electrically neutral and have no charge
Particles with the same charge will repel and
particles with different charges will attract.
Electricity is the flow of electrons , hence the amount of electricity depends on the charge.
The basic unit for measuring charge i s the coulomb or the letter C.
1 coulomb is equal to the charge of 6,250,000,000,000,000,000 electrons.
1C = 6.25x10^18 electrons
Electric current is the amount of electrons, or charge, moving past a point
every second.
The faster the electron flow, the higher the current.
Current
Current is represented by the l etter I. The basic
unit for measuring current is ampere. Ampere
can be abbreviated to amp or just A.
1 amp = 1 coulomb/sec
Meaning for every amp, there are 6.25x10^18 electrons moving past a point every second.
Voltage is the difference between the high potential and the low potential.
High potential is the site with more electrons and low potential is the site
with less electrons.
The higher the difference is, the higher the voltage.
Voltage can be thought of as the measure of the pressure pushing the
electrons. The higher the pressure, the higher the voltage.
Voltage is represented by the letter E. The basic unit of measure is volts or the
letter V. One volt will push 1 amp of current through 1 ohm of resistance.
Voltage
Power is simply the amount of energy used
Power is represented by the letter P. The basic unit for measuring power is
watts or the letter W.
P=EI
Power = voltage * current
Power
Flow of electrons
When an electron is knocked out of an atom, it will fly off and hit another atom. If
the electron strikes the atom with enough force, it will knock off another electron.The atom that was just knocked off will hit another atom and so forth.
Every time an electron strikes another, it is transferring its energy.
Some of the energy is converted into heat every time it is transferred.
The voltage will drop as the energy is transferred over long distances.
Some materials - such as copper and silver - does not hold on to its electrons
very tightly. Therefore it doesn't require much energy to knock off anelectron. These materials are called conductors and has a very low resistanceto electron flow.
Materials such as clay and plastics hold on to their electrons more tightly thanconductors. It takes more energy to knock off an electron from thesematerials. These materials are called insulators and has a high resistance toelectron flow.
Also the length of that the electrons have to travel effect the resistance as itsreduces the voltage.
Resistance is represented by the letter R. The basic unit of measure is ohmor the symbol (Greek omega).
Resistance
-
7/31/2019 IEEE Robotics
4/38
7/20/20
Ohms law give us the mathematical relationship between current,
voltage, and resistance.
Ohms Law
E=IR
where E = voltage, I = current, and R = resistance
Resistors resist the flow of electrons.
Resistors
The color bands around the resistors are color codes that
tell you its resistance value.
The tolerance bands indicates the accu racy of the values.
The first two color bands from the left are the
significant figures - simply write down the numbers
represented by the colors. The third band is the
multiplier - it tells you how many zeros to put after the
significant figures. Put them all together and you have
the value.
The total watt resistor in a circuit MUST be less than the watt of power flowing,
Else there will be no flow.
Resistors in series and in parallel
A series circuit means connecting components one after the other. So when we say
"Resistors in series", we mean connecting one resistor after the other:
The total resistance is the summary of the resistance in
series. For example R=R1+R2
In parallel, means connecting components side by side. The result is the total
resistance being lower than the lowest resistor.
The total resistance can be found by multiplying all
the resistances and divide them with their summary.For example R=(R1*R2)/(R1+R2)
Capacitors
Capacitors can be thought of as tiny rechargable batteries -- Capacitors can be charged and
discharged. The amount of charge that a capacitor can hold is measured in Farads or the letter F.
However, 1F is too large for capacitors, so microfarads(F) and picofarads(pF) are used. micro =
1/1,000,000 and pico = 1/1,000,000,000,000
The most commonly used capacitors are Ceramic and Electrolytic.
Ceramic capacitors are brown and has a disc shape. These capacitors are
non-polarized, meaning that you can connect them in any way. The codingis just like the resistor color codes except that they used numbers instead
of colors. The first 2 digit are the significant figures and the third digit is
the multiplier. These capacitors are measured in pF.
Electrolytic Capacitors has a cylinder shape. These capacitors arepolarized so you must connect the negative side in the right place. The
value of the resistor as well as the negative side is clearly printed on the
capacitor. These capacitors are measured in F.
Capacitors in series and in parallel
When capacitors are in series, th e total capacitance in a capacitor series circuit is less
than the lowest capacitor in the circuit.
The total capacitance is Ct = (C1 * C2) / (C1 + C2)
If the capacitors are in parallel then their total capacitance can be found by adding
them.
The total capacitance is Ct = C1 + C2
Diodes
There are basically three different types of diodes: Diodes, Zener Diodes, and Light Emitting
Diodes (LED).
Diodes let electrons flow through them only in one direction. Diodes
flow from cathode to anode. The cathode side of the diode is marked
with a band around it
Zener diodes have a set voltage rating. When a voltage exceeds the
voltage rating going the opposite direction (from anode to cathode), the
diode allows the electrons flow.
Light Emitting Diodes (LED for short) are just like the regular diodes except
that it lights up when electrons are flowing through. Note: there aren't any
bands to identify which pin is anode and which is cathode. However, one pin
is longer then the other. The longer pin is the anode, the positive side.
-
7/31/2019 IEEE Robotics
5/38
7/20/20
Switches
Switches connects and disconnect a circuit. There are 3 commonly used configurations:
SPST, SPDT, and DPDT.
SPST = Single Pole, Single Throw
This is a two terminal switch that opens and closes a circuit.
SPDT = Single Pole, Double Throw
This is a three terminal switch that connects one terminal to either
of the other two.
DPDT = Double Pole, Double Throw
This is a six terminal s witch that connects a pair of terminals to
either of the other two pairs.
Relay
A relay is an electrically operated switch. Many relays use
an electromagnet to operate a switching mechanism mechanically, but
other operating principles are also used. Relays are used where it is
necessary to control a circuit by a low-power signal (with complete
electrical isolation between control and controlled circuits), or where
several circuits must be controlled by one signal. Relays were used
extensively in telephone exchanges and early computers to perform
logical operations.
The key idea behind the relay is that when a small amount of
electricity pass through will create a magnetic field. This magnetic
field will attract the metal and allow it to open or close a circuit.
This way with small amount of electricity we can close or open a
circuit of any voltage and current.
Thyristor
A thyristor is a solid-state semiconductor device with four layers of alternating N and P-
type material. They act as bistable switches, conducting when their gate receives a
current trigger, and continue to conduct while they are forward biased. Thyristors can
be used as relays. Their main difference is that they are solid-state devices, whereas
relays are electromechanical devices
Transistors
Transistors are used as switches and amplifiers. We will discuss two
types of transistors: PNP and NPN transistors. Both of these transistors
has 3 pins: emitter, base, collector.
NPN transistors are used as amplifiers. Various configurations of single transistor
amplifier are possible, with some providing current gain, some voltage gain, andsome both.
Transistors are commonly used as electronic switches, both for high-
power applications such as switched-mode power supplies and for
low-power applications such as logic gates.
Intergraded Circuits
Integrated circuits (IC) are usually referred to as chips. Inside them is a
tiny piece of semiconductor(usually silicon) with large circuits built in.
There are millions of different integrated circuits. The general types ofintegrated circuits include:
Logic circuits -
These IC's are basically decision makers. most contain logic gate circuits. (logic gates will bediscussed in a later section).
Comparators -
These IC's compare inputs and gives an output.
Operational Amplifiers -
These are amplifiers. Works very much like transistor amplifier circuits.
Timers -
These are counting IC's used for circuits that counts or needs to keep track of time.
Switches -
Switching IC's are also very much like the switching circuits of transistors.
Others
Gates
Gates are logic circuits. They take binary inputs and gives out a binary result. 1(one) is
represented by a positive electrical value and 0(zero) is represented by no electricity at all.
AND gate -
To get an output of 1, both inputs must be at a value of 1.
OR gate -
To get an output of 1, one or more inputs must be at a value of 1.
NOT gate -
To get an output of 1, its input must be at a value of 0.
This gate only has one input. It is also known as an inverter circuit.
NAND gate -
To get an output of 1, one or more of its inputs must be at a value of 0.
NOR gate -
To get an output of 1, all inputs must be at a value of 0.
http://en.wikipedia.org/wiki/File:Thyristor_circuit_symbol.svghttp://en.wikipedia.org/wiki/File:Relay_symbols.svg -
7/31/2019 IEEE Robotics
6/38
7/20/20
The key points of this lecture
What is a robot
What are the differences betweenMechatronics and Robotics
Robot is an Input Process Output system
Applications of Robotics
Basic concepts of electronics
In the next Lecture
We are going to visit Micro Controllers (The
brain of the robots) Learn how to program them
Learn about digital and analog input and
output
Cover the basic commands of the Arduino
Language
Introduction to
Micro-Controllers
(Lecture 2)
Dr. George T.
Mr. Rezhan S.
Topics covered
in the previous lecture
What is a robot
What are the differences between
Mechatronics and Robotics
Robot is an Input Process Output system
Applications of Robotics
Basic concepts of electronics
In this lecture
What is a microcontroller Properties of the microcontrollers
How they can be programmed
The Arduino microcontroller
An overview of the Arduino programming language
Learning outcomes
The aim of this lecture is to help students gain an understanding of
micro-controllers and how to programme them.
Students will familiarise them self's with the Arduino micro
controllers and how to programme them.
-
7/31/2019 IEEE Robotics
7/38
7/20/20
What is a microcontroller?
According to Wikipedia:
A microcontroller (sometimes abbreviated C, uC or MCU) is a smallcomputer on a single integrated circuit containing a processor core, memory,
and programmable input/output peripherals.
Microcontrollers are designed for embedded applications, in contrast to
the microprocessors used in personal computers or other general purpose
applications.
Microcontrollers are the brains of the robots
They host the software that control the robot Each robot has at least one microcontroller
Each microcontroller maybe responsible for controlling a
number of input and/or output devices (e.g sensors and
motors)
Microcontrollers within a system may work individually or
collaborate with each other
Microcontrollers within Robots
Microcontrollers host the software responsible for controlling the input
and output devices
They may host complex algorithms responsible for performing a variety of
tasks
Microcontrollers have limited storing capabilities so the size of the
application that it can store is limited by its memory.
Have limited processing power compere to PCs
Hosting Software
Some robots may have more than one microcontrollers. Each microcontroller can beresponsible for a different function or group of functions.
For example a humanoid robot can have a microcontroller for controlling the movements ofthe hand, another for each leg, another for the head and so on.
Distributing tasks over more than one microcontrollers offers modularity and has a numberof benefits such as:
Easier to programme, maintain, upgrade and troubleshoot.
Higher degree of availability. In case of a damage on ly the tasks performed by damagedmodule will stop while the robot will be able to perform the rest of the tasks (as long asthey are not depended to the broken module)
Faster development and better specialization, as multiple teams can work on differentmodules of the same robot.
The main drawbacks are higher development cost and communication overhead.
Distribution of Responsibilities
Microcontrollers can communicate with each other directly, via a serverusually hosted in a land station
Direct communication can be achieved via serial/paralel connection, vianetwork or via the environment
An example of communication via the environment is a robot talking toanother robot. The listener can understand what speaker robot by the use of avoice recognition software. Another example is, a robot waving to anotherrobot. The target robot can understand this by the use of a kinet and respondaccordingly.
Indirect communication of two microcontrollers includes two directcommunications one between the sender and the server and one betweenthe server and the receiver.
Communication
Robo Kurd is a robot developed by the
students of Computer Science InstituteSuleimanyah. The robot can participate in a
conversation and move parts of its body
accordingly. Robo Kurd is an example of
distribution of responsibilities and
collaboration between micro controllers.
Robo Kurd uses a total of 6 micro
controllers, 5 in an Adruino min board and 1
Arduino Uno board as well as a PC for
Central control and heavy operations and
internet connectivity. Each microcontroller
is responsible for caring out specific tasks.
The Robo Kurd example
-
7/31/2019 IEEE Robotics
8/38
7/20/20
Two microcontrollers in Arduino Mini are
responsible for moving the 12 servo motors
of the two hands. These twomicrocontrollers are directly connect via the
serial communication with two Arduino mini
responsible for controlling them and the
servo for of the rest of the hand. These two
are directly connected (via serial) with a
micro controller in an Arduino Uno
responsible for controlling them, the
Arduino mini responsible for the head
movements, the servo motors responsible
for moving the middle and the back of the
robot as well as the PC.
The Robo Kurd example
Arduino
Mini
Arduino
Mini
Arduino
Mini
Arduino
Mini
Arduino
Mini
Arduino
Uno
PC
Microcontrollers can be programmed with the help of Programming
Environments. These are software tools that allow programmers to describe
step by step how a robot will perform a task. This can be done by use of visualor textual language.
Programming Environments can also compile the s olution and upload it to the
microcontroller. The microcontroller can only run complied files and not
source code.
Some programming environments are highly sophisticated and offer a lot
services to the users such as syntax testing, code autocompleting, runtime
testing and monitoring and so on while others are simple compilers.
Programming Environments
Analog and Digital IO
Microprocessors can interact with sensors and output devices via their Analog and
Digital ports.
The Analog port can receive or transmit different values of electric current. This is then
converted as a binary value. The range of this value depends on the bits of the CPU of
the microprocessor. For example Arduino Uno has a 16 Bit CPU. With 16 Bits we can
represented values from 0-1024. So the Analog port of Arduino Uno can receive or
transmit values from 0-1024. Potentiometer, Flex, Thermometer and other sensors are
Analog so they should be connected to the Analog port.
The digital port can receive and transmit binary data. It can also keep a constant state
of High or Low. When se to High they provide small values of electric current. This can
be used to enable an electronic switch or power a led. Servos and Step motors aresome example of devices that are controlled via the digital ports.
The Arduino boards
Arduino Uno
Arduino Mini
Arduino Pro
The Arduino Uno
with ATmega328
Summary
The Arduino Uno
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory32 KB (ATmega328) of which 0.5 KB used
by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
http://arduino.cc/en/Main/ArduinoBoardUnohttp://arduino.cc/en/Main/ArduinoBoardProhttp://arduino.cc/en/Main/ArduinoBoardProhttp://arduino.cc/en/Main/ArduinoBoardProMinihttp://arduino.cc/en/Main/ArduinoBoardUno -
7/31/2019 IEEE Robotics
9/38
7/20/20
An overview of the Arduino
programming language
More at
http://arduino.cc/
en/Reference/Ho
mePage
The Arduino
Programming Environment
Structure and syntax The basic structure
Define variables and
objects here.
Setup variables and
objects here.
Put the logic here.
Camel case
The Arduino programming language is case sensitive and it is using ca mel case writing.
In camel case, the first word start with lower case character and the following words with
upper case and there are no gaps between the words.
Example: Digital Write In camel case is digitalWrite
Java is also using camel case writing.
Data Types (1/2)void
Only used for function declaration when the function returns no value
booleanTrue or False
char
A data type that takes up 1 byte of memory that stores a character value. Character literals are written in single
quotes, like this: 'A' . You can see the specific encoding in the ASCII chart. This means that it is possible to do
arithmetic on characters, in which the ASCII value of the character is used (e.g. 'A' + 1 has the value 66, since the
ASCII value of the capital letter A is 65). The char datatype is a signed type, meaning that it encodes numbers from
-128 to 127.
unsigned char
The unsigned char datatype encodes numbers from 0 to 255. Try to use byte instead.
byte
A byte stores an 8-bit unsigned number, from 0 to 255.
int
Integers are your primary datatype for number storage, and store a 2 byte value. This yields a range of -32,768 to
32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).
unsigned int
Unsigned ints (unsigned integers) are the same as ints in that they store a 2 byte value. Instead of storing negative
numbers however they only store positive values, yielding a useful range of 0 to 65,535 (2^16) - 1).
word
A word stores a 16-bit unsigned number, from 0 to 65535. Same as an unsigned int.
http://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePage -
7/31/2019 IEEE Robotics
10/38
7/20/20
Data Types (2/2)long
Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to
2,147,483,647.
unsigned long
Unsigned long variables are extended size variables for number storage, and store 32 bits (4 bytes). Unlike standard
longs unsigned longs won't store negative numbers, making their range from 0 to 4,294,967,295 (2^32 - 1).
float
A number that has a decimal point. Floating-point numbers can be as large as 3.4028235E+38 and as low as -
3.4028235E+38. They are stored as 32 bits (4 bytes) of information. Floats have only 6-7 decimal digits of precision.
Unlike other platforms, where you can get more precision by using a double (e.g. up to 15 digits), on the Arduino,
double is the same size as float.
double
Identical to float. Double precision floating point number. Occupies 4 bytes.
array
An array is a collection of variables that are accessed with an index number.
stringchar array
It makes a string out of an array of type char and null-terminate it.
Stringobject
Allows you to use and manipulate strings of text in more complex ways than character arrays do. You can
concatenate Strings, append to them, search for and replace substrings, and more. It takes more memory than a
simple character array, but it is also more useful.
Operators
The if statement
Declare an integer with the name
val and assign it the value 30
If val is more than 30 then
Else.
Complex if statments
If
val1 is 30 OR val1 IS NOT 99
AND
Val2 is 20
For loop While loop
Syntax
while(expression){ // statement(s) }
Parameters
expression - a (boolean) C statement that evaluates to true or
false
Example
var = 0;
while(var < 200)
{
// do something repetitive 200 times
var++;
}
-
7/31/2019 IEEE Robotics
11/38
7/20/20
Do While loop
Syntax
do { // statement block } while (test condition);
Exampledo {
delay(50); // wait for sensors to stabilize
x = readSensors(); // check the sensors
} while (x < 100);
ArraysAn array is a collection of variables that are accessed with an index number. Arrays in the C
programming language, on which Arduino is based, can be complicated, but using simple arrays is
relatively straightforward.
Creating (Declaring) an Array
All of the methods below are valid ways to create (declare) an array.
int myInts[6];
int myPins[] = {2, 4, 8, 3, 6};
int mySensVals[6] = {2, 4, -8, 3, 2};
char message[6] = "hello";
Accessing an Array
All of the methods below are valid ways to create (declare) an array.
Arrays are zero indexed, that is, referring to the array initialization above, the first element of the array
is at index 0, hence
mySensVals[0] = 2, mySensVals[1] = 4, and so forth. OR int myArray[10]={9,3,2,4,3,2,7,8,9,11};
Reading from an Array
int val = mySensVal[0];
Functions
A function is similar to a machine. It takes some input, it process it and return some
output (if not void).The following shows the syntax of a function.
int nameOfFunction(parameter1,parameter2,parameterN){
// do something
Return 0; // this should return the same data type with the function or nothing if void.
}
Example
int addTwoNumbers(int a,int b){
return a+b;
}
Math
min(number1,number2) Calculates the minimum of two numbers.
max(number1,number2) Calculates the maximum of two numbers.
abs(number) Computes the absolute value of a number.
pow(base, exponent) Calculates the value of a number raised to a power.
sqrt(number) Calculates the square root of a number.
Trigonometry
sin(rad) Calculates the sine of an angle (in radians). The result will be between -1 and 1.
cos(rad) Calculates the cos of an angle (in radians). The result will be between -1 and 1.
tan(rad) Calculates the tangent of an angle (in radians). The result will be between
negative infinity and infinity.
Random Numbers
random(min,max) The random function generates pseudo-random numbers.
Time
millis()
Returns the number of milliseconds since the Arduino board began running the current
program. This number will overflow (go back to zero), after approximately 50 days.
micros()
Returns the number of microseconds since the Arduino board began running the current
program. This number will overflow (go back to zero), after approximately 70 minutes.
delay()
Pauses the program for the amount of time (in miliseconds) specified as parameter.
(There are 1000 milliseconds in a second.)
delayMicroseconds()
Pauses the program for the amount of time (in microseconds) specified as parameter.
There are a thousand microseconds in a millisecond, and a million microseconds in a
second.
Serial portUsed for communication between the Arduino board and a computer or other
devices.
Functionsbegin() Start the serial communication at a given speed, e.g. 9600.
end() Stop the communication.
available() Get the number of bytes (characters) available for reading from the serial port.
read() Read data from the serial port.
peek() Returns the next byte (character) of incoming data without removing it from the internal buffer
flush() Flushes the buffer of incoming serial data.
print() Prints data to the serial port as human-readable ASCII text.
println() Like print() but it includes a new line character at the end.
write() Writes binary data to the serial port. This data is sent as a byte or series of bytes.
-
7/31/2019 IEEE Robotics
12/38
7/20/20
Analog port
Functions
analogReference(int volt)Configures the reference voltage used for analog input.
analogRead(int pin)
Reads the value from the specified analog pin.
analogWrite(int pin, int PWM)
Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or
drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady square
wave of the specified duty cycle until the next call to analogWrite() (or a call
to digitalRead() or digitalWrite() on the same pin). The frequency of the PWM signal is approximately
490 Hz.
Digital port
Functions
pinMode(int pin, INPUT | OUTPUT)Configures the specified pin to behave either as an input or an output.
digitalRead(int pin)
Reads the value from a specified digital pin, either HIGH or LOW.
digitalWrite(int pin, HIGH | LOW)
Writes a HIGH or LOW to a specified digital pin.
An overview of the Arduino
programming language
More at
http://arduino.cc/
en/Reference/Ho
mePage
The key points of this lecture
What is a microcontroller
How it can be programmed
The Arduino microcontroller
An overview of the Arduino programming language
Practical Session 1
In this session you will familiarize your self
with the Arduino boards and the Arduino
programming language.
Connecting Arduino UNO with a PC
1) Copy the Arduino folder to the local drive
2) Connect Arduino via the USB cable
3) When you are prompted to provide the
location of the driver, select:
4) (local Drive)\Arduino\Driver
5) To test it, open the Arduino IDE and try to
upload some code.
http://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePage -
7/31/2019 IEEE Robotics
13/38
7/20/20
Exercises (Basic commands)
1) Write a program that sends to the serial port theresult of the addition of two integers a and b;
2) Change the above code, so it sends to the serialport the integer with the biggest value.
3) Change the above code, so that it operates only ifit receive a character p from the serial port.
4) Use the for loop to print the output of an array xwith values {1,3,4,7}. The results should be sendwith 1 second delay.
5) Write a function that adds two numbers andprint out the result.
Arduino programming language
Using LEDs
Traffic Light exercise
Design a traffic light system using three LEDs, three
resistances and one Arduino Uno
Introduction to
Sensors
(Lecture 3)
Dr. George T.
Mr. Salar Kh.
Mr. Rezhan S.
Topics covered
in the previous lecture
What is a microcontroller
Properties of the microcontrollers
How they can be programmed
The Arduino microcontroller
An overview of the Arduino programming
language
In this lecture
What is a Sensor What are the differences between Analog and Digital
Cover a variety of sensors
Example of a custom sensor
Sensor deviations
http://www.ebay.com/itm/Arduino-Ultrasonic-Module-Range-Detection-Sensor-HCSR04-/180656418260?pt=LH_DefaultDomain_0&hash=item2a0ff62dd4 -
7/31/2019 IEEE Robotics
14/38
7/20/20
Learning outcomes
The aim of this lecture is to help students gain an understanding of
sensors and their applications.
In the practical sessions student will learn how to connect sensors
with arduino and how to programme it.
What is a sensor?
The word sensor, it is the noun of the word sense. So it is a device that can
sense.
According to Wikipedia:
A sensor (also called detector) is a device that measures a physical quantity
and converts it into a signal which can be read by an observer or by an
instrument.
Sensors in nature
Humans, animals and plants can sense their environment. These senses
include but not limited to visual, smell, acoustic, touch, taste, emotions and
meta physical senses (e.g. some people can fell when somebody is looking at
them).
So far, only few of these can be artificially simulated, but science is progressing
so maybe in the near future we can see robots that can simulate senses such
as emotions and so on.
Detection theoryAccording to Wikipedia:
Detection theory, or signal detection theory, is a means to quantify the ability to discern
between signal and noise. According to the theory, there are a number of determiners of how a
detecting system will detect a signal, and where its threshold levels will be.
Detection theory has applications in many fields such as diagnostics of any kind, quality
control, telecommunications, and psychology. The concept is similar to the signal to noise
ratio used in the sciences and confusion matrices used in artificial intelligence. It is also usable
in alarm management, where it is important to separate important eventsfrom background noise.
Sensitivity or discriminability
sensitivity refers to how hard or easy it is to detect that a target stimulus is present from
background events.Bias
Bias is the extent to which one response is more probable than another.
Resolution
The resolution of a sensor is the smallest change it can detect in the quantity that it is measuring.
Sensors and detection theory
Taking in account the detection theory:
Sensors are detection devices, able to discern between signal and noise. The
sensitivity refers to how hard or easy it is to detect that a target stimulus is
present from background events.
Analog and Digital Sensors
All sensors are divided to analog and digital.
Consider analog sensors as variable resistors that transmit different values of electric
current. The range of this value depends on the bits of the CPU of the microprocessor.
For example Arduino Uno has a 16 Bit CPU. With 16 Bits we can represented values
from 0-1024. So the Analog port of Arduino Uno can receive or transmit values from 0-
1024. Potentiometer, Flex, Thermometer and other sensors are analog.
Digital sensors transmit binary data. They return values of High (1) or Low (0) or
sequence of high and lows (data). A touch sensor is an example of digital sensor that
returns high or low (on or off). Another example is the GPS sensor that returns data (a
string with the current coordinates).
-
7/31/2019 IEEE Robotics
15/38
7/20/20
How to read from values from
an analog port
The following command is used to read the analog port in Arduino
Syntax
analogRead(pin)
Returns
int (0 to 1023)
Example
void setup() {
Serial.begin(9600); // setup serial
}
void loop() {
val = analogRead(3); // read the input pin 3
Serial.println(val); // debug value}
How to read from values from
a digital port
The following command is used to read th e analog port in Arduino
Syntax
digitalRead(pin)
Returns
High or Low
Example
void setup() {
pinMode(7, INPUT); // sets the digital pin 7 as input
Serial.begin(9600); // setup serial
}
void loop() {
val = digitalRead(7); // read the input pin 7Serial.println(val); // debug value
}
Touch sensor
The touch sensor is one of the simplest digital sensors. It is nothing more than
a button that returns high every time it is pressed.
Apart from traditional buttons touch sensors are also used to inform the robot
if it is touching an object.
Potentiometer
Most analog potentiometer are variable resistors that change their value as the shaft
turns. This type of potentiometer have three legs. The middle leg should be connected
to an analog input port and the two side legs to power and ground.
Joystick
The joystick is nothing more than two potentiometers. One for Xaxis and one for Y axis. As you can guess, it can be connected like
connecting two potentiometers, so it requires two analog ports.
Flex sensor
Flex is an analog sensor that increases its resistance (so return lower value) as the sensor is flexed.
Patented technology by Spectra Symbol - they claim these sensors were used in the
original Nintendo Power Glove. I love the Nintendo Power Glove.
To connect it with the Arduino we need to add a resistor. The following schema shows how the
sensor can be connected.
It is recommended to used a potentiometer first in order to
find out what resistor it needs. In general the lower the
resistor the higher the sensitivity.
http://dlnmh9ip6v2uc.cloudfront.net/images/products/08606-03-L.jpghttp://www.ebay.com/itm/Arduino-JoyStick-Module-Sensor-Shield-free-3-CABLES-/160589361684?pt=LH_DefaultDomain_0&hash=item2563df3214 -
7/31/2019 IEEE Robotics
16/38
7/20/20
Pressure sensor
The pressure sensor is an analog sensor, very similar to the flex. It
increase its resistance once pressure is applied on the surface. The
pressure sensor can be connected with the Arduino like the flexsensor.
Photocell
The photocell is an analog sensor that changes its resistance depending on
how much light is shining onto the squiggly face. Brighter light will result tohigher values. The photocell is connected with Arduino like the flex and the
pressure sensor.
Humidity sensor
The analog humidity sensor, measures the amount of water
vapor in the air and returns a value. The round white sensor can be
connected like the flex while the second one can be connected like
the potentiometer.
Tempeture sensor
The temperature sensor is an analog sensor used to measure the
tempeture. It outputs an analog voltage of that can be used to estimate
the room tempeture. Like all the analog sensors that we visited so far,
the output of the sensor is linear.
Sound sensor
Sounds sensors are analog sensors used to detect sounds. Pleasenote that this does not include recognition or any processed data.
It just returns an analog value based on the strength of the sound.
Ultra sonic (distance) sensor
Ultrasonic sensors generate high frequency sound waves and evaluate theecho which is received back by the sensor. Sensors calculate the timeinterval between sending the signal and receiving the echo to determine the
distance to an object.
Some Ultra sonic sensors are using two instruments, one for sending and
one for receiving, while others use the same for both sending and
receiving. The first require three legs that are connected to power, grounds
and a digital port that is used for both sending and receiving while the
second has four legs and it requires two digital ports, one for sending and
one for receiving.
http://www.ebay.com/itm/Arduino-40Hz-Ultrasonic-Range-Detection-Sensor-/280531119600?pt=LH_DefaultDomain_0&hash=item4150f52df0http://www.ebay.com/itm/Arduino-Sound-Sensor-Module-Sensor-Shield-Cable-/180625274609?pt=LH_DefaultDomain_0&hash=item2a0e1af6f1http://www.ebay.com/itm/Arduino-LM35-Linear-Temperature-Sensor-/270812956691?pt=LH_DefaultDomain_0&hash=item3f0db5c813http://dlnmh9ip6v2uc.cloudfront.net/images/products/09569-03-Working.jpghttp://www.ebay.com/itm/Five-HS1101-Humirel-Humidity-Sensor-Arduino-Hygrometer-/170714763156?pt=LH_DefaultDomain_0&hash=item27bf648f94http://www.ebay.com/itm/Ceramic-VT43N1-LDR-Photocell-Resistor-400V-400mW-NEW-/220877074689?pt=LH_DefaultDomain_0&hash=item336d4cb101http://www.ebay.com/itm/1x-Ceramic-VT43N1-LDR-Photocell-Resistor-400V-400mW-/120791325623?pt=LH_DefaultDomain_0&hash=item1c1fb95bb7 -
7/31/2019 IEEE Robotics
17/38
7/20/20
Passive infrared sensor (PIR)
A Passive Infrared sensor (PIR sensor) is an electronic device that
measures infrared (IR) light radiating from objects in its field of
view.
All objects above absolute zero emit energy in the form of
radiation. Usually infrared radiation is invisible to the human
eye but can be detected by electronic devices designed for such a
purpose.
Motion is detected by the PIR when an infrared source with
one temperature, such as a human, passes in front of an infrared
source with another temperature.
Most PIRs are digital sensors. They measure the difference between
the IR light and if it is higher than a preset threshold then they
return High. This threshold also determines the sensitivity of the
sensor.
Gas sensor
Gas sensors, can detected if certain gasses are in the air. Most of
the gas sensors contain material that react with gas that the sensor
detects, usually, with the help of heat. This reaction produceelectric current that is captured by the sensor.
Most gas sensors are analog and the higher the value they return
the higher the value of the gas that they detect in the air.
Alcohol Gas sensor
The alcohol sensor is identical to the gas sensor but it returns high if the air contains
ethanol. This sensor is very popular in Breath Alcotests carried out by the traffic
police.
Gyroscope and accelerometer
Gyroscopes return their current stance in three dimensions.
The accelerometer measures the gravitational acceleration (g) in three
dimensions.
Most gyroscope drift over time and can not be trusted for a longer timespan
but are very precise for a short time. Accelerometers are a bit unstable, but
do not drift. The precise angle can be calculate by combining measurements
from both the gyroscope and the accelerometer and using a mathematical
approach called a Kalman filter. Kalman filters will be explained in more
details at a later lecture.
Global Positioning System
(GPS)
The Global Positioning System (GPS) is a space-based globalnavigation satellite system (GNSS) that provides location data,
anywhere on or near the Earth, where there is an unobstructed line
of sight to four or more GPS satellites. GPS is providing the
following categories of data:
$GPGGA: Global Positioning System Fix Data
$GPGSV: GPS satellites in view
$GPGSA: GPS DOP and active satellites
$GPRMC: Recommended minimum specific GPS/Transit data
2 = Data status (A=Valid position, V=navigation receiver warning)
3 = Latitude of fix
4 = N or S of longitude
5 = Longitude of fix
6 = E or W of longitude
7 = Speed over ground in knots
KinectKinect is a Microsoft product developed for Xbox game console.
The device features an "RGB camera, depth sensor and multi-
array microphone running proprietary software",which providefull-body 3D motion capture, facial recognition and voice
recognition capabilities.
The depth sensor consists of an infrared laser projector
combined with a monochrome CMOS sensor, which captures
video data in 3D under any ambient light conditions. The sensing
range of the depth sensor is adjustable, and the Kinect software
is capable of automatically calibrating the sensor based on
gameplay and the player's physical environment,
accommodating for the presence of furniture or other obstacles.
Kinect software development kit (SDK) for Windows allow
developers to get access to the raw data of the sensor, Skeletal
tracking and Advanced audio capabilities.
http://en.wikipedia.org/wiki/File:Kinect2-deepmap.pnghttp://en.wikipedia.org/wiki/File:Xbox-360-Kinect-Standalone.pnghttp://www.ebay.com/itm/Arduino-MMA7260-Triaxial-Acceleration-Sensor-Module-/180648087590?pt=LH_DefaultDomain_0&hash=item2a0f771026http://www.google.com/imgres?imgurl=https://www.tispol.org/system/files/images/Rom%20alco%20test%202.thumbnail.jpg&imgrefurl=https://www.tispol.org/image-galleries/european-roads-policing-enforcement-photos/alcohol-enforcement?page=5&usg=__2bB8gA81im5tCPTzJ3jzX02O_uU=&h=150&w=200&sz=9&hl=en&start=1&zoom=1&tbnid=_sKDVqM9Kq31BM:&tbnh=78&tbnw=104&ei=gDKjTpSvL8XKswbficGKAw&prev=/search?q=alcotest+traffic+police+photo&hl=en&sa=X&biw=1366&bih=667&tbm=isch&prmd=imvns&itbs=1http://www.ebay.com/itm/DIY-Tools-Arduino-Shield-Alcohol-Gas-Sensor-Module-MQ9-/320713450138?pt=LH_DefaultDomain_0&hash=item4aac02e29ahttp://www.ebay.com/itm/Arduino-MQ7-Gas-Sensor-Brick-/270741961785?pt=LH_DefaultDomain_0&hash=item3f097a7c39http://www.ebay.com/itm/Arduino-Digital-PIR-Motion-Sensor-/280523551271?pt=LH_DefaultDomain_0&hash=item415081b227 -
7/31/2019 IEEE Robotics
18/38
7/20/20
Electroencephalography
(E.E.G)
Electroencephalograph (E.E.G) devices are sensors used to
measure the brain activity. They are electrodes that capture
the electrical activity of brain cells over a period of time and
have no effect to humans health. With the help of such
devices we are able to measure and identify brain activities
such as emotions, facial expressions, levels of attention and
meditation.
Electromyography (E.M.G)
Electromyography (EMG) is a technique for evaluating and recording the electrical
activity produced by skeletal muscles. EMG is performed using an instrument called
an electromyograph, to produce a record called an electromyogram. Anelectromyograph detects the electrical potential generated by muscle cells when these
cells are electrically or neurologically activated.
More sensors
Acoustic, sound, vibration
Automotive, transportation Chemical
Electric current, electric potential, magnetic, radio
Environment, weather, moisture, humidity
Flow, fluid velocity
Ionising radiation, subatomic particles Navigation instruments (Position, angle, displacement, distance, speed, acceleration) Optical, light, imaging, photon Force, density, level, Pressure Thermal, heat, temperature
Proximity, presence
http://en.wikipedia.org/wiki/List_of_sensors
Examples of a custom sensors
Accelerometer
A simple accelerometer can be a box with a sphere in
site and pressure sensors on the inner walls of the
box. As the box moves towards a direction, the
sphere inside the box will push the pressure sensors
towards the opposite direction with a force related to
the speed of the box.
Reflexing
Light
Color Detector
A simple color detector can be a photocell,
a LED and a divider between them. The LED
will emit light, that will be reflected by the
object depending on its color. The
photocell Will capture this reflexing and
return an analog value. From this value we
can determine the color of the object.
Sensor deviations
Sensitivity error
The difference between the measurement from the sensor and the actual value. Most of the times the sensor
measurements remain linear and it is easy to reduce the error (e.g maybe the sensor adds + 5 to all values). If
the sensitivity is not constant over the range of the sensor, this is called non linearity and it more difficult to
reduce.
Dynamic error
If the deviation is caused by a rapid change of the measured property over time, there is a dynamic error.
Drift
If the output signal slowly changes independent of the measured property, this is defined as drift.
Noise
Noise is a random deviation of the signal that varies in time usually caused by an external source.
Hysteresis
Hysteresis is an error caused by when the measured property reverses direction, but there is some finite lag in
time for the sensor to respond, creating a different offset error in one direction than in the other.
Out of range
Since the range of the output signal is always limited, the output signal will eventually reach a minimum or
maximum when the measured property exceeds the limits.
The key points of this lecture
What is a Sensor What are the differences between Analog and Digital
Covered a variety of sensors
Example of a custom sensor
Sensor deviations
http://en.wikipedia.org/wiki/List_of_sensorshttp://en.wikipedia.org/wiki/List_of_sensorshttp://en.wikipedia.org/wiki/List_of_sensors -
7/31/2019 IEEE Robotics
19/38
7/20/20
In the next Lecture
We are going to learn about motors and
articulators How they work
How to use them with Arduino
Introduction to
Electrical Motors and Actuators
(Lecture 4)
Dr. George T.
Mr. Rezhan S.
Topics covered
in the previous lecture
What is a Sensor
What are the differences between Analog
and Digital
Covered a variety of sensors
Example of a custom sensor
Sensor deviations
In this lecture
What is a motor
AC, DC, Stepper and Servo motors
Gear boxes
What is an actuator
Linear and rotational actuator
Learning outcomes
The aim of this lecture is to help students gain an understanding of
motors, actuators and their applications.
After this lecture, the students will know which motors and
actuators best fit their robots as well as how to connect them and
program them.
Some basic Physics definitionsLinear Speed and Angular Speed
Linear Speed: The average speed of an
object in an interval of time is the
distance traveled by the object divided
by the duration of the interval.
Angular speed: is a scalar measure of
rotation rate. Angular frequency (or
angular speed) is the magnitude of the
vector quantity angular velocity.
-
7/31/2019 IEEE Robotics
20/38
7/20/20
Some basic Physics definitionsTorque
Torque: Loosely speaking, torque is a measure of the turning force on an object
such as a bolt or a flywheel. For example, pushing or pulling the handle of a
wrench connected to a nut or bolt produces a torque (turning force) that loosens
or tightens the nut or bolt.
What is a motor?
Motors are devices that change any type of energy to mechanical energy. The
following are some example of motors:
Internal combustion motor
Chemical energy of the fuel to mechanical energy.
Such motors are widely used in cars.
Steam engine
Changing steam to movement. They were used in old trains.
Electromechanical motor
Changing the electrical energy to mechanical energy.
Electromechanical motor
Most electric motors operate through the interaction of magnetic
fields and current-carrying conductors to generate force.
They may be powered by direct current (DC), e.g., a battery powered
portable device or motor vehicle, or by alternating current (AC) from a
central electrical distribution grid or inverter.
How electromechanical motors work
The main parts of Electromechanically
motors are Rotor and Stator. By
changing the density of
electromagnetism energy around the
rotor, according to Faraday rule, the
rotor will start to make a rotational
movement. This movement prepares
the mechanical energy.
DC motors work like AC motors with the
only difference that most of the times
they have a commutator responsible for
changing the polarity of the stator. Thiscause DC motors to be more powerful
but low life-span.
Direct Current (DC) motors
Brush
Brushed motors including a commutator to change the
polarity of the stator. This is a brushed DC electric motor
generating torque directly from DC power supplied to the
motor by using internal commutation, stationary
permanent magnets. Torque is produced by the principle
of Lorentz force, which states that any current-carrying
conductor placed within an external magnetic field
experiences a force known as Lorentz force. The
commutator consists of a split ring 80 degree shows the
effects of having a split ring
Direct Current (DC) motors
Brushless
Brushless motors have no commutator. Instead they
have a permanent magnet that rotates around thecore. Brushless DC motors use a rotating permanent
magnet or soft magnetic core in the rotor, and
stationary electrical magnets on the motor housing.
This design is simpler than that of brushed motors
because it eliminates the complication of transferring
power from outside the motor to the spinning rotor.
Advantages of brushless motors include long life span,
little or no maintenance, and high efficiency.
Disadvantages include high initial cost, and more
complicated motor speed controllers.
http://en.wikipedia.org/wiki/File:Ejs_Open_Source_Direct_Current_Electrical_Motor_Model_Java_Applet_(_DC_Motor_)_80_degree_split_ring.gifhttp://en.wikipedia.org/wiki/File:Motors01CJC.jpghttp://www.google.com/imgres?imgurl=http://cdn.coolest-gadgets.com/wp-content/uploads/2006/11/steam-engine.jpg&imgrefurl=http://www.coolest-gadgets.com/20061128/fully-working-miniature-brass-steam-engine/&usg=__n-6wJ3QqaoJkLEkCsJn9fghYoMw=&h=399&w=405&sz=40&hl=en&start=3&zoom=1&tbnid=O762Xn5OfGeOyM:&tbnh=122&tbnw=124&ei=PBy4TvyIDZO3hAfR-r2bBA&prev=/search?q=steam+engine&hl=en&sa=X&biw=1366&bih=667&tbm=isch&prmd=imvnsrb&itbs=1http://www.google.com/imgres?imgurl=http://www.familycar.com/Classroom/Images/Engine.jpg&imgrefurl=http://www.familycar.com/Engine.htm&usg=__JokJjtztTavQ6uddLm-663IlD2k=&h=320&w=330&sz=28&hl=en&start=2&zoom=1&tbnid=Zwqd-d1DlMaydM:&tbnh=115&tbnw=119&ei=_Ru4TumLCpOBhQek0vyyBA&prev=/search?q=car+engine&hl=en&sa=X&biw=1366&bih=667&tbm=isch&prmd=imvnsrb&itbs=1 -
7/31/2019 IEEE Robotics
21/38
7/20/20
Connecting a DC motor
The easier way to drive a DC is by the help of a DC shield. The motor shield in this
example can drive up to 4 DC motors bi-directionally. That means they can be driven
forwards and backwards. To connect a motor, simply solder two wires to the terminals
and then connect them to either the M1, M2, M3, or M4.
Driving a DC motor
#include
AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
void setup() {
motor.setSpeed(200); // set the speed to 200/255
}
void loop() {
motor.run(FORWARD); // turn it on going forward
delay(1000);
motor.run(BACKWARD); // the other way
delay(1000);
motor.run(RELEASE); // stopped
delay(1000);
}
Stepper motor
A stepper motor (or step motor) is a brushless, electric motor that can divide a full rotation into a
large number of steps. The motor's position can be controlled precisely without any feedback
mechanism, as long as the motor is carefully sized to the application.
Stepper motors have multiple "toothed" electromagnets arranged
around a central gear-shaped piece of iron. The electromagnets are
energized by an external control circuit, such as a microcontroller. To
make the motor shaft turn, first, one electromagnet is given power,
which makes the gear's teeth magnetically attracted to the
electromagnet's teeth. When the gear's teeth are aligned to the first
electromagnet, they are slightly offset from the next electromagnet.
So when the next electromagnet is turned on and the first is turned
off, the gear rotates slightly to align with the next one, and from there
the process is repeated. Each of those slight rotations is called a
"step", with an integer number of steps making a full rotation. In that
way, the motor can be turned by a precise angle.
Stepper motorUnipolar VS Bipolar
Unipolar has 4 windings and easy to drive and has low torque and speed and smaller
steps than bipolar, hence more accuracy. Bipolar has 2 windings and hard to drive and
has high torque and speed but less accuracy.
Connecting a step motorFor unipolar motors: to connect up the stepper, first figure out which pins connected to which coil, and
which pins are the center taps. If its a 5-wire motor then there will be 1 that is the center tap for bothcoils. The center taps should both be connected together to the GND terminal on the motor shield
output block. then coil 1 should connect to one motor port (say M1 or M3) and coil 2 should connect to
the other motor port (M2 or M4).
For bipolar motors: its just like unipolar motors except there is no 5th wire to connect to ground. The
code is exactly the same.
Controlling a step motor
#include
AF_Stepper motor(48, 2);
void setup() {
motor.setSpeed(10); // 10 rpm
motor.step(100, FORWARD, SINGLE);
motor.release();
delay(1000);
}
void loop() {
motor.step(100, FORWARD, SINGLE);
motor.step(100, BACKWARD, SINGLE);
motor.step(100, FORWARD, DOUBLE);
motor.step(100, BACKWARD, DOUBLE);
motor.step(100, FORWARD, MICROSTEP);
motor.step(100, BACKWARD, MICROSTEP);
http://en.wikipedia.org/wiki/File:StepperMotor.gifhttp://www.ladyada.net/images/mshield/dcmotor.jpg -
7/31/2019 IEEE Robotics
22/38
7/20/20
Servos
http://www.seattlerobotics.org/guide/servos.html
Servo motors are like stepper motors. They also have an electro magnet around the
input gear. As this moves it transfer the movement to other gears that are connected
with the shaft. Servo motors are very precise as their technology is similar to step
motors, powerful as they include a gear box and simple to control because they include
a controller (driver). These reasons makes them very useful in robotics.
Connecting a servo
Servos have three cables. Power, Ground and Data. The data cable is
connected with the digital port. The following diagram shows how servo is
connected with an Arduino board.
Controlling a servo
#include
Servo myservo; // create servo object to control a servo
int val; // variable to read the value from the serial port
void setup()
{
Serial.begin(9600); // Start the serial port
myservo.attach(9);// attaches the servo on pin 9 to the servo object
}
void loop()
{
val = Serial.read()); // reads the value from the serial
myservo.write(val); // sets the servo position according to the scaled valuedelay(15); // waits for the servo to get there
}
GearboxesA gear box has two main duties. First, it transfers the power from the motor (as a power
generator), to wheels and so on. In mechanical engineering, gearboxes are known as
Transmission systems.
The second advantage of gearbox is to increasing or decreasing the torque and speed. If
the input gear is smaller than output gear it increases the torque an decrease the speed.
Vise versa, if the input gear is smaller than the output gear, it increase the speed and
decrease the torque.
Actuators
An actuator is a type of motor for moving or controlling a mechanism or system. There
are two main types of actuators:
Linear actuators
Rotational actuators
Linear actuator
A linear actuator is an actuator that creates linear motion.
Mechanical and hydraulic actuation are the most common methods of achieving
the linear motion.
http://www.seattlerobotics.org/guide/images/servo3c.jpg -
7/31/2019 IEEE Robotics
23/38
7/20/20
Rotary actuators
A rotary actuator is an actuator that produces a rotary motion or torque.
The most frequently used Rotary actuators in Robotic are Servo and
Stepper motors.
The key points of this lecture
What is a motor
AC, DC, Stepper and Servo motors Gear boxes
What is an actuator
Linear and rotational
Practical session 2
In this session the participants will be familiar
with digital and analog sensors and with the
control of servo motors.
Connecting anUltra Sonic Sensor
Connecting a servo
Servos have three cables. Power, Ground and Data. The data cable is
connected with the digital port. The following diagram shows how servo isconnected with an Arduino board.
Controlling a servo
#include
Servo myservo; // create servo object to control a servo
void setup()
{
myservo.attach(9);// attaches the servo on pin 9 to the servo object
}
void loop()
{
myservo.write(90); // sets the servo position (0-180)
delay(1500); // waits for the servo to get there
}
-
7/31/2019 IEEE Robotics
24/38
7/20/20
Continues rotation Servos
http://www.seattlerobotics.org/guide/servos.html
Servo motors can be modified and converted to continues rotation servos. Unlike the
rest of the servos, continues rotation servos can be controlled by the
writeMicroseconds() command.
writeMicroseconds()Description
Writes a value in microseconds (uS) to the servo, controlling the shaft accordingly. On a
standard servo, this will set the angle of the shaft. On standard servos a parameter value of
1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle.
Note that some manufactures do not follow this standard very closely so that servos often
respond to values between 700 and 2300. Feel free to increase these endpoints until the
servo no longer continues to increase its range. Note however that attempting to drive a
servo past its endpoints (often indicated by a growling sound) is a high-current state, and
should be avoided.
Continuous-rotation servos will respond to the writeMicrosecond function in an analogous
manner to the write function.
Syntax
servo.writeMicroseconds(uS)
Parameters
servo: a variable of type Servo
uS: the value of the parameter in microseconds (int)
writeMicroseconds()Example
#include
Servo myservo;
void setup()
{
myservo.attach(9);
myservo.writeMicroseconds(1500); // set servo to mid-point
}
void loop() {}
Exercises
1) Connect a photocell with the board and print it values.
2) Connect a photocell and a LED with the board. Make theLED on if the photo cell receive low values.
3) Connect a Buzzer and a PIR with the Arduino board. Makethe Buzzer on if the PIR detect movement.
4) Connect a potentiometer and a mini servo with theArduino board. Make the servo to move based on the inputfrom the potentiometer.
5) Connect an Ultra sonic sensor with the board and print thevalues that it receives.
6) Connect a continues rotation servo and make it move frontfor 10 sec, stop for 5 sec and go backwards for 10 sec.
Land Station based control systemsLecture 5
Dr. George T.
In the previous lecture
We covered the following:
What is a motor
AC, DC, Stepper and Servo motors
Gear boxes
What is an actuator
Linear and rotational
-
7/31/2019 IEEE Robotics
25/38
7/20/20
The key points of this lecture
Introduction to control systems
Land stations
Communication between robots and land stations PC as a land station
The introduction to control section of this
lecturer is based on the lecture notes of
Prof. Marian S. StachowiczLaboratory for Intelligent Systems
ECE Department, University of Minnesota
Duluth
Control
The word control is usually taken to mean:
- regulate,
- direct,
- command.
A control system is an arrangement of physical
components connected or related in such a
manner as to command, direct, or regulate
itself or another system.
Control System
IPO SYSTEM Input
The input is the stimulus, excitation orcommand applied to a control system.
Typically from external energy source,
usually in order to produce a specified
response from the control system.
Control Systems
-
7/31/2019 IEEE Robotics
26/38
7/20/20
Output
The output is the actual response obtained
from a control system.
It may or may not be equal to specified
response implied by the input.
Control Systems
Terms and Concepts
Control Systems
Control system
A control system is an interconnection of
components forming a system configuration that
will provide a desired system response.
Control Systems
Two Types of Control Systems
Open Loop
No feedback
Difficult to control
output with accuracy
Closed Loop
Must have feedback
Must have sensor on output
Almost always negative
feedback
Control Systems
Open-loop control
An open-loop control system utilizes an actuating
device to control the process directly without using
feedback.
A common example of an open-loop control system
is an electric toaster in the kitchen.
Control Systems Control Systems
-
7/31/2019 IEEE Robotics
27/38
7/20/20
Closed-loop control
A closed-loop control system uses a measurementof the output and feedback of this signal to
compare it with the desired output.
Control Systems Control Systems
A person steering an automobile by looking at
the autos location on the road and making the appropriate adjustments.
Control Systems Control Systems
Manual control system
Intelligent Control
Goal: Regulate the level of fluid by adjusting the output valve.
The input is a reference level of fluid and is memorized byoperator.The power amplifier is the operator.The sensor is visual.Operator compares the actual level with the desired level andopens or closes the valve ( actuator).
161
The level of fluid in a tank control.
162Intelligent Control
-
7/31/2019 IEEE Robotics
28/38
7/20/20
Multivariable control system
Control Systems
Control system of the national income.
Control Systems
A robot is a computer-controlled
machine.
Industrial robotics is a particular
field of automation in which the
robot is designed to substitute
for human labor.
The Honda P3 humanoid robot.
Control Systems
Automation- The control of a process by automaticmeans.
Closed-loop feedback control system -A system that uses a measurement of the output andcompares it with the desired output.
Feedback signal -A measure of the output of the systemused for feedback to control the system.
Multivariable control system -A system with more thanone input variable or more than one output variable.
System -An interconnection of elements and devices for
a desired purpose.
Control Systems
What is a land station?
A land station is computing system used for controllingcontrol systems. The control can be of any form, regulate,
direct or command. The land station can be as simple as a
desktop and as complex as mainframes. The station hosts the
software that communicate and control the robot.
CNC Machines
CNC machines use PCs as land stations. The PC host the software that tells the motor controller
how to move the Stepper motors.
-
7/31/2019 IEEE Robotics
29/38
7/20/20
Interaction with the users
Land stations usually act as the interface between the user
and the control system. Consider the following example. A
micro drone, that is controlled by the land station. The userspecify the path that the UAV should follow on the land
station. The station communicates this to the robot which
start moving. The robot can report back to the land station
with information such as its current location and so on.
Unlike the microcontrollers, land stations have higher
processing capabilities. Land stations can support more than
one control systems and can also be used as a communicationpoint between them.
Communication between the land
station and the robots
Land stations can communicate with the robots in a number of ways.
Directly via Serial port, USB and so on.
LAN
Wireless LAN
Internet
Point to point (XBEE)
PCs are widely used as land stations. The following example
shows how a C# application can run on a PC and control an
Arduino board.
Arduino can communicate with a PC via the Serial port. So all
the software has to do is receives and send data from and to
the serial port.
PC as a land station
Consider the following connection.
PC as a land station
Three LEDs are connected with the Arduino b oard.
The following code hosted in Arduino will allow the LEDs to be ON and OFF based on the
commands received from the serial port.
Char i;
Void setup(){
Serial.begin(9600);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
}
Void loop(){
i=Serial.read();
If (i==r){
digitalWrite(10,HIGH);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
}
If (i==y){
digitalWrite(10,LOW);
digitalWrite(9,HIGH);
digitalWrite(8,LOW);
}
If (i==g){
digitalWrite(10,LOW);
digitalWrite(9,LOW);
digitalWrite(8,HIGH);
}
}
PC as a land station
-
7/31/2019 IEEE Robotics
30/38
7/20/20
3
Open a Serial port connection with C#
private bool connected = false;private string RxString="";
SerialPort serialPort1 = new SerialPort();
serialPort1.PortName = textBox3.Text;
serialPort1.BaudRate = 9600;
serialPort1.Open();
The following close the connection
if (serialPort1.IsOpen) serialPort1.Close();
PC as a land station
Send data to Arduino
serialPort1.WriteLine (y);
PC as a land station
Open a Serial port connection with C#
private void DisplayText(object sender, EventArgs e)
{
textBox2.AppendText(RxString);
}
private void serialPort1_DataReceived (object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
if (connected == true)
{
RxString = serialPort1.ReadExisting();
this.Invoke(new EventHandler(DisplayText));}
}
PC as a land stationThe key points of this lecture
Land stations
Types and applications
Communication between robots and land stations
PC as a land station
In the next Lecture
We will visit and analyze a wide range of robotic projects. International Robotic ProjectsLecture 6
Dr. George T.
-
7/31/2019 IEEE Robotics
31/38
7/20/20
3
In the previous lecture
Introduction to control systems
Land stations
PC as a land station
The key points of this lecture
This lecture will cover a wide variety of international robotic
projects. The aim of this lecture is to give to the students an
understanding of real robots and ideas of what they candeveloped with their current knowledge.
HRP-4CThe National Institute of Advanced Industrial Science and Technology (AIST) of Japan in
conjunction with Kawada Industries has now released the HRP-4C humanoid.
DER3Kokoro and Osaka University have developed a new life-like android called Actroid DER3.
These androids look very human and talk and move their heads, arms, hands, and bodies.
CB2The JST ERATO Asada project and Osaka University have built a child-sized androi d called CB2
(Child robot with biometric body). It is 130 cm. tall, weighs 33 Kg., and has 56 DOF. It has
cameras for eyes and microphones for ears. It also has 197 tactile sensors embedded in thesilicone skin.
AsimoHonda has introduced their updated Asimo humanoid. It is 130 cm tall, weighs 54 Kg = 119
pounds, and has 34 DOF.
-
7/31/2019 IEEE Robotics
32/38
7/20/20
3
The world's first Arabic-speaking robot Robotic HandsThe Shadow project (London, England) has a really super hand. Their hand has 21
DOF. Each fi nger has 4 DOF and the thumb has 5 DOF. Their hand is even for sale, but
its quite expensive at 90,000 Euros ( = $119,700)
Robotic Hands
Dainichi Company, Ltd. Kani, Japan is also offering a complete hand. Their hand has 20 joints
and 16 DOF. The thumb has 4 DOF, while the rest have 3 DOF each. The weight is 1.4 Kg. Thi shand is quite expensive also: One hand (hardware only) is 3,866,000 yen ( = $36,900) while the
software is 1,520,000 yen ( = $14,500) or a total of 5,386,000 yen ( = $51,400).
Robot HandsDr. Paul Chappell of the University of Southampton has produced a fully functional hand
which isintended to be used as a prosthetic hand. It si called the Southampton Remedi-Hand. It has 6 DOF, one for each finger and 2 for the thumb.
Robotic hands for handicap
Touch Bionics, a Scotland firm that developed the i-LIMB Hand, a prosthesis with five
individually powered fingers, has announced the availability of the device. The company, anEdinburgh medical device developer, is also making ProDigits partial hand prostheses, based
on similar technology.
Robotic hands for handicap
DEKA Research and Development of Manchester (UK) has built a robotic arm which can be
used as a prosthetic arm by those who have lost their own due to accident or war.Unfortunately it costs about $100,000 = 80,000 Euros
-
7/31/2019 IEEE Robotics
33/38
7/20/20
3
Bipedal Projects
The University of Sout h Denmark has a 7 DOF walker. They have several videos on their site
too. The walker was built by Henrick Lund, Soren Jensen & Soren Theodorsen. It standsabout 56 cm = 22 inches tall.
Bipedal Projects
The University of Brussels in Belgium has a bipedal walking robot project underway. This
project is being lead by Prof. D. Lefeber of the Mutlibody Mechanics Research Group of theMechanical Engineering Department. Their robot is called "Lucy". It is 150 cm tall and
weighs 30 Kg.
Bipedal Projects
The National University of Singapore has a bipedal walking robot project underway. This
project is being lead by Prof. C.M. Chew of the Mechanical Engineering Department . Theirrobot has 12 DOF and stands 1.2 meters tall. It is driven by DC motors.
Bipedal Projects
The University of Illinois has a biped walker project going on at the Urbana-Champaign
campus. It was built by Lloyd Buck and Kitirat Jungpakdee. They call it Bijimeny.
Bipedal Projects
Alexander Vogler from Vienna, Austria has a very nice bipedal android which he calls V-3. Its
about 12" or 30cm tall and weighs 1.2 Kg. It has 12 DOF.
Bipedal Projects
Arduino Biped Robot BRAT 6 DOF Robotic
-
7/31/2019 IEEE Robotics
34/38
7/20/20
3
Android Head ProjectsDavid Hanson has produced another head - of Albert Einstein. This head was recently
attached to the Hubo humanoid being built at KAIST in Korea. You can see a video of Einsteinhere. The "Albert Hubo" has high quality video cameras embedded in the eyes, which allow
it to face-track and perform biometric ID. It is also set up for speech interaction and for
ongoing AI development.
Android Head Projects
David's animatronic head. This head has 16 servos which operate many different facial
actions. Cost $4500
Android Head Projects
Hossein Mobahi from the Azad University, Tehran-South Campus, Tehran, Iran has developed
an animatronic face. The face is comprised of eight degrees of freedom. Its controllablefeatures are eyes, eyebrows, jaw and neck. Aryan's brain enables it to autonomously detect
human face or hands and to track them. Aryan can express its emotion in his face, according
to its perceived visual stimulation. The brain software runs on a standard PC with a 200MHz
Intel Pentium Processor and under Linux OS.
hexapod Robot
Mecha Projects
A Japanese company called Sakakibarar Kikai (located in the Gunma prefecture about 100
miles NW of Tokyo on the island of Honshu) has built a Mecha which they call LandWalker. This Mecha is right out of Star Wars or Robocop . It is equipped with gatling guns
which shoot 4" diameter foam balls. It is 3.4 meters tall, 1.65 meters wide, and 2.4 meters
long. It weighs one metric ton and is powered by a 250 cc engine. It can walk at 1.5 Km/hr
(nearly 1 mile/hr).
Mecha Projects
A group in Okayama Japan has built a giant Gundam. It is 7 m (23 ft) tall, 3.5 m (11.5 ft) wide
and weighs 2 tons.
-
7/31/2019 IEEE Robotics
35/38
7/20/20
3
Mecha Projects
Giant steel fire-breat hing dinosaur. This robot is 40 feet tall, weighs 58,00 0 pounds and cost
$2.2 million to build. The site shows pix of the robot picking up cars and even airplanes.
UAVs
US Air force UAV predator
UAVs micro drones
Spherical Flying Machine Developed by Japan Ministry Of Defense
Fish robots
Military robots
British soldiers with captured German Gol iath remote-controlled demolition
vehicles (Battle of Normandy, 1944).
Military robots
Foster-Miller TALON SWORDS units
equipped with various weaponry.
Gladiator unmanned ground vehicle
-
7/31/2019 IEEE Robotics
36/38
7/20/20
3
Military robotsBigDog is a dynamically stable quadruped robot created in 2005 by Boston
Dynamics with Foster-Miller, the NASA Jet Propulsion Laboratory, and
the Harvard University Concord Field Station. BigDog is 3 feet (0.91 m) long,
stands 2.5 feet (0.76 m) tall, and weighs 240 pounds (110 kg), a bout the
size of a small mule. It is capable of traversing difficult terrain, running at 4
miles per hour (6.4 km/h), carrying 340 pounds (150 kg), and climbing a 35degree incline.
In the next lecture
This lecture presented a number of robotic projects of different
types that are used for different purposes. Robotics op ens the door
to a fascinating new world. However, these world can be dangerous.
In the next lecture we will talk about ethics and ethical use of theknowledge of robotics.
Ethics
Lecture 7
Dr. George T.
In the previous lecture
We covered a wide variety of international
robotic projects.
In this lecture
What is an ethical decision
Ethical vs Legal
Why we need ethics
Robots as assistants or weapons
How to make the right decision
What is Ethics
According to Wiki:
Ethics, also known as moral philosophy, is a branch
of philosophy that involves systematizing, defending, and
recommending concepts of right and wrong behavior.
-
7/31/2019 IEEE Robotics
37/38
7/20/20
3
Ethical VS Legal
The Law does not always covers all the situations so there will be
top related