Presentation is loading. Please wait.

Presentation is loading. Please wait.

IR sensitive - sense heat differences and construct images, night vision application Infra Red sensors.

Similar presentations


Presentation on theme: "IR sensitive - sense heat differences and construct images, night vision application Infra Red sensors."— Presentation transcript:

1 IR sensitive - sense heat differences and construct images, night vision application
Infra Red sensors

2 Variations of IR emitter/receiver pairs
Active Sensors Used in Lynxmotion, Robix and Lego robots

3 Modulation / Demodulation of Light and Infra-Red Sensors

4 Modulation and Demodulation of Light
Ambient light is a problem because it interferes with the emitted light from a light sensor. One way to get around this problem is to emit modulated light. The modulated light rapidly turns the emitter on and off. Modulated signa much easier and more reliably detected by a demodulator Demodulator is tuned to the particular frequency of the modulated light.

5 Modulation and Demodulation of Light
Not surprisingly, a detector needs to sense several on-flashes in a row in order to detect a signal. It means, to detect signal frequency. This is important when you write the demodulator code. The idea of modulated IR light is commonly used; in household remote controls. Modulated light sensors are generally more reliable than basic light sensors. They can be used for the same purposes: detecting the presence of an object measuring the distance to a nearby object (clever electronics required, see Martin’s textbook)

6 Infra Red (IR) Sensors Infra red sensors are a type of light sensors
They function in the infra red part of the frequency spectrum. IR sensors are active sensors They consist of: an emitter a receiver. IR sensors are used in the same ways as the visible light sensors are: as break-beams, as reflectance sensors.

7 Infra Red (IR) Sensors IR is preferable to visible light in robotics (and other) applications. This is because it suffers a bit less from ambient interference, because it can be easily modulated, because it is not visible.

8 Sharp Infra Red Detector

9 Sharp IR Detector The Sharp GP1U52X sensor detects infrared light that is modulated (i.e., blinking on and off) at 40,000 Hz. It has an active low digital output: meaning that when it detects the infrared light, its output is zero volts. The metal case of the sensor must be wired to circuit ground, as indicated in the diagram. This makes the metal case act as a Faraday cage, protecting the sensor from electromagnetic noise.

10 Sharp IR sensor assembly
Sharp IR Detector It is a digital sensor because it detects infrared light modulated at 40kHz. Not analog! Inside the tin can, there is a IR detector, amplifier, and a demodulator. The sensor returns a HIGH when there is no 40kHz light, and is LOW when it sees the 40kHz light. Sharp IR sensor assembly

11 Sharp IR Detector You can use the IC command ir counts(port) to count the number of successive detected periods of the modulated frequency. A count larger than 10 indicates a detection. You may need to play around with what values of the counts are needed for detection. These sensors can only be used in digital ports 4-7.

12 Elimination of the effect of the stray IR light
There is a lot of infrared light that is ambient in the air. Some components of this light are at 40kHz, and straight output from the sensor would look very glitchy. The sun produces a lot of IR light, and in the sun, the sensor output bounces all over the place. To eliminate the effect of the stray IR light, the IR emitters are modulated at 100 or 125 Hz and the output of the IR Detectors is demodulated to look for these frequencies. (see section A.7 for more information on the IR transmission) The 40kHz frequency is known as the carrier frequency, and the other frequency is the modulated frequency.

13 Phototransistor body and connector
IR Photo Transistor The “bundle-of-wires" phototransistors are much more predictable. They should be wired with a resistor of 100k to 300k (we recommend 220k). They barely respond at all to visible frequencies of light. They respond particularly well to the LEDs with which they are bundled, as well as to the grey IR LEDs. Both LEDs are highly directional, and you should be able to get good break-beam results up to 5 or 6 cm apart (2 inches). This might prove especially useful in ball-ring mechanisms, for example. Note that both LEDs and phototransistors are just the right size to fit in LEGO axle-holes! Phototransistor body and connector

14 Reflective Optosensors
If we use a light bulb in combination with a photocell, we can make a break-beam sensor. This idea is the underlying principle in reflective optosensors: the sensor consists of an emitter and a detector.

15 Reflective Optosensors
Depending of the arrangement of those two relative to each other, we can get two types of sensors: reflectance sensors the emitter and the detector are next to each other, separated by a barrier; objects are detected when the light is reflected off them and back into the detector break-beam sensors the emitter and the detector face each other; objects are detected if they interrupt the beam of light between the emitter and the detector

16 IR Reflective Optosensors
Transmitter LED: only infrared light by filtering out visible light Light detector (receiver) (photodiode or phototransistor) Light from emitter LED bounces off of an external object and is reflected into the detector Quantity of light is reported by the sensor Depending on the reflectivity of the surface, more or less of the transmitted light is reflected into the detector This is an analog sensor - connects to board analog ports

17 Break-Beam Sensors Light-emitting component aimed at a light-detecting component When opaque object comes between emitter and detector, the beam of light is occluded, and the output of the detector changes Discrete infrared LED Any pair of compatible emitter–detector devices may be used: 1. Incandescent flashlight bulbs and photocells 2. Red LEDs and visible-light-sensitive phototransistors 3. Infrared emitters and detectors phototransistor various commercial break-beam optosensors

18 Reflective Optosensors
The emitter is usually made out of a light- emitting diode (an LED). The detector is usually a photodiode/phototransistor. Note that these are not the same technology as resistive photocells. Resistive photocells are nice and simple, but their resistive properties make them slow. Photodiodes and photo-transistors are much faster and therefore the preferred type of technology.

19 Light Reflectivity. What can you do with this simple idea of light reflectivity? Quite a lot of useful things: object presence detection object distance detection surface feature detection (finding/following markers/tape) wall/boundary tracking rotational shaft encoding (using encoder wheels w/ ridges or black & white color) bar code decoding In Lego

20 Light Reflectivity. Light reflectivity depends on the color (and other properties) of a surface. A light surface will reflect light better than a dark one, and a black surface may not reflect it at all, thus appearing invisible to a light sensor. Darker objects harder (less reliable) to detect . In the case of object distance, lighter objects that are farther away will seem closer than darker objects that are not as far away.

21 Light Reflectivity. This gives you an idea of how the physical world is partially-observable; even though we have useful sensors, we do not have complete and completely accurate information.

22 Active Light Sensing The agent illuminates what is being sensed and uses the reflected light Can be used for a number of tasks collision avoidance/proximity detection following (mail delivery) We will discuss line following

23 Line Detecting and Following

24 Complete Line Following Circuit

25 Passive Light Sensing Light is received from the environment directly
Used to, locate, move towards, or avoid We will discuss a single cell eye

26 The Cyclops Circuit Cross connected single eyes
Single Photo-resistor per side Controls a differentially steered vehicle e.g. The Solenodon IV

27 Partial Circuit

28 What are the applications of Reflective Optosensors?
1. Object detection. Reflectance sensors may be used to measure the presence of an object in the sensor’s field of view. In addition to simply detecting the presence of the object, the data from a reflectance sensor may be used to indicate the object’s distance from the sensor. Disadvantage: These reading are dependent on the reflectivity of the object, among other things—a highly reflective object that is farther away may yield a signal as strong as a less reflective object that is closer. 2. Surface feature detection. Reflective optosensors are great for detecting features painted, taped, or otherwise marked onto the floor. Line-following using a reflective sensor is a typical robot activity.

29 What are the applications of Reflective Optosensors?
3. Wall tracking. Related the object detection category, this application treats the wall as a continuous obstacle and uses the reflective sensor to indicate distance from the wall. 4. Rotational shaft encoding. Using a pie-shaped encoder wheel, the reflectance sensor can measure the rotation of a shaft (angular position and velocity). 5. Barcode decoding. Reflectance sensors can be used to decode information from barcode markers placed in the robot’s environment.

30 Interfacing Reflective Optosensors
Two components of the sensor, the emitter and detector, have logically separate circuits, though they are wired to the same connector plug Detector Q1, shown as a phototransistor, is wired between ground and the sensor signal line—just like a photocell The emitter LED (LED1), is wired to the Handy Board’s +5v power supply through R1, the current-limiting resistor R1’s value can vary W, depending on how much brightness is desired from the emitter LED Reflectance Sensor Interface Diagram

31 How do you choose, Photocells or Phototransistors?
Properties of Photocells: easy to use - electrically they are resistors, their response time is slow compared to the photodiode or phototransistor’s semiconductor junction. photocells are suitable for: detecting levels of ambient light, or acting as break-beam sensors in low frequency applications (e.g., detecting when an object is between two fingers of a robot gripper). Properties of Photodiodes and Phototransistors: where we need a rapid response time: shaft encoding, more sensitive to small levels of light, which allows the illumination source to be a simple LED element.

32 Interfacing Phototransistors
Current creates a voltage drop in the 47K pull- up resistor on HB This voltage drop is reflected in a smaller voltage on the Vsens sensor signal line, which has a level that is equal to 5 volts minus the 47K resistor’s voltage drop Light-sensitive current source: the more light reaching the phototransistor, the more current passes through it Smaller values than 47K may be required to obtain good performance from the circuit If transistor can typically generate currents >= 0.1 mA, then voltage drop across the pull-up resistor will be so high as to reduce Vsens to zero Solution is to wire a smaller pull-up resistor with the sensor itself The current, i, flowing through the Q1 phototransistor is indicated by the dashed line.

33 Quality Technologies QRD1114 IR Optosensor
Emitter LED connects through 330KW resistor to +5v supply (constantly on) LED emitter and detector phototransistor or photodiode are matched. This means that peak sensitivity of the detector is at same wavelength of emissions of the emitter You should use infrared detector card to test IR light output Wiring Detector transistor pulled high with HB internal 47K resistor May have trouble figuring out which element is transistor and which is detector Length of leads: longer +, shorter - Detector connects to sensor signal line

34 Break-Beam Sensors

35 5.5.9 Breakbeam Sensors Figure 5.9: Reflectance Sensor

36 Break-beam Sensors We already talked about the idea of break- beam sensors. In general, any pair of compatible emitter- detector devices can be used to produce such a sensors: 1. an incandescent flashlight bulb and a photocell 2. red LEDs and visible-light-sensitive photo- transistors 3. infra-red IR emitters and detectors

37 Figure 5.10: Breakbeam Sensor using discrete components.

38 Breakbeam sensors Breakbeam sensors are another form of light sensors.
Instead of looking for reflected light, the photosensor looks for direct light as shown in Figure 5.10. The sensor is useful in detecting opaque objects that prevent the light beam from passing through. This can be useful in detecting block between gripper, or when block passes through a passageway. The sensor does not need to detect the block very quickly so the phototransistor can be plugged into the analog port.

39 Figure 5.11: Breakbeam Assembly

40 Figure 5.12: Shaft encoding using a LEGO pulley Wheel

41 Breakbeam sensors The breakbeam sensors can also be used for counting holes or slots in a disk as it rotates (see Figure 5.12), allowing distance traveled to be measured. Since this requires a very fast sampling, the sampling needs to be done at the assembly language level. We have implemented shaft-encoder routines to do the fast sampling. But in order to use these routines the sensors should be plugged into the lower two digital ports if the rate at which the holes or slots go by is very high. Before you use the analog sensors in the digital switch you must make sure that there is a full swing in the analog reading from when the light goes through to when the light is blocked.

42 Motorola MOC70V1 Infrared Break-Beam Optosensor
For sensing objects between larger gaps, use discrete emitters and detectors Interface to HB the same as for the reflective optosensors Emitter LED powered from HB +5v supply through dropping resistor Detector phototransistor connected between sensor signal line and ground Polarity is not indicated by length of device leads; look for + marking Consider many robotic applications for break-beam sensing e.g., detecting something between fingers of a robotic gripper

43 Ambient light. Another source of noise in light sensors is ambient light. The best thing to do is subtract the ambient light level out of the sensor reading, in order to detect the actual change in the reflected light, not the ambient light. How is that done? By taking two (or more, for higher accuracy) readings of the detector, one with the emitter on, and one with it off, and subtracting the two values from each other. The result is the ambient light level, which can then be subtracted from future readings. This process is called sensor calibration. Of course, remember that ambient light levels can change, so the sensors may need to be calibrated repeatedly.

44 What kind of Processing we need for Infrared Sensors?
1. Correct for ambient light 2. Calibrate light levels for dark and light surfaces 3. Process the data to avoid spurious readings 4. Process the data adapting to changing conditions

45 1. Correcting Reflective Optosensors for Ambient Light
Question: How can a robot tell the difference between: a stronger reflection an increase in light in the robot’s environment? Answer: switch a reflectance sensor’s emitter light source on and off under software control Take two light level readings, one with the emitter on, and one with the emitter off, then subtract away the ambient light levels Wiring an LED to bit 2 of Port D (Serial Peripheral Interface) Pin int active_read(int port) { int dark, light; /* local variables */ dark= analog(port); /* reading with light off */ bit_set(0x1009, 0b ); /* turn light on */ light= analog(port); /* reading with light on */ bit_clear(0x1009, 0b ); /* turn light off */ return dark - light; } Subtract ambient light from each IR reading

46 Correcting for Ambient Light
Need to differentiate between transmitted light and normal “ambient” light Can do so by using photosensor to read ambient light levels with transmitter off Can either use external photosensor Or use packaged photosensor if wired correctly Subtract ambient light from each IR reading Alternating ambient and IR readings Info about HB digital electronics: Typical LED draws 5-20 mA Typical processor digital output can supply mA So, a 68HC11 pin can drive 1-5 LEDs

