September 2013

Arduino and Motion

Today I took the Making Things Move With Arduino class taught by Ranjit Bhatnagar at NYC Resistor. I was particularly excited for this class as all of my Arduino projects have been rather stationary. This class was a great overview of some different ways to add motion to your Arduino project. It featured the Adafruit motor party pack.

We had five separate gizmos to play with: one DC motor, one stepper motor, two sizes of servos and one solenoid.

Motors
Left to right: small servo, large servo, solenoid, DC motor, stepper motor

We also assembled the Adafruit motor shield which simplifies using multiple motors with an Arduino. There was a lot of soldering to do up front but it was worth it! Once everything was assembled, we got to play with all of the different types of motors. We even got to keep the motors so the fun could go on all night long!

Arduino and Motors

What was my favorite part of the class? THE MOTOR PARTY!!! WOOOOH!!!

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.

Fritzing

Recently, I’ve been spending a bit of time with Fritzing. It’s a piece of software that allows you to document prototypes, design circuits and manufacture PCBs. So far, I have only used the breadboard view to generate wiring diagrams for my Arduino and Sensors class, but I am still very impressed.

One of the circuits in my class involves wiring an accelerometer and a switch to an Arduino. Here was my attempt to photograph the circuit:

IMG_6845

From the photograph, it’s not very clear on how to wire the accelerometer. There are too many wires in the photograph and it’s not easy to see where each wire terminates. Of course, I could try to recreate this circuit using wires with less slack, but there is a simpler solution – use Fritzing! The image generated by Fritzing makes it much easier to understand how the accelerometer is wired:

accelerometer_cal

It’s fast and simple to generate the wiring diagrams. Fritzing has a bunch of predefined components (such as breadboards, switches, resistors and Arduinos) that you can drag and drop together. There’s also a great snap-to-grid functionality that ensures that components are connected. Fritzing allows you to import component libraries from other vendors so that you can prototype with correct representations of the components. For example, the accelerometer object comes from the Adafruit Fritzing library.

I’m really glad to see that there are excellent open-source tools available for this kind of thing. It makes sharing knowledge much easier. I’m already impressed by the breadboarding functionality, so I am looking forward to tinkering with the schematic and PCB views!