Saturday, November 16, 2013

Recycling an IR LED for timelapse movies with Arduino

In this post, we are going to reuse the infrared LED inside a recycled remote controller for periodically activating the shutter of a digital camera in order to create a timelapse video like the following one.



In Japan there are many recycling shops where you can get old electronic junk for a cheap price. It's a very ecological way to learn about electronics, so I went ahead and bought a DVD remote controller at hard off.


Most remote controllers are based on infrared communication. Although humans can't see infrared light, I found out that the CCDs inside most cameras do. This can be useful for making your own infrared night vision camera (maybe a future post), or just for quickly checking whether your remote control is working or not.


Now let's go inside the device: remove the batteries and screws, and open it up by pressure. A remote controller typically consists of the following elements:
  • A case made of ABS plastic.
  • A PCB containing button switches and the control circuitry.
  • A button panel made of silicone rubber. Each button has a layer of conductive paint underneath. When pressed it connects button switches on the PCB board.

Here is a sketch of the remote controller I got from hard off. It's a very simple circuit consisting of:
  • Electrolytic Capacitor (47uF 10V): removes high frequency noise or peaks in the power supply. A general rule is to use one that supports at least double the normal voltage (10V > 2x3V).
  • Ceramic resonator (4MHz): it works like quartz crystals but has bigger tolerance, it's cheaper and smaller (includes built-in capacitors). Used to create the carrier wave for infrared communication.
  • Resistor (2.2 Ohm): not sure why such a low value.
  • Transistor (C3203 NPN): for switching the LED on and off.
  • IR LED: a LED that emits light in the infrared range (e.g., 950nm).
  • IC: the chip where all the logic takes place. I couldn't identify which IC was used here, but I'm guessing it's something similar to the PCA8521. Button switches are wired to the IC, which (I guess) performs internally a loop (it could be done with flip-flops too) and polls the status of each button switch. Next, the IC selects the corresponding code from an internal ROM (customized during fabrication) and sends a modulated pulse wave through the IR LED.
For more information about remote controllers check this article.


In this post we are going to recycle the IR LED and save the remaining electronic components for a future circuit. An easy way to desolder components is to use a desoldering braid.


Once you desolder the LED, connect it to an Arduino digital pin using a resistor to limit the current running through (Arduino can handle up to 40mA). I'm using a 5V power supply and the LED's voltage drop is 1V so a 220 Ohm resistor will give me 18mA which is good enough to power the LED.
The final step wildly depends on your camera model. I have a Sony NEX-5 and fortunately there was a nice person that made the corresponding Arduino code public here. For different models you have to google a bit, and maybe modify existing arduino code, but it should not be too difficult (here you have code for Nikon cameras). Once you have taken interval pictures, put them together in a video with a command such:
mencoder -idx -nosound -noskip -ovc lavc -lavcopts vcodec=mjpeg -o output-rec.avi -mf fps=15 'mf://@files.txt'

No comments: