robotic sensors
TRANSCRIPT
Email: [email protected]
2
• What is a robotic sensor?
Agenda
3
• What is a robotic sensor?• How do they work?
Agenda
4
• What is a robotic sensor?• How do they work?• What can they be used for?
Agenda
5
• What is a robotic sensor?• How do they work?• What can they be used for?• Practical examples, including code &
demonstration
Agenda
6
• Detects information about the physical world
What is a Robotic Sensor?
7
• Detects information about the physical world?
• Converts this information into an electrical signal suitable for the robot’s computer controller
What is a Robotic Sensor?
8
Simple Switch for sensing physical contact:
Function: Consists of two electrical contacts – they make or break a connection when the switch is activated
Examples of Robotic Sensors
(click for image)
9
Simple Switch for sensing physical contact:
Function: Consists of two electrical contacts – they make or break a connection when the switch is activated
Where Used: • joystick trigger• limit switch on robot arm• bumper switch on robot• detect presence of a ball in a hopper…
Examples of Robotic Sensors
10
How to Connect: • connect Common (COM) lead on switch to GND pin on Robot
Controller digital input• connect normally open (NO) lead on switch to SIG pin on Robot
Controller digital input
Simple Switch
11
How to Program:
• Define the desired digital I/O pin as input, if this is not already done in the default code:
– e.g.: digital_io_02 = INPUT;
• Use the switch input as follows:
If (rc_dig_in02 = 0){
pwm01 = 127 /* stops motor if switch pushed*/}
Simple Switch
12
Optical Sensor for physical presence: interrupted & reflected type are available
Function: Consists of light source (LED) and light detector (photocell), can sense by interruption or reflection of beam
Examples of Robotic Sensors
(click for image)
13
Optical Sensor for physical presence: interrupted & reflected type are available
Function: Consists of light source (LED) and light detector (photocell), can sense by interruption or reflection of beam
Where Used: • Interruption – detects presence of object inside optical gap,
could be a flange on a robotic arm, a tooth on a sprocket…
Examples of Robotic Sensors
14
Optical Sensor for physical presence: interrupted & reflected type are available
Function: Consists of light source (LED) and light detector (photocell), can sense by interruption or reflection of beam
Where Used: • Interruption – detects presence of object inside optical gap,
could be a flange on a robotic arm, a tooth on a sprocket…• Reflective – could count light and dark stripes on robot’s
drive wheel to measure distance traveled
Examples of Robotic Sensors
15
Examples of Robotic Sensors
Optical Sensor
• How to Program:
• Define the desired digital I/O pin as input, if this is not already done in the default code:– e.g.: digital_io_02 = INPUT;
• Read the sensor input as follows:– If (rc_dig_in02 = 0)
{/* increment wheel count if sensor goes from 1 to
0*/}
•
16
Rotary or shaft encoder for measuring shaft angle
Function: Consists of magnetic reed switches, or light source (LED) and light detector (photocell) with an encoder wheel
Examples of Robotic Sensors
(click for image)
17
Rotary or shaft encoder for measuring shaft angle
Function: Consists of magnetic reed switches, or light source (LED) and light detector (photocell) with an encoder wheel
Where Used: • On a drive axle to measure speed and distance• On an arm to measure position• On a turret to measure angle
Examples of Robotic Sensors
18
Rotary or shaft encoder for measuring shaft angle
How to Program: Usually consists of multiple digital outputs – connect these to
digital inputs on Robot Controller, and read these to determine when they change.
• Read the sensor input as follows:– If (rc_dig_in02 = 1 && rc_dig_in03 = 1 && rc_dig_in04 = 1)
{/* shaft is at 220º to 270 º angle*/
}
Examples of Robotic Sensors
19
Ultrasonic transducer for measuring distance
Function: Consists of an ultrasonic transmitter and receiver. Circuitry
Where Used: • On the front or side of a robot to measure distance to a
wall
Examples of Robotic Sensors
(click for image)
20
• Examples of sensors include:– Simple Switch for physical contact: joystick trigger, limit switch– Light beam for physical presence: interrupted & reflected– Rotary or Shaft Encoder for measuring rotary angle– Ultrasonic for measuring distance– Infra-red for measuring distance
What is a Robotic Sensor?
21
• Examples of sensors include:– Simple Switch for physical contact: joystick trigger, limit switch– Light beam for physical presence: interrupted & reflected– Rotary or Shaft Encoder for measuring rotary angle– Ultrasonic for measuring distance– Infra-red for measuring distance– Microphone for listening
What is a Robotic Sensor?
22
• Examples of sensors include:– Simple Switch for physical contact: joystick trigger, limit switch– Light beam for physical presence: interrupted & reflected– Rotary or Shaft Encoder for measuring rotary angle– Ultrasonic for measuring distance– Infra-red for measuring distance– Microphone for listening– Camera for seeing
What is a Robotic Sensor?
23
• Examples of sensors include:– Simple Switch for physical contact: joystick trigger, limit switch– Light beam for physical presence: interrupted & reflected– Rotary or Shaft Encoder for measuring rotary angle– Ultrasonic for measuring distance– Infra-red for measuring distance– Microphone for listening– Camera for seeing– Accelerometer for measuring acceleration & position– …….
What is a Robotic Sensor?
24
• Measuring Distance using Sharp GP2Y0A02YK – Measures distance from 20 cm to
150 cm
Specific Example – IR rangefinder
25
• Measuring Distance using Sharp GP2Y0A02YK – Measures distance from 20 cm to
150 cm– Provides analog output: 0 to 5 V
Specific Example – IR rangefinder
26
• Measuring Distance using Sharp GP2Y0A02YK – Measures distance from 20 cm to
150 cm– Provides analog output: 0 to 5 V– Can be connected directly to
Robot Controller’s analog input
Specific Example – IR rangefinder
27
• Measuring Distance using Sharp GP2Y0A02YK – Measures distance from 20 cm to
150 cm– Provides analog output: 0 to 5 V– Can be connected directly to
Robot Controller’s analog input– Has a spot beam, for accurate
aiming
Specific Example – IR rangefinder
28
• Measuring Distance using Sharp GP2Y0A02YK – Measures distance from 20 cm to
150 cm– Provides analog output: 0 to 5 V– Can be connected directly to
Robot Controller’s analog input– Has a spot beam, for accurate
aiming– Is immune to color or reflectivity
of the environment
Specific Example – IR rangefinder
29
• Measuring Distance using Sharp GP2Y0A02YK – Measures distance from 20 cm to
150 cm– Provides analog output: 0 to 5 V– Can be connected directly to
Robot Controller’s analog input– Has a spot beam, for accurate
aiming– Is immune to color or reflectivity
of the environment– Costs ~ $12.00
Specific Example – IR rangefinder
30
• Available from acroname, digikey, sparkfun and others• Connect as follows:
Sharp GP2Y0A02YK rangefinder
31
• Read voltage using analog input command on Robot Controller:
ir_sensor = Get_Analog_Value(rc_ana_in16);
• This value will range between ~ 10 (at 150 cm) and ~ 580 (~ 20 cm)
Programming for the Sharp GP2Y0A02YK
32
if (ir_sensor > lower_limit && ir_sensor < upper_limit )
{
pwm01 = 127; /* set servo to middle position */
}
Sample code: sets a servo to a different position depending on sensor distance
33
if (ir_sensor > lower_limit && ir_sensor < upper_limit )
{
pwm01 = 127; /* set servo to middle position */
}
Else /* not in middle range */
{ if (ir_sensor < lower_limit) /* check sensor for far away*/
{
pwm01 = 0; /* set servo to far position */
}
Sample code: sets a servo to a different position depending on sensor distance
34
if (ir_sensor > lower_limit && ir_sensor < upper_limit )
{
pwm01 = 127; /* set servo to middle position */
}
Else /* not in middle range */
{ if (ir_sensor < lower_limit) /* check sensor for far away*/
{
pwm01 = 0; /* set servo to far position */
}
Else
{
pwm01 = 253; /* set servo to near position */
}
}
Sample code: sets a servo to a different position depending on sensor distance
35
• You can use the sensor output to control the speed of the left & right drive wheels so your robot will keep a specified distance from a wall.
IR Rangefinder
36
• You can use the sensor output to control the speed of the left & right drive wheels so your robot will keep a specified distance from a wall.
• Use a second IR rangefinder to stop the robot or turn it when it approaches a wall in front of it.
IR Rangefinder
37
• You can use the sensor output to control the speed of the left & right drive wheels so your robot will keep a specified distance from a wall.
• Use a second IR rangefinder to stop the robot or turn it when it approaches a wall in front of it.
• The IR rangefinder is a very useful and easy-to-use sensor, and is just one of many sensors you can use on your robot.
IR Rangefinder
38
Thank you.
39
END
40
SwitchClick anywhere to return
41
Click anywhere to return
Optical Interrupter Optical Reflector
42
Rotary Encoder Encoder Disc, read by optical sensors inside decoder
Click anywhere to return
43
Ultrasonic Rangefinder
Click anywhere to return