IR Infrared Motion Detection Sensor Module
- Working voltage: DC 5~20V
- Static power consumption: 65 microamps
- Detecting range: <120 degrees cone angle (within 7 meters)
Got this from Dealextreme.
HC-SR04 Ultrasonic Sensor Distance Measuring Module
- Working voltage : 5V(DC)
- Current: 15mA (less than 2mA quiescent)
- Output signal: Electric frequency signal, high level 5V, low level 0V.
- Sensor angle: Not more than 15 degrees.
- Detection distance: 2cm~450cm.
- High precision: Up to 3mm
- Mode of connection: VCC / trig(T) / echo(R) / GND
- Module Working Principle:
- Adopt IO trigger through supplying at least 10us sequence of high level signal
- The module automatically send eight 40khz square wave and automatically detect whether receive the returning pulse signal
- If there is signals returning, through outputting high level and the time of high level continuing is the time of that from the ultrasonic transmitting to receiving
/* HC-SR04 Ping distance sensor] VCC to arduino 5v GND to arduino GND Echo to Arduino pin 13 Trig to Arduino pin 12 Red POS to Arduino pin 11 Green POS to Arduino pin 10 560 ohm resistor to both LED NEG and GRD power rail More info at: http://goo.gl/kJ8Gl Original code improvements to the Ping sketch sourced from Trollmaker.com Some code and wiring inspired by http://en.wikiversity.org/wiki/User:Dstaub/robotcar */ #define trigPin 13 #define echoPin 12 #define led 11 #define led2 10 void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); } void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); // duration = pulseIn(echoZ, HIGH, 15000); distance = (duration/2) / 29.1; // if (duration > 11640) distance = 200; if (distance < 4) { // This is where the LED On/Off happens digitalWrite(led,HIGH); // When the Red condition is met, the Green LED should turn off digitalWrite(led2,LOW); } else { digitalWrite(led,LOW); digitalWrite(led2,HIGH); } if (distance >= 200 || distance <= 0){ Serial.println("Out of range"); } else { Serial.print(distance); Serial.println(" cm"); } delay(500); }
Got this from DealExtreme.
Maxbotix LV‑MaxSonar‑EZ1
- Resolution of 1 inch
- 20Hz reading rate
- 42kHz Ultrasonic sensor measures distance to objects
- Read from all 3 sensor outputs: Analog Voltage, Serial, Pulse Width
- Virtually no sensor dead zone, objects closer than 6 inches range as 6 inches
- Maximum Range of 254 inches (645 cm)
- Operates from 2.5-5.5V
- Low 2.0mA average current requirement
For the test setup, the sensor was on a tabletop, facing upward toward the ceiling, which was about 5' above the sensor. My palm was moved above the sensor, to acts as a target.
For the pulse width test, the values ranged from 100 (with the palm covering the sensor, to the ceiling which ranged in at about 10000. The values seemed to be linear, as the palm was moved up and down.
Some Arduino code on using data from the pulse width output pin.
/* Arduino EZ1 D7 PW */ int pin = 7; unsigned long duration; void setup() { pinMode(pin, INPUT); Serial.begin(9600); } void loop() { duration = pulseIn(pin, HIGH); Serial.print(duration);Serial.println(" microsecs"); delay(250); }
This is to demonstrate how to get data from the Analog pin of the sensor.
/* Arduino EZ1 A3 AN */ int analogPin = 3; int val = 0; void setup() { Serial.begin(9600); } void loop() { val = analogRead(analogPin); Serial.println(val); delay(250); }
Note: Reading serial apparently is not straightforward, because serial here is TTL levels, but the signals levels are inverted. So might have to do hardware inverting (like using an NPN transistor?). See here for an example for this.
TCRT5000 Reflective Optical Sensor module
- phototransistor type detector
- operating distance: 0.2 mm to 15 mm (peak 2.5mm)
- typical output current under test: IC = 1 mA
- integrated daylight blocking filter
- emitter wavelength: 950 nm
- module takes 5V input