ir

DIY Night Vision Camera

I found this Instructable about how to make your own night vision camera. It seemed to be a fun project, so I decided to give it a try.

The first step is to remove the infrared (IR) filter from the camera. I broke my first camera attempting to do this. I was far more careful with my second one and successfully removed the filter. The little blue chip is the IR filter:

IMG_5319

This is how the photos look with the IR filter removed:

P1010003
Kitty is not impressed.

After successfully removing the filter, the next step was to build an IR LED array to be used as a light for the camera. With a little bit of help, I was able to laser cut a perfect array of holes for the LEDs. Following the instructions, I assembled the LED array and turned it on, only to be disappointed by an incredibly dim light.

What went wrong? Here’s the point where I confess that I am relatively new to electronics, and so there are certain lessons that are yet to be learned.  I wired the LEDs incorrectly. I got a second batch and wired them together.

IMG_8372

And still the array was too dim. It was time to really understand how the circuit of the array worked. There was something more at play here. I found a really cool LED array calculator online that helped me get to the bottom of my problem. I had to examine the LEDs more closely. The instructions use infrared LEDs from Radio Shack, which have a 940 nm wavelength, a 100 mA forward current and a 1.28 volt forward voltage. My first two attempts used LEDs that had a forward voltage of 1.5 volts, which meant that the LEDs were not getting enough power. I ordered a new set of IR LEDs with a lower forward voltage of 1.2 volts and assembled the array for the third time.

IMG_8378

The third attempt was better. With the new array, I was able to capture photos in the dark!

A hand in the dark

 I did a little test to get a feel for how well the camera worked. First, I set up a small scene to photograph. I was interested to see how the camera could capture color and detail. Here is the control photo, taken with my normal camera:

Control Photo

First, I took a photo with the lights on. The room was somewhat dark, so the photo did not come out very clear:

Lights on

Next, I took a photo with the lights off, about one foot away from the objects. The detail was still somewhat clear, although differentiating colors was not really possible.

P1010082

The second photo was taken from two feet away. At this point, some objects are no longer visible.

Two feet

The final photo was taken from three feet away. The objects are almost imperceptible at this point.

P1010079

Although it was fun to build this, it isn’t very practical for real-world use. The major problem seems to be the power, as the 9 volt battery drains very quickly and is not strong enough to power many high-power infrared LEDs. If I go back to this project, the first step would be to build an array with a larger power supply and brighter LEDs. In the interim, I will just have to be content with taking nighttime pictures of things up close.

Arduino and Sensors

I’ve been busy putting the finishing touches on a class I am teaching at NYC Resistor called Arduino and Sensors. The purpose of this class is to teach people how to use common sensors with Arduino so they can build awesome interactive projects. The class features the Adafruit Sensor Pack 900, as this pack contains a nice selection of common sensors. I’ve written some sample code for each of the sensors in the pack. We will discuss both digital signal and analog signal sensors.

Sensors!

Digital signal sensors are the simplest to use. They simply return a 1 or a 0 based on the reading of the sensor (just like a switch, it’s on or off). Therefore, reading the state of one of these sensors is as simple as hooking the output of the sensor to a digital pin on the Arduino (pins 2-13 on the Uno) and calling digitalRead() on that pin. Here is a simple example – an IR sensor:

IMG_6848

Analog signal sensors are more complex. These sensors return a voltage on an analog pin somewhere from 0 volts to the max voltage of the microcontroller (with the Uno, it’s 5 volts). In order to read an analog sensor value, the sensor output needs to be connected to an analog pin on the Arduino (pins A0-A5 on the Uno). In the code, calling analogRead() on the analog pin will give you the sensor reading. The Arduino automatically converts the voltage on the analog pin to an integer between 0 (no power) and 1023 (full power). Generally, the reading can be mapped back to some meaningful value. For example, here is a simple analog sensor – a temperature sensor:

IMG_6832

According to the datasheet, this sensor returns 0 volts at -50 degrees Celsius and 1.75 volts at 125 degrees Celsius. It has a scale of 10 millivolts per degree Celsius. To get the raw voltage reading, we take our reading value, divide it by 1024 (to get the percentage of the full voltage) and then multiply that by 5 (since the microcontroller is supplying 5 volts). To scale the voltage to the range, we can simply multiply the voltage by 100 (according to our scale factor, 1/100 volt is 1 degree Celsius) and then subtract 50 (since zero volts is -50 degrees Celsius).

Of course, many sensors are more complex than just reading a simple pin. We’ll discuss a number of different scenarios and how to handle them. Did you ever wonder what the AREF pin is for? It’s the analog voltage reference pin and we will be discussing how to use it. We’re also going to use potentiometers to tune the sensitivity of some of the sensors.

The class is already almost sold out! If all goes well, I will hopefully teach it again soon!