47 2. Sensor Calibration for dark and light surfaces
setpoint variables are persistent int LINE_SETPOINT= 100; int FLOOR_SETPOINT= 100; void calibrate() { int new; while (!start_button()) { new= line_sensor(); printf("Line: old=%d new=%d\n", LINE_SETPOINT, new); msleep(50L); } LINE_SETPOINT= new; /* accept new value */ beep(); while (start_button()); /* debounce button press */ printf("Floor: old=%d new=%d\n", FLOOR_SETPOINT, new); FLOOR_SETPOINT= new; /* accept new value */ Robot is physically positioned over the line and floor and a threshold setpoint is captured Declare and use calibration routine Huge improvement over fixed and hard-coded calibration methods NOTE DEBOUNCING BUTTON PRESSES

48 Proximity Sensing with Infrared Pair
reflect IR off nearby object detect returned light emitter and detector point in same direction Modulated light By rapidly turning on and off, the source of light can be easily picked up from varying background illumination

49 Proximity Sensing with Infrared Pair
Modulated light By rapidly turning on and off, the source of light can be easily picked up from varying background illumination

50 Proximity Sensing with Infrared
With modulated light detector, object is either present or absent Modulated light is less susceptible to environment variables but non-modulated light magnitude sensing/thresholding works also Could try to determine object’s distance as well but, …

51 Re-Visiting IR Calibration
IR is very sensitive to ambient lighting, different color obstacles, varying distances, differing lighting conditions

52 Combining Light and IR to Infer Distance
IR = f(color, reflectance, ambient light, distance) Don’t have a sensor that measures color Distance is what we want So what we do? 1. We condition based on ambient light 2. We hope that all the obstacles are the same color/reflectance

53 Closed-loop Control Drive parallel to wall
Obstacle avoidance and tracking Drive parallel to wall Feedback from proximity sensors (e.g. bump, IR, sonar) Feedback loop, continuous monitoring and correction of motors -- adjusting distance to wall to maintain goal distance Using a Proximity Sensor to Measure Distance to a Wall

54 Separate Sensor State Processing from Control
Functions might each make use of other sensors and functions – need to decide how to implement each

55 Use Proximity Sensor to Select One of Three States
Sensor used to select one of three states

56 Obstacle Avoidance and Tracking Using IR
Have continuously running task update IR state: Left, right, both, neither If one obstacle detected then use closed-loop control to keep it away from robot If two obstacles detected then Either assume you can’t pass and treat like bump Or try to pass in-between with closed-loop control Depends on how you mounted/shielded your sensors, how you set your thresholds, and any ability to differentiate distances

57 Use of Infrared Ground Sensor

58 Concluding on Local Proximity Sensing using IR
Infrared LEDs cheap, active sensing usually low resolution - normally used for presence/absence of obstacles rather than ranging operate over small range

59 Shaft Encoding

60 Our Wheel Encoders Optical encoder to measure wheel rotation of each drive wheel Slotted disk attached to wheel or motor shaft “Break-beam” IR counts number of slots that pass in given time (ports 7,8 ) Enable_encode, disable_encoder, read_encoder (number of on/offs since last reset), reset_encoder Max 32,767 counts (16 bit) Encoder library must be loaded

61 Basics of Shaft Encoders
A shaft encoder is a device that measures the position of a shaft. There are two types of shaft encoders. One is incremental shaft encoder which produces a pulse train of a certain frequency depending on the rotational speed of its shaft. The other one is the absolute shaft encoder which measures the absolute position of its shaft.

62 Incremental shaft encoders.
64 Segments Photo Interrupter A Shaft Pulse Train Shaft Encoder

63 Single-Disk Shaft Encoder
Shaft Encoding Use Break-Beam Sensors Shaft encoder measures the angular rotation of an axle, reporting position and/or velocity information Example: speedometer, which reports how fast the wheels are turning; odometer, which keeps track of the number of total rotations Single-Disk Shaft Encoder A perforated disk is mounted on the shaft and placed between the emitter–detector pair. As the shaft rotates, the holes in the disk chop the light beam. Hardware and software connected to the detector keeps track of these light pulses, thereby monitoring the rotation of the shaft.

64 Shaft Encoding Shaft encoders measure the angular rotation of an axle providing position and/or velocity info. A speedometer measures how fast the wheels of a vehicle are turning, An odometer measures the number of rotations of the wheels. In order to detect a complete or partial rotation, we have to somehow mark the turning element. This is usually done by attaching a round disk to the shaft, and cutting notches into it.

65 Shaft Encoding A light emitter and detector are placed on each side of the disk, so that: as the notch passes between them, the light passes, and is detected; where there is no notch in the disk, no light passes. If there is only one notch in the disk, then a rotation is detected as it happens. This is not a very good idea, since it allows only a low level of resolution for measuring speed: the smallest unit that can be measured is a full rotation.

66 Shaft Encoding Besides, some rotations might be missed due to noise. Usually, many notches are cut into the disk, and the light hits impacting the detector are counted. (You can see that it is important to have a fast sensor here, if the shaft turns very quickly.) An alternative to cutting notches in the disk is to: paint the disk with black (absorbing, non-reflecting) and white (highly reflecting) wedges, and measure the reflectance. In this case, the emitter and the detector are on the same side of the disk.

67 Shaft Encoding In either case, the output of the sensor is going to be a wave function of the light intensity. This can then be processed to produce the speed, by counting the peaks of the waves. Note that shaft encoding measures both position and rotational velocity, by subtracting the difference in the position readings after each time interval. Velocity, on the other hand, tells us how fast a robot is moving, or if it is moving at all.

68 Shaft Encoding There are multiple ways to use velocity:
measure the speed of a driven (active) wheel use a passive wheel that is dragged by the robot (measure forward progress) We can combine the position and velocity information to do more sophisticated things: move in a straight line rotate by an exact amount Note, however, that doing such things is quite difficult, because: wheels tend to slip (effector noise/error) and slide and there is usually some slop and backlash in the gearing mechanism. Shaft encoders can provide feedback to correct the errors, but having some error is unavoidable.

69 Quadrature Shaft Encoding
So far, we've talked about detecting position and velocity, but did not talk about direction of rotation. Suppose the wheel suddenly changes the direction of rotation; it would be useful for the robot to detect that. An example of a common system that needs to measure position, velocity, and direction is a computer mouse. Without a measure of direction, a mouse is pretty useless. How is direction of rotation measured?

70 Quadrature Shaft Encoding
Quadrature shaft encoding is an elaboration of the basic break- beam idea; instead of using only one sensor, two sensors are needed. The encoders are aligned so that their two data streams coming from the detector are one quarter cycle (90-degrees) out of phase, thus the name "quadrature". By comparing the output of the two encoders at each time step with the output of the previous time step, we can tell if there is a direction change. When the two are sampled at each time step, only one of them will change its state (i.e., go from on to off) at a time, because they are out of phase.

71 Quadrature Shaft Encoding
Which one does, it determines which direction the shaft is rotating. Whenever a shaft is moving in one direction, a counter is incremented, and when it turns in the opposite direction, the counter is decremented, thus keeping track of the overall position. Other uses of quadrature shaft encoding are in: robot arms with complex joints (such as rotary/ball joints; think of your knee or shoulder), Cartesian robots (and large printers) where an arm/rack moves back and forth along an axis/gear.

72 Shaft Encoding This assembly uses the Motorola break-beam sensor with the medium pulley wheel as a photo-interrupter. After determining a position of the break-beam sensor that yielded good break and make transitions, the sensor was hot-glued into position along the LEGO beam. Data from shaft encoder built from MOV70V1 break- beam sensor and pulley wheel: The sensor data graph is a nearly ideal square wave. Using the standard HB analog input, which reports a sensor reading between 0 and 255, the sensor’s output varies from a low of about 9 (about 0.18 volts) to a high of about 250 (4.9 volts) with a sharp edge between the transitions. Other break-beam sensors yield a time graph that looks more like a sine wave.

73 Shaft Encoding Counting Encoder Clicks
To make sense of data from a shaft encoder, install a routine that repeatedly checks the sensor value. If the encoder wheel turns faster than the routine checks the sensor state, it will start missing transitions and lose track of the shaft’s rotation Solution: check midrange point Variables for algorithm: encoder_state - Keeps track of last encoder reading:1 if high (above 128), 0 if low (below 128) encoder_counter - Keeps running total of encoder “clicks”

74 Shaft Encoding Driver Software
Machine language routine loaded into IC’s underlying layer of direct 68HC11 code, with user interface - IC binary (ICB) files installed in interrupt structure of 68HC11 Monitors shaft encoder values and calculates encoder steps and velocity needs quickly and at regular intervals HB’s software libraries include set of routines for supporting shaft encoders for both position- counting and velocity measurement. For each analog input on HB, a pair of shaft encoder routines is provided. For each pair, there is a high-speed version and a low-speed version. High speed version checks for transitions on the encoder sensor 1000 Hz Low speed version checks encoder at 250 Hz (less of a processing load on the system) Both versions calculate the velocity (position difference) measurement at about 16 Hz Once loaded into IC, the encoder routines are automatically active; no additional commands are needed to turn them on. Each encoder0_counts variable (running total of transitions on encoder sensor) will automatically increment every time it senses a transition on its corresponding encoder sensor The encoder0_velocity value (velocity measurement) is continuously updated

75 Library Drivers to do the Counting
Machine language routine loaded into IC’s underlying layer of direct 68HC11 code, with user interface - IC binary (ICB) files installed in interrupt structure of 68HC11 Monitors shaft encoder values and calculates encoder steps and velocity needs quickly and at regular intervals HB’s software libraries include set of routines for supporting shaft encoders for both position- counting and velocity measurement. For each analog input on HB, a pair of shaft encoder routines is provided. Once loaded into IC, the encoder routines are automatically active; no additional commands are needed to turn them on. Each encoder0_counts variable (running total of transitions on encoder sensor) will automatically increment every time it senses a transition on its corresponding encoder sensor The encoder0_velocity value (velocity measurement) is continuously updated (copyright Prentice Hall 2001)

76 Programming Encoders ao(); }
/* Normal encoders, on ports 7 and 8. Must load encoders.lis to use this, more info in the HB manual. */ void main(void) { enable_encoder(0); /* Turn on encoder on port 7 */ motor(0, 20); while (read_encoder(0) < 130) ; reset_encoder(0); motor(0, -20); ao(); } /* Using encoders on analog ports 0 through 5 Must load the relevant file, sendr0.icb in this case. Consult the readme in the libs directory for info. */ void main(void) { motor(0, 20); while (encoder0_counts < 130) ; encoder0_counts = 0; motor(0, -20); ao(); /* Note that these analog functions also provide velocity information */ }

77 Shaft Encoding Measuring Velocity
Driver routines measure rotational velocity as well as position Subtract difference in the position readings after an interval of time has elapsed Velocity readings can be useful for a variety of purposes Robot that has an un-powered trailer wheel with a shaft encoder can easily tell whether it is moving or not by looking at encoder activity on the trailer wheel. If the robot is moving, the trailer wheel will be dragged along and will have a non-zero velocity. If the robot is stuck, whether or not its main drive wheels are turning, the trailer wheel will be still. Velocity information can be combined with position information to perform tasks like causing a robot to drive in the straight line, or rotate a certain number of degrees. These tasks are inherently unreliable because of mechanical factors like slippage of robot wheels on the floor and backlash in geartrains, but to a limited extent they can be performed with appropriate feedback from shaft encoders.

78 Shaft Encoding Reflective Optosensors as Shaft Encoders
It’s possible to build shaft encoders by using a reflective optosensor to detect black and white markings on an encoder wheel Wheels can be used with any of the reflective optosensor devices, as long as the beam of light they generate is small enough to fit within the black and white pie- shaped markings

79 Shaft Encoding Opto-Electronic Computer Mice
Common desktop mouse uses shaft encoder technology to figure out how the mouse ball is turned Two slotted encoder wheels are mounted on shafts that are turned by the ball’s movement On either side of each encoder wheel are the infrared emitter and detector pair Mice use quadrature shaft encoding, a technique that provides information about which way the shaft is turned (in addition to the total “encoder clicks”) IR detector on each shaft actually has two elements, aligned so that as one element is being covered up by the leaf between the slots, the other is being exposed

80 angular resolution of the shaft encoder
64 segment means 64 pulses per one complete revolution of the shaft. 1 revolution = 360o 1 revolution = 64 pulses 1 pulse = o (angular resolution) Increasing the number of segments, called the pulses per revolution (ppr) increases the angular resolution of the shaft encoder.

81 An Example Datasheet

82 Connection to Handyboard
Two shaft encoders can be connected to handyboard!!! Signal 5V Ground 1

83 Interactive C Functions
Load encoders.lis first. void enable_encoder(int encoder) enables the encoder(0 or 1) void disable_encoder(int encoder) disables the encoder(0 or 1) void reset_encoder(int encoder) resets the counter of encoder(0 or 1) to zero

84 Interactive C Functions
void read_encoder(int encoder) returns the number of pulses counted by the given encoder(0 or 1) since last reset or enable. Maximum number of counts is 32767, after that , …0 will come.

85 Some Important Remarks
Use an encoder which has a Vin = 5V and Vsignal = 5V. Use incremental shaft encoder. To use more than 2 encoders(upto 6), you can use analog ports instead of digital ports. But you have to use a different encoder library available on the Handyboard web site.

86 Khepera Robot Foto/diagrama del Khepera

87 Anatomy of the Khepera Microprocessor IR-Sensors Wheels & DC-Motors
Microprocessor brand Sensors’ capabilities Wheels, motors & disc-encoders IR-Sensors Wheels & DC-Motors

88 Insights of Khepera Microprocessor IR-Sensors Wheels & DC-Motors

89 Simplified Braitenberg Algorithm
Turn Right Obstacle on Left side? No Yes Obstacle on Right side? Turn Left Yes No Move Forward No Obstacle on Back? End Yes

90

91

92 Results On darkness On light
Slow filter response when approaching obstacle Even slower when moving away from obstacle On light Acceptable filter response time when approaching obstacle Acceptable filter response time when moving away from obstacle Noisy readings greatly reduced Detalles como frecuencias de corte y otros...

93 Results (cont.) Satisfactory performance of Braitenberg algorithm without filtered readings on darkness Problems using filters with Braitenberg algorithm Robot slow to react to filtered sensory readings

94 Conclusions Fluorescent light noise cause serious effects on Khepera’s performance Digital filters proved to be useful in reducing noise in sensory readings Filters performance are greatly affected by levels of ambient light Dynamic response faster than static response… Filter performance also affected by the motion of the robot, whether it is approaching or moving away from an obstacle.

95 Future Works Braitenberg algorithm modified to allows detection of ambient light Activate filters on high levels of ambient light Disable filters on low-light conditions Develop user-friendly program for testing algorithms and filters

