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'

Mt. Takao (高尾山)

Mt. Takao (高尾山) is a 599m tall mountain very popular among people living in Tokyo because of its location, about 50min from Shinjuku.


On a good day, you can see Mt Fuji from there. Unfortunately, I didn't have luck this time so I can only show you some sprouts of the imminent momiji season.


Apart from nature, Mt Takao (in particular route 1) has an interesting collection of tengu sculptures worth the attention. Now let's go for the practical details:
  • Access: use hyperdia to find the best route from your home to Takaosanguchi station.
  • Hiking trails: there are several trails. My advice is to go up using route 6 (nature) and come down using route 1 (sculptures and temples).
  • Onsen: after the walk you can have a bath at furoppi (ふろっぴぃ). There is a free bus from Takasanguchi every 30min (1h on weekdays). When I was there last time, the price was either 800yen for having a bath (2h limit) or 2000yen for towel, yukata, relax room, manga library, restaurant etc.

Sunday, November 10, 2013

Maker Faire Tokyo 2013

A few weeks ago I attended the Maker Faire for the first time in my life. The event took place at two buildings: 日本科学未来館 (a.k.a. Miraikan) and 東京港埠頭株式会社. I had a great time and learned a lot so I thought I would share my impressions on things I found interesting:

  • DNA amplifier: this is a device commonly used in Biotechnology laboratories for amplifying segments of DNA via the polymerase chain reaction (PCR). Also known as thermal cyclers, these devices are usually very expensive (more than 800,000 yen). However, thanks to their Open Thermocycler Implementation you may be able to build it for less than 30,000 yen. They were using a pile of peltier devices for cooling. The only problem is that you also need some materials that are very hard to buy if you don't belong to some institution.


  • Music with solenoids: an interesting idea that uses solenoids for making drum beat patterns on dishware. A smartphone application is used for creating the patterns.


  • Moving magnets: an interesting phenomena in which a set of magnetic rings go up and down a metal stick due to a rotating magnetic field. The rotating magnetic field was created by removing the rotor from an induction motor. This device was invented by 佐藤慶次郎.
  • Bass reflex loudspeakers (バスレフ型): a guy who was designing his own loudspeakers. The design is based on a formulas and there are several types. He measured the frequency response by producing white noise with a computer, and then measuring the resulting sound with a normal microphone. Loudspeakers usually have separate speakers for the low and high frequencies, so a filter step is necessary. Since the required power is high, the coils, capacitors and cement resistors were quite big.
  • DIY Motor: this was a motor fueled with a mix of alcohol and some other substance. It also had an electric motor that served as the starter.


  • 3D printers: there were lots of 3D printers in Maker Faire. The ones I saw were mainly one of two types: 3-axis CNC-like 3D printers; and another type base on 3 columns. The CNC-like 3D printer above is an implementation of the FoldaRap open hardware, whose main feature is that of being portable.


  • Quadcopters drones: there were several booths with quadcopters. I especially liked the small quadcopter above. It was designed by @banboohill (twitter) who is planning to sell the board at some point in the future. It seems that he had a hard time due to the noise caused by the circuits powering the motors onto the digital part. The other big booth was from Tokushima University.
  • A GUI programming tool for Arduino: the authors (@takuo_o) created a GUI tool by which you can create filters, integrators or logical bifurcations on a browser, and then transfer the result to an Arduino board. They were using a board that included a capacitance-based touch sensor.
  • Airplanes made of plastic bags: some of them were made without motors. The armature was made with a 3D printer. Those which do use motors were made with circuitry from Hitec multiplex.


  • Power consumption and temperature sensing: this guy was trying to measure the power consumption and temperature of a tablet device through the USB port. He was using an INA226, which as an internal shunt resistor for measuring power and exports and easy-to-use I2C interface. For sensing the temperature he was using an LM35 temperature sensor.


  • Magnetic levitation: I was specially interested in this project since I had been planning on creating a similar one. The idea is to control the magnetic field running through the coil by using the feedback from a hall-effect sensor placed just below the coil. They were using an A1324LUA-T which you can buy at 秋月電子. By the way, the bluish components on the board are not resistors but coils.


  • Coin shrinking: applying a high voltage (7500V) to a coil causes an instantaneous huge magnetic field that while destroying the coil itself with a strong sound, it also happens to shrink a coin that was placed on top of the coil.


  • Timelapse movies: by using an Infrared LED it is possible to remotely control a camera for taking periodic shots. The guy in this booth is selling his device on switchscience.



  • MIDI devices: there were several instruments that were using a VS10XX shield for Arduino to transform sensor data into MIDI data that could be transferred to a device such as the SD-20 in the picture. In particular, an implementation of a Cello with long touch sensors and pressure sensors was amazing. I also liked this instrument.


  • Underwater robot: there was a robot based on OpenRov which can dive into the sea. They were making connections waterproof by using these paste.


  • Perfect rice cooker: @lonely_somen uses a temperature sensor (a long rod) and a servo motor to make perfect rice. Check out his video channel.


  • Exoskeleton: there was a regular performance of a few guys wearing this exoskeleton. The movement was very natural and looked stable.


  • Dice robot: this robot was very interesting because of the fact that it can fold itself into a dice.


  • Animatronics: this Yoda mask had servo motors inside producing a very realistic movement. Check out his video channel. I believe he made his mask by creating a Fiberglass mold (model in clay and poor fiberglass plastic materials); then pouring liquid silicone; and finally applying paint through an airbrush.


  • Laser pointer: this is a laser pointer inside a rubber.
  • Drums on your sleepers: implemented through pressure sensors. He used Arduino with a bluetooth board to capture the sensors data and transmit it to a host PC. The host PC (a MAC) contained a small Python script to receive the data and forward it to an application called SampleTank through an operating system bus like Linux DBus.
  • Arduino NTSC/VGA out: this guy was a veteran expert on creating NTSC and VGA output signals for Arduino. He was using this code for the VGA output. Check his youtube channel too.
  • Self-made oscilloscope: this guy made his own Oscilloscope. He wrote an article about it in Toragi. He was also using very cheap displays from 秋月電子.
  • Instrument with arduino: @ina_ani made an interesting instrument with Arduino.
  • Paper robots: this guy was making robots with paper.
  • Gun follower: this guy created a gun that can track targets in blue.
  • Leap motion: a guy used a controller called "leap motion" to move servo motors.
  • Nixie tubes and relays: there were many booths with nixie tubes (ニキシー管 in Japanese) and relays. It seems they are become very popular. A nixie tube contains Neon gas (and a bit of Argon and Mercury) and produces light through the glow discharge phenomena. Controlling a nixie tube requires applying 170 volts DC (obtained through a transformer) at a few milliamperes.
