1 / 22

Sensors

Material taken from Robotics with the Boe-Bot. Sensors. Where Are We Going?. Sumo-Bot competitions. Devices that Contain Sensors. The boebot uses sensors to interact with its environment.

Download Presentation

Sensors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Material taken from Robotics with the Boe-Bot Sensors

  2. Where Are We Going? Sumo-Bot competitions

  3. Devices that Contain Sensors The boebot uses sensors to interact with its environment. There are a variety of sensors used for a variety of purposes: smoke, sound,rotation/tilt,vibration, magnetic orientation, temperature, humidity, pressure, proximity, distance, light, and so on.

  4. Ultrasonic Distance Sensor PING Ultrasonic Range Finder Parallax Tutorial • PING ultrasonic distance sensor provides precise distance measurements from about 2 cm (0.8 inches) to 3 meters (3.3 yards). • It works by transmitting an ultrasonic burst and providing an output pulse that corresponds to the time required for the burst echo to return to the sensor. • By measuring the echo pulse width the distance to target can easily be calculated.

  5. Theory of Operation The PING sensor emits a short ultrasonic burst and then "listens" for the echo. Under control of a host microcontroller (trigger pulse), the sensor emits a short 40 kHz (ultrasonic) burst. This burst travels through the air at about 1130 feet per second, hits an object and then bounces back to the sensor. The PING sensor provides an output pulse to the host that will terminate when the echo is detected, hence the width of this pulse corresponds to the distance to the target.

  6. Limited Detection Range

  7. Simple to Connect http://learn.parallax.com/

  8. Programs Code---Without Library Support With the Ping library: #include <Ping.h> int PingPin = 9; Ping sonar(PingPin); void setup() { Serial.begin(9600); } void loop() { delay(50); sonar.fire(); Serial.print("Ping: "); Serial.print(sonar.inches()); Serial.println("in"); }

  9. Object Detection Using IR

  10. The IR Detector The IR detector is only looking for infrared that’s flashing on and off 38,500 times per second. It has built-in optical filters that allow very little light except the 980 nm infrared. It also has an electronic filter that only allows signals around 38.5 kHz to pass through. This prevents IR interference from common sources such as sunlight and indoor lighting.

  11. Schematics Ground Ground Ground Ground http://learn.parallax.com/

  12. IR Detection Range Less series resistance will make an LED glow more brightly. Brighter IR LEDs can make it possible to detect objects that are further away.

  13. Detecting IR The key to making each IR LED/detector pair work is to send 1 ms of a 38.5 kHz IR signal, and then, immediately store the IR detector’s output in a variable. The IR detector’s output state is HIGH (1) when it receives NO IR signal. When the IR detector sees the 38500 Hz signal reflected by an object, its output is LOW (0). The IR detector’s output only stays LOW for a fraction of a millisecond after the 38.5 kHz signal is sent, so it’s essential to store the IR detector’s output in a variable immediately after sending the 38.5 kHz signal.

  14. Code for Testing IR int LeftIRDec = 11; int LeftIREmit = 10; int RightIRDec = 4; int RightIREmit = 5; void setup() { pinMode(LeftIRDec, INPUT); pinMode(LeftIREmit, OUTPUT); pinMode(RightIRDec, INPUT); pinMode(RightIREmit, OUTPUT); Serial.begin(9600); } void loop() { int irLeft = irDetect(LeftIREmit, LeftIRDec, 38000); int irRight = irDetect(RightIREmit, RightIRDec, 38000); Serial.print(irLeft); Serial.print(" "); Serial.println(irRight); delay(100); } int irDetect(int irLedPin, int irReceiverPin, long frequency) { tone(irLedPin, frequency, 8); delay(1); int ir = digitalRead(irReceiverPin); // IR receiver -> ir variable delay(1); // Down time before recheck return ir; // Return 1 no detect, 0 detect }

  15. Object Detection And Avoidance Code Customizing the code: • Assign names to the pins • Remove the call to tone() in setup() • Change from avoidance to pursuit • More?

  16. QTI Line Sensor

  17. The QTI is a reflective object sensor. There’s an infrared LED behind its clear window and an infrared phototransistor behind its black window. When the infrared light emitted by the LED reflects off a surface and returns to the black window, it strikes the infrared phototransistor’s base, causing it to conduct current. The more infrared incident on the phototransistor’s base, the more current it conducts. How it Works

  18. Like an RC Circuit http://learn.parallax.com/

  19. Code for Testing QTIs int LeftQTI = 8; int RightQTI = 2; void setup() { Serial.begin(9600); } void loop() { long tLeft = rcTime(LeftQTI); long tRight = rcTime(RightQTI); Serial.print("tLeft = "); Serial.print(tLeft); Serial.println(" us"); Serial.print("tRight = "); Serial.print(tRight); Serial.println(" us"); delay(1000); } long rcTime(int pin) { // ..returns decay time pinMode(pin, OUTPUT); // Charge capacitor digitalWrite(pin, HIGH); // ..by setting pin ouput-high delay(1); // ..for 5 ms pinMode(pin, INPUT); // Set pin to input digitalWrite(pin, LOW); // ..with no pullup long time = micros(); // Mark the time while(digitalRead(pin)); // Wait for voltage < threshold time = micros() - time; // Calculate decay time return time; // Return decay time }

  20. Code for Detecting Reflection Customizing the code: • Assign names to the pins • Remove the call to tone() in setup() • Use multiple QTI sensors • More?

  21. Simple Connections http://learn.parallax.com/

  22. Mount the QTI sensor close to the ground

More Related