96 Shaft Encoder Exercises
1. Build a shaft encoder using a break-beam optosensor and a perforated disk or LEGO pulley wheel. Verify the raw sensor performance—what values represent the light beam being broken vs. not broken? 2. Choose a suitable midpoint value for determining encoder transitions. Write a program in IC to implement the simple encoder counting algorithm presented in the flowchart. Use IC multi-tasking capability to display the encoder counter variable while the counting routine is running, and experiment with the encoder. Can you determine the performance limit of the algorithm in your implementation, in terms of counts per second? What is a fundamental problem with this implementation method? 3. Load a library shaft encoder routine and experiment with its performance. Capture raw data from the encoder. Based on the graph of raw encoder performance, choose suitable high and low threshold values. Explain your choices. 4. One limitation of current encoder routines, both the IC and library versions, is that they cannot determine which direction the shaft is rotating. Can you think of a different approach for determining the direction of rotation? 5. Implement the trailer wheel idea discussed in the text on your HandyBug. Write a program to make HandyBug drive around and stop, back up, and turn when the trailer wheel’s velocity is 0. Can you think of other applications for knowing the robot’s velocity, other than as a non-zero/zero (i.e., moving/not moving) quantity? 6. Instrument one of HandyBug’s drive wheels with an encoder, and write a program at attempts to maintain constant velocity on the drive wheel by varying the power level delivery to the motor. Experiment with the system by holding HandyBug in the air and applying pressure to the drive wheel. Is the system able to maintain the velocity? What happens if you suddenly remove the pressure?

97 Sources Saúl J. Vega Daisy A. Ortiz
A. Ferworn Saúl J. Vega Daisy A. Ortiz Advisor: Raúl E. Torres, Ph.D., P.E. Maja Mataric Ali Emre Turgut Dr. Linda Bushnell, EE1 M234, Web Site: Robotic Explorations: A Hands-on Introduction to Engineering, Fred Martin, Prentice Hall, 2001.

98 Creative Uses: IR Sensors
Sharp IR sensors are very accurate and operate well over a large range of distances proportional to the size of a Lego robot. However, they have almost no spread. This can cause a robot to miss an obstacle because of a narrow gap. One solution is to make the sensor pan. One could also use a light sensor to detect obstacles indoors. Inside, there tend to be lights at many angles and locations. Thus, around the edges of most obstacles, a slight shadow will be cast. A light sensor could detect this shadow and thus the associated object. Warning: this could be a very fickle design. Touch sensors can have their spread increased with large bumpers, and can be used for wall following to implement bug2. They are also dirt cheap.

99 IR Sensors 750 nm to 1,000,000 nm Transmitters (LEDs or thermal)
Detectors (photo diodes, photo transistors)

100 IR: Three common strategies

101 IR Rangefinders What sorts of techniques can we use?
Time of Flight (TOF) Signal Strength Triangulation

102 Creative Uses: IR Sensors
Example of sharp IR mounted to sweep for a wider field of view. Shadow cast indicates obstacle: one way to navigate with photo resistors.

103 Intensity Based Infrared
Increase in ambient light raises DC bias voltage Easy to implement (few components) Works very well in controlled environments Sensitive to ambient light time voltage time

104 Modulated Infrared Insensitive to ambient light
amplifier bandpass filter integrator limiter demodulator comparator Input Output 600us 600us Insensitive to ambient light Built in modulation decoder (typically 38-40kHz) Used in most IR remote control units ( good for communications) Mounted in a metal faraday cage Cannot detect long on-pulses Requires modulated IR signal

105 Digital Infrared Ranging
Modulated IR beam Optical lenses +5v output input 1k 1k gnd position sensitive device (array of photodiodes) Optics to covert horizontal distance to vertical distance Insensitive to ambient light and surface type Minimum range ~ 10cm Beam width ~ 5deg Designed to run on 3v -> need to protect input Uses Shift register to exchange data (clk in = data out) Moderately reliable for ranging

106 Polaroid Ultrasonic Sensor
Electric Measuring Tape Mobile Robot Focus for Camera

107 Theory of Operation Digital Init Chirp 16 high to low -200 to 200 V
Internal Blanking Chirp reaches object 343.2 m/s Temp, pressure Echoes Shape Material Returns to Xducer Measure the time

108 Problems Azimuth Uncertainty Specular Reflections Multipass
Highly sensitive to temperature and pressure changes Minimum Range

109 Beam Pattern Not Gaussian!!

110 (Naïve) Sensor Model

111 Problem with Naïve Model

112 Reducing Azimuth Uncertainty
Pixel-Based Methods (Most Popular) Region of Constant Depth Arc Transversal Method Focusing Multiple Sensor

113 Certainty Grid Approach
Combine info with Bayes Rule (Morevac and Elfes)

114 Arc Transversal Method
Uniform Distribution on Arc Consider Transversal Intersections Take the Median

115 Mapping Example

116 Vendors Micromint Wirz Gleason Research (Handyboard) Polaroid-oem

117 Metal Detector Oscillator signal coupled via transformer
When T2 is turned off, T3 is turned on 112kHz LC Oscillator LED will drop about 2volts Diode converts AC signal to DC ripple and applies as bias to T3

118 9v Signal to 5v logic + - +9V +5V Rpullup PIC
LM311 comparator A comparator can be used to convert a two-state signal to digital logic When the + voltage is above the voltage on the - pin, the output is high When the + voltage is below the - voltage, the output is low The LM311 has an open collector (you need to provide pullup resistor) This allows conversion from 9volt logic to 5volt logic

119 January 2002 Christopher Batten
MASLab Sensors January 2002 Christopher Batten

120 Agenda Quadrature phase sensors Sensors, in general
The specific kinds of sensors in 6.186

121 Quadrature Phase Encoders
We have a precise method of measuring how much our wheels rotate How can we use this for navigation? Pitfalls? Slippage Inaccurate characterization

122 Odometry Use odometry to find out how far each wheel has moved in some (short) time interval. Assume that robot was turning at a constant rate during this interval. y (xk,yk) θk x

