Saturday, February 23, 2013

Artificial Finger Arduino Critter Cam

I needed a reason to start a new project that would involve an Arduino. It came in the form of a mystery involving the dog food bin on my carport. For several mornings when stepping out of my back door to go to work I noticed the dog food bin lid was propped open. Some sort of critter was opening the bin and helping itself to the dog food. I wanted to know what it was and figured the Arduino would be a good build platform for an automatic camera that could get a picture of it.



I would need a camera and some way to detect when the dog food bin was opened and have it take some pictures. I had an older Samsung digital camera lying around and a small 110 volt DC solenoid that I thought could be used to press the shutter button. The camera shutter button also activated the auto-focus when it was depressed with about half of the force needed to actually take a picture. For this camera the auto-focus was needed in order to take decent pictures. Trying to get the solenoid and lever system to perform both the auto-focus and shutter actions turned out to be really complicated. I needed a simpler way to take a picture.

I pulled out my phone and thought about trying to use the Android camera API to take the picture. This I thought I could do but was really worried that the critter might find a better midnight buffet before I could code that up. I would then lose my chance to get some hard evidence on the perpetrator. The camera app was simple enough to operate manually so I figured that if I could make a simulated finger I could use the solenoid to have it touch the phone screen and take the picture.

Modern touch screen panels work on the principle of a change in capacitance caused by your finger touching the screen. A capacitor is made up of two conductive plates separated by an insulator. The capacitance can be changed by varying the area of one or both of the conductive plates. In the case of the touch screen there is a conductive layer behind the glass of the screen acting as one of the plates of the capacitor. The glass is the insulator and the other conductor of the capacitor is formed by a finger when it comes in contact with the glass. When the finger touches the glass the increase in capacitance changes the frequency of an oscillator which when measured can be used to determine where the screen has been touched. For multi-touch panels there is actually an array of conductors behind the glass which allows for the detection of more complex touches but the principle is the same. You still need a finger to operate it.


I had a pencil shaped touch screen stylus that I sometimes used with an iPad.  I found that it worked on the phone screen only when I was holding it by the metal body. When I touched the screen with the stylus insulated from my hand it did not register a touch. I had to find something that caused a change in the screen capacitance like a finger did. The stylus by itself could not do that.

I tried using a metal strap about the size of my finger hoping the metal would be enough to trigger a touch. That didn't work so I started adding larger and larger pieces of aluminum foil to the strap and it eventually did activate the touch screen. When a flat area of the metal strap with the added aluminum foil came in contact with the touch screen it acted like an artificial finger was touching the screen.


I built a frame for the setup out of wood that held the phone in place and used a hinge to make a swing arm for the artificial finger. I mounted the metal finger so that it touched the phone where the camera shutter button was on the screen. The solenoid pulled the finger over to the phone when activated and a small spring pushed it back when released. A junk box 30 volt printer power supply supplied enough power for the solenoid to operate the arm and a hook held it in place so that when released it was ready for the next picture cycle.

The critter only came at night so I would need to add lights as the cell phone did not have a built in flash. A quick trip to Harbor Freight netted an LED flashlight with 27 LEDs. I liberated the LED panel from the housing and mounted it to the front of the frame.

I now needed a small circuit board to provide for level conversion between the Arduino and the higher voltages and currents of the solenoid and LED panel. Some simple NPN switching circuits would do the trick so I grabbed some transistors from the parts bin, drew up, etched and drilled a circuit board using a sharpie, some copper clad and Ferric Chloride and then had what I needed to control the camera, the LED panel and the artificial finger.




I mounted a momentary switch on the dog food bin which would activate when the lid was opened and connected it to the Arduino. The phone was mounted on the frame and adjusted so the finger was lined up with the shutter button.  I then coded up an Arduino sketch to perform the necessary timing to take the pictures.  I placed the entire assembly on top of a table made of 2x10s and angled it down so the camera would be pointing where I thought the critters would likely be after turning over the food bin.



Here is a video showing Critter Cam operation.



Finally after a few nights of waiting I had pictures of those critters!


Also of Note: Trying to keep the phone from going to sleep while waiting to take pictures was a challenge. I tried simply taking a picture every few seconds but it would still sometimes shut the screen down and go into sleep mode. While fiddling with the phone charger I discovered that if I cycled the charger power while the phone was in sleep mode it would wake up and reset the sleep timer. So, all I had to do to keep the phone from going into sleep mode was to have it on a charger and cycle the power to the charger before it timed out and went to sleep. A solid state 110 volt AC relay connected to the Arduino did the trick. The Arduino sketch cycled the charger power every 90 seconds and that kept the phone camera application open and ready to take pictures all night long.

Thursday, January 10, 2013

Talk Box Megaphone Conversion

My father was practically a hoarder. A hoarder of any item that could remotely be useful for any purpose whatsoever at any time in the future. I am fortunate to have been the the recipient of one of these items - a professional megaphone.


My teenage son who plays the guitar asked me if I had ever used a talk box when I played electric guitar. You know like the one Peter Frampton made famous back in the 70s which makes your guitar sound like its talking.  I told him the story of when I took a small radio speaker, a aluminum funnel, a small wooden box and some sofa cushion foam and made one when I was about his age. The next logical step was to build another one of course. I immediately  thought of that old megaphone I had been saving in my attic for over 20 years and the gears started turning. DO YOU FEEEEEEEEL? LIKE WE DO!

The really great part about using a megaphone to make a talk box is that it already has a driver that is perfect for use in a talk box! In addition it has the parts needed to protect the driver from being blown. Here is what we had after dissembling it.



Here is a hand drawn schematic of the talk box that my son and I made together. All the required parts were available from the tear down.



 










 This is the transformer, lamp and capacitor from inside the megaphone.


My son's older brother then came in to help finish the project. Together they drilled out a section of the mouth piece and reversed the driver so that it pointed out the back of the megaphone. They then hot-glued a piece of plastic piping and filled in the area around the driver with insulation to keep the sound level as low as possible. After installing a 1/4" jack in the side of the bell and soldering up the wiring according to the schematic it was ready to go.

The finished product - one that Frampton himself would be proud of!