These sensors show a 5V -> GND drop when the unit was triggered.
Units are wired as follows, with the 4 pins facing the individual and left to right.
EN = NC
VCC = 5VDC input
OUT = 5V "High" / 0V "Low"
GND = GND
EN doesn't need any connections
VCC just needs a 5VDC source either 5V pin on the Arduino, Vin pin if voltage is right or digital pin set to high
OUT goes to any digital pin coded as an input, this will be 5VDC "high" when nothing is detected and 0VDC "Low" when something is detected
GND just needs a ground connection to complete the circuit.
For testing as shown in the code D7 was used as the input and the internal LED on pin 13 was the output to show a signal. VCC was plugged into the 5V pin and GND was plug into the GND pin next to 5V on the Arduino. EN was left disconnected.
From testing all units worked as expected, but they require calibration. Most units needed the first dial (Left dial when pins facing individual) to be turned 1/8th clockwise and the second dial to be turned 1/8th anticlockwise to get good results.
The reads were unstable when the dials were turn all the way (1/4th)
The IR LED and IR receiver also need to be parallel with each other for the best results
Jumper pin need to be in to power the IR LED.
These units are also pulse based. Not continuous like most other IR sensors. So a change of state is required for a pulse.
Example for usage:
Unit can be set up facing forward and you wave a hand in front the red LED on the IR board will light up, Arduino Uno pin 13 LED will light up during the movement.
If you wave a hand in front of it and keep your hand in the way, it will pulse and then return to a not detected state. Move your hand away and it wont pulse, move it back in front and it will pulse again.
Example code:
Comments
0 comments
Article is closed for comments.