My latest hobby projects have been using an Arduino microcontroller board:
So far I have built an automatic garden watering setup using a 12VDC solenoid valve connected to my garden hose. (I'll hopefully get the details on this posted later) And this, an automatic camera trigger for capturing shots of lightning bolts.
An example of it working in my hotel room:
The idea came to me while I was out taking pictures in the Florida wetlands and a massive storm system started rolling in. As I was walking back to the car - which at this point was about 1.5 miles away - I started to see a pretty amazing lightning show on the horizon. I could not, however, make my trigger finger react in time after seeing a lightning bolt in order to capture a shot of it. After doing some quick research, I came up with this Arduino project. Here is the rundown... Materials required:
- Arduino Uno (Radio Shack or here)
- 220 Ohm Resistor (Radio Shack #271-1313)
- Light Dependent Resistor aka photoresistor (Radio Shack #276-1657)
- Breadboard (Radio Shack #276-002 or smaller)
- Infrared (IR) Transmitter (Radio Shack #276-0142)
- This will come with a transmitter and receiver. The transmitter is the darker of the two.
Wire up the LDR (photoresistor) with one leg connected to the 5V and the other to the 220 Ohm reistor and A0 (Analog Input, pin 0). The other side of the resistor connects to ground. The IR transmitter is connected to D13 (Digital Out, pin 13) and ground. It acts like an LED, so the long leg (positive side) must be connected to pin 13. A short side note: this reminds of me of a few years ago, hacking the original Xbox to put in a modchip. I had a bright blue LED that I wanted to solder on the board for power indication, but the clearance to where I wanted to mount it was not enough, so I clipped the legs shorter. This is when I learned that polarity in LEDs matters, and if you clip the legs, make sure you clip the ground side shorter, or in some other way mark it so you remember. LEDs will not function if wired backwards.
Back to the setup... if you wire it as shown in this breadboard picture:
Or this schematic:
... all you will have left is building the "sketch" - what the Arduino community calls the software / program. I will assume you already have a working knowledge of sketches and setting up the software on your computer and will not go into those details. If this is your first project, I highly recommend picking up the book Getting Started With Arduino by Massimo Banzi (co-founder of Arduino) from Radio Shack or any book store. It goes well with the Arduino Uno starter kit.
A couple things to note:
- This currently is being powered from my USB port. Arduinos are designed such that once the sketch is compiled and uploaded, it is stored in the EEPROM, which has a sort of (very) miniature flash drive inside to store the machine code. Therefore, in order for this to be of any use, I would need to wire in a battery pack to power the board out in the field. Once the batteries are switched on, the Arduino runs the loop() part of the code continuously until power is removed.
- Once the prototyping is complete and I have verified it works properly, getting a printed circuit board (PCB) manufactured to reduce the footprint might be something to look in to. The software I used to draw the above schematic and breadboard layouts is called Fritzing. Oddly enough, it works on Linux (as well as Windows and Mac), and is a very well put together program - something I would even be willing to pay money for. Once you have drawn up the circuit within Fritzing, you can order a PCB from within the software and Fritzing Fab will manufacture it and send it to you for $0.92/sq cm. IE, something like this would cost me less than $10 for a professionally manufactured circuit board: