Introduction: Cheap IR Proximity Sensors for Arduino Robots
These infrared proximity sensors are small, easy to make, and super cheap! They work great on robots, for line following, edge sensing, and minimal distance sensing. They're also very, very inexpensive!
Step 1: Explanation: How They Work
In case you didn't know, I'll briefly go over how infrared sensors work. If you do know, feel free to skip this step.
Infrared proximity sensors have two components, an emitter and a receiver. The emitter is basically a little light that emits Infrared light wavelengths, which we can't see. The receiver can, however, so by measuring the strength of the reflected light, we can tell if something is there or not, measure small distances, and tell if a surface is black or white.
These work great in most cases, but will fall short in some cases, such as when sensing distance to non-reflective surfaces, such as black paper.
This is the same basic principle as many proximity sensors, though different sensors use different types of energy waves. Ultrasonic sensors use sound, LIDAR sensors use lasers, and Radar uses radio waves.
Step 2: Supplies: Parts and Tools
Here's a list of parts and materials you'll need:
(The links for parts are on eBay)
- TCRT5000L Infrared sensors (this link is enough for 10 sensors)
- DuPont female-to-female jumper wires (40 wires total, plenty of wires leftover when you're done)
- Soldering Iron with a fine tip (7$ iron that I've used several of, they actually work really well)
- Solder (Iron linked comes with some)
- Something to hold the sensors in place while soldering (I use masking tape, but a helping hands thing would work way better)
- Wire cutters/strippers
Total parts cost is $2.22, and you'll have enough for 10 sensors, plus leftover wires.
I should note that shipping on the linked parts is economy from China, so they'll take at least a month to get to you. You can find US listings with fast shipping, but they'll be a little more expensive.
Step 3: Wires: Cut, Strip, 'n Tin
Let's get started with preparing the wires.
- Separate 3 wires for each 2 sensors you plan to make
- Cut your wires in half
- Strip about 5MM or 1/4" insulation off the ends
- Tin your soldering iron with a bit of solder, and tin the wire ends by holding the wires over the solder, and applying the soldering iron on top.
Note for tinning: It works much better when you apply the iron to the wires, and then the wires to the solder, versus the iron to the solder. This ensures that heat is properly transferred to the wire, thus ensuring that the solder wicks into the wires correctly.
Step 4: Sensors: Prepare Leads
Now we'll work on getting the sensors ready. You can leave the leads long if you like, but it isn't necessary.
- Cut the leads so there's about 5MM or 1/4" exposed from the plastic sensor body
- Bend the GND lead from the Blue IR LED over so it touches the GND lead on the black receiver LED.
- Secure the sensors somehow, then solder the two GND leads together.
- At this point, you can add more solder to the leads still exposed, to make it easier to connect the wires later on.
Make sure you get the orientation and pins correct, otherwise your sensor just won't work.
Step 5: Wires: Connect Them!
Let's add some wires so we can connect it to a breadboard!
- Separate your wire ends so that there's about 2.5CM or 1" free for each wire
- Begin soldering the wires, one at a time, to each lead on one side. A helping hand would make this part easier too, but I'm too cheap to pay for such luxuries.
- Once you're done, flip the sensors over and do the other side.
Note: Since the DuPont Wires are randomly colored, it isn't easy to stick with a color convention, so I'd just recommend keeping it consistent between sensor pairs. I usually try do them in order, with GND, Sense, and then +5V, with the darkest end color being GND.
Step 6: Finished! Testing and Usage Instructions
Now you've got yourself some handy little infrared sensors! Some suggested uses are for line-following robots, edge sensing, and maybe some basic distance sensing. You could use them for sensing objects in front of a robot, too.
To use them, wire the GND up to Ground (Surprise surprise). +5V goes through a 220Ohm resistor to 5V, and the Sense pin goes to an Analog in pin on your micro-controller, with an additional 10K resistor connecting it to 5V. I'm sure you could use these at 3.3, and maybe even 12V.
Once you're into coding, the higher the value returned by the sensor, the less IR light it's receiving.