123 Odometry – the model About how far did the robot actually go?
Dk=(dL+dR)/2 The angle of the sector? αk=(dR-dL)/B xk+1=xk+Dkcos(θk+ αk/2) yk+1=yk+Dksin(θk+ αk/2) θk+1= θk+ αk Try this at home! (xk+1,yk+1) θk+1 dR dL αk (xk,yk) θk x B is the “baseline”- the distance between the two wheels.

124 Odometry- Coping with Error
Odometry, by itself, will get worse and worse… Try to reconcile/confirm results with other navigation methods: Range to objects Angles to objects, targets, waypoints, beacons Any other ideas?

125 6.186 - Sensors What is a sensor? Common types: Other types:
Infra-Red (IR) Ultrasound Physical contact Other types: Magnetic field detectors (Reed switches) Be creative!

126 Infrared Beacons Custom hardware specifically designed for MASLab
IR Beacon Transmitters broadcast data packets containing a unique ID number (waypoints, targets, navigation beacons) IR Beacon Receivers are directional and look for ID broadcasts to identify the direction of a specific beacon (one per team)

127 Infrared Beacons - Transmitters
Which IDs correspond to waypoints, targets, and navigation beacons is predetermined and will not change The location of any beacon (in relative or absolute coordinates) is not known ahead of time Transmitters broadcast their ID in eight different directions IR Beacons will be either 10” or 8” and the walls will all be 9”

128 Infrared Beacons - Receivers
Receivers can receive packets in two opposite directions – combined with 180° servos this provides 360° listening Beacons do not (directly) provide any information concerning the distance to the beacon (use triangulation or range sensors) Range is approximately feet and should be able to receive approximately 5 packets per second. Each team is responsible for making their own baffles. Receiver w/ Baffle Receiver w/o Baffle

129 Infrared Range Detectors
Sharp GP2D12 IR range detectors Two per team (more upon request) Sensor includes: Infrared light emitting diode (IR LED) Position sensing device (PSD) To detect an object: IR pulse is emitted by the IR LED Pulse hopefully reflects off object and returns to the PSD PSD measures the angle at which the pulse returns Position Sensing Device Uses small lens to focus reflected pulse onto a linear CCD array LED PSD LED PSD

130 Infrared Range Detectors
Theoretical Range: 4in (10cm) to 31in (80cm) Actual Range: ~4in (10cm) to ~ 18in (45cm)

131 Infrared Range Detectors
Detecting Targets Placed target in various positions in front of a standard MASLab wall Relatively narrow “field-of-view” Noise Output voltage follows normal-like distribution with constant std dev User-level averaging may be useful Sampling Sensor refreshes approx. every 32ms Can reasonably acquire 20 samples per second 0.45 0.69 1.05 0.44 2.40 0.5 ft

132 Infrared Range Detectors
Uses Short range obstacle mapping - Mount sensor on servo and collect range data for various angles Bump sensors - Threshold output voltage, Use multiple sensors at appropriate angles to cover more area Target detection - Arrange multiple sensors to detect shape of waypoints and targets Final practical concerns Place a 10-20uF capacitor between Vcc & GND Position IR sensors to avoid dealing with < 4in readings

133 Autonomous robotics based on simple sensor inputs.
Stuart Dodds Abstract A “robot” is explained as “a device that performs functions normally ascribed to humans” - Webster. “Autonomous” means that the robot can work totally independently of itself, once it has been programmed, and it should be able to function without interaction from any human influence. Many robots are used nowadays to work in conditions where it is inaccessible for humans to work and therefore need to be autonomous. The aim of this project is to program a robot (shown left) using PIC (peripheral interface controller) chips, so that it will utilise its infra red sensors and run its stepper motors to follow a boundary wall within an enclosed environment. Starting Point Environment This diagram is a depiction of an environment that has been built to test the robot with a selection of acute, obtuse and reflex angles. As shown the robot follows the same sequence as it travels round the environment. When it reaches a wall the robot will stop then start to rotate until non of the sensors are active. Then it will move forward for a designated amount of time and rotate right and move forward again to look for the wall. Sensor Range ON OFF Boundary Sensors Infra-Red Sensors There are 13 Infra Red (or IR) sensors attached to the front half of the Robot that are used to detect the environment boundary. These sensors are light sensitive and output a signal when they become active. The sensor range is approximately 15mm which gives the robot enough time to read the information, decide on what to do and stop before it hits the boundary. Any Sensor Active Data Selector PIC 16f84 B1 B4 B2 B3 B0 A0 Stepper Controller Stepper Motors Multiplexer S0 S1 S2 S3 Sensors 13 Sensor Direction Communication lines Pulse IR Sensor Controller B5 A3 A2 A1 The devices that run all the computations of the robot are two PIC chips. One chip receives information from the IR sensors then executes an algorithm on this data. It then sends instructions to the other chip which controls the stepper motors. Further Work Now that the robot works properly and has been thoroughly tested using the IR sensors, the next stage of development is to implement a set of line following and ultra sonic sensors. This involves adding two more PIC chips to the circuit board, then to program them so they can read and process the information from these completely different sensor types. Once all of these have been fully implemented and tested I shall run a comparison between all three of them.

134 Infra-Red Sensors Sensors Boundary
Sensor Range Infra-Red Sensors There are 13 Infra Red (or IR) sensors attached to the front half of the Robot that are used to detect the environment boundary. These sensors are light sensitive and output a signal when they become active. Boundary OFF OFF OFF Sensors ON ON The sensor range is approximately 15mm which gives the robot enough time to read the information, decide on what to do and stop before it hits the boundary.

135 Environment This diagram is a depiction of an environment that has been built to test the robot with a selection of acute, obtuse and reflex angles. As shown the robot follows the same sequence as it travels round the environment. When it reaches a wall the robot will stop then start to rotate until non of the sensors are active. Then it will move forward for a designated amount of time and rotate right and move forward again to look for the wall. Starting Point

136 Stepper Controller IR Sensor Controller PIC 16f84 PIC 16f84 Stepper Motors Communication lines Pulse B0 B2 B1 A0 B5 Direction Pulse B3 Any Sensor Active B2 Direction B4 A0 B0 A1 A2 B1 Data Selector A3 Sensor Data Multiplexer S0 S1 S2 S3 Sensors 13 The devices that run all the computations of the robot are two PIC chips. One chip receives information from the IR sensors then executes an algorithm on this data. It then sends instructions to the other chip which controls the stepper motors.

137 The Robot - Khepera To make gas sensor move freely indoor. Khepera basic module and its General I/O extension module will be used in our experiment. It features: a diameter size of 5cm 2 independent DC motors with encoders 8 infra-red sensors An onboard microcontroller An onboard battery A modular design with extension modules Khepera Basic module

138 General I/O extension module
The “general I/O” is a turret that can be plugged on the basic configuration making simple custom electronic extensions possible. It features: Digital inputs and outputs Power outputs Analog inputs with adjustable gain Pass-through K-bus to other turrets General I/O Turret

139 The Sharp GP2D02 IR Distance Measuring Sensor

140 Quick Overview Sensors are utilized for many types of detection schemes. Such as: light intensity, temperature, etc… For our purpose: Distance

141 Examples Tactile Bumpers (simple sensor)
designed to form a contact closure when pressure is applied to the bumper other actuators can be used to trigger control or decisions concerning course of action. Optical Proximity Sensors (photoelectric sensors) Three groups Opposed: electric eye; emitter/detector beam interruption Retro-reflective: uses an object to reflect from emitter to the detector Diffuse: uses the target object to return the energy from the emitter to the detector

142 GP2D02 SENSOR Measures distance in range from 20 to 80cm.
Designed to interface to small micro-controllers. It’s relatively insensitive to the color and texture of the object at which it is pointed. Low current consumption at stand-by mode (Approximately 3 A). Actual Sensor Size

143 Distance Measurement by Triangulation
IR LED Transmits a bundled beam to the object plane. Reflected beam is receive by the photo detector(PSD). The angle of the received beam depends on distance of the object plane. Two Different Object Planes

144 Structure of Photo Diode
N-conductive substrate layer is an isolation layer P-conductive layer is embedded in isolation layer from IR irradiated Contact of the p-layer is made on left and right side Structure of a position sensitive photo diode(PSD)

145 How PSD Measures Distance?
Spot irradiation in the center of the p-layer, both currents I1, I2 will have same value. Spot irradiation goes to the right, the I1 will decrease and I2 will increase by the same amount. The difference between the I1 and I2 will give the location of a spot irradiation on PSD.

146 PSD Continued Diodes in the Op-Amp’s feedback give a logarithmic behavior to the I-to-V conversion circuit. Collector current, Ic, in each Op-amp is identical to the I1 and I2. Third Op-Amp processes the difference of the two output voltages from previous Op-Amps. Vo =VT. ln(I1/I2) Circuit for position sensitive Current-to-voltage conversion

147 Distance Chart

148 Timing When interfacing with any type of hardware, timing is an issue.
Vin and Vout are control measurements. Vin drops to low for minimum 70ms. IR LED transmits 16 pulses towards the object. Mean value of 16 measurements reduces possible errors. Timing Diagram for Measurement and data handling

149 Configuration Sensor has four pins for electrical contact.
Pin 2 (IN) from the sensor connects to IR OUT. Pin 4 (Signal) from the sensor connects to IR IN. Pin 1 and 3 are connected to ground and +5V, respectively. SW1 and SW2 refer to bumper switches. Handy Board Connection

150 Example of Control Program
int distance = 1; /* Init and set the variable distance to 1 */ void range() { while(1) sleep(.30); /* Wait .3 seconds, without updating irRange */ pulse(1); /* Update irRange to new detected distance */ distance = irRange; /* set variable distance equal to irRange */ }

151 Continue void escape() { while(TRUE)
{ if(distance >= 150) /*If IR sensor detects object within a close proximity take evasive action*/ { escape_output_flag = TRUE; printf("STATUS = IR SENSE \n"); sleep(2.0); printf("\n"); escape_output= -30; escape_output1= -30; sleep(6.0); escape_output= -60; escape_output1= 115; sleep(10.0); escape_output= 30; escape_output1= 30; } escape_output_flag = FALSE;

152 OK! LET’S MOVE ON TO THE LAB!
BREAK TIME Any Questions So far? OK! LET’S MOVE ON TO THE LAB!

153 Lab Exercise Lab Objective:
Load pulse.icb , which is a compiled assembly object file. Pulse.icb enables 2 interactive C functions pulse() and irRange Every time you want the IR sensor to obtain a position, call the pulse subroutine, the position integer is updated in the variable irRange.

154 Continue Exercise: Write a behavioral program, using your bumper switches and the new IR sensor to avoid obstructions. Upon pushing the START button, the robot moves forward and stops after 3 minutes or the STOP button is pushed. After IR detector detects an obstruction: Backup a quarter of the length of your robot using the IC time commands, storing any constants set as persistent global variables for use in later programming (see page 12 of the Handy Board manual). Turn 45 degrees in either direction and continue forward.

155 IR Communication Notes:
Modulated infra red can be used as a serial line for transmitting messages. This is is fact how IR modems work. Two basic methods exist: bit frames (sampled in the middle of each bit; assumes all bits take the same amount of time to transmit) bit intervals (more common in commercial use; sampled at the falling edge, duration of interval between sampling determines whether it's a 0 or 1) Notes: you are strongly encouraged to pay careful attention to the exercises and problems given in your assigned readings. Projects, exams, homeworks and reports will use some of those, so it is in your interest to think about the answers to their questions, and work some of them out as practice. Also the additional recitations (Fridays) problems may appear on the exams.


Download ppt "IR sensitive - sense heat differences and construct images, night vision application Infra Red sensors."

Similar presentations


Ads by Google