Other reviews about the Maker Faire:

OSC2013

A few weeks ago I attended the OSC2013/Fall in Tokyo. OSC stands for Open Source Conference, and it's a popular Japanese event for lovers of the Open Source movement. To give you an idea, it's similar to Europe's FOSDEM, although smaller in size.


Among the talks I went to, I specially liked these two:
  • MIST32: I was very impressed by the speakers of this talk. They have built an open source 32bit CPU called MIST32 on an Altera FPGA, and the corresponding Toolchain.
  • FlashAir: this was a talk for encouraging developers to write applications for FlashAir. FlashAir is an SDCard with an embedded wi-fi web server. The web server has a CGI-based interface by which you can manage the files stored in the SDCard remotely. Lucky enough, I got a card in a lottery after the talk.
Apart from the talks, OSC always reserves space for booths were groups of people and companies show their stuff. Among the booths I saw, I got specially interested into these two:
  • Tokyo Hackers Space: Hackerspaces are community-operated physical places, where people can meet and work on their projects. I must say that soon after OSC2013, I became a member of Tokyo's hackers space!.
  • Koedo Linux Users' Group: a group of Tokyo Linux users who publish their own magazine and organize meetings regularly.
  • Firefox OS: I could finally touch by myself a smartphone equipped with Firefox OS. They told me that the Keon model can work in Japan with a Docomo SIM card.
Finally, I must mention the LT (Lightning Talks) that put an end to the event. Japanese LTs are a lot of fun. Most of them are spiced up with humor and crazy stuff. This year the LTs had a special guest, 高野 麻里佳 (Marika), a very cute voice actress.