I have always wanted an inexpensive way to take unobserved pictures of wildlife in my neighborhood. This instructable takes parts of two existing instructables and brings them together with added features to create a cheap motion detection wildlife camera.
This project uses a re-purposed PIR sensor module from an air freshener to provide motion detection, an inexpensive key chain camera to capture images, and a TI msp430 microprocessor to provide the necessary brains. The microprocessor comes with TI's $4.30 Launchpad experimenter kit.
Remove these ads by
Signing UpStep 1Parts and Tools
Materials:
1. Re-purposed PIR sensor module from an Air Wick Freshmatic Compact i-Motion
Air Freshener. See the links below.
2. Key chain Vivitar Mini digital camera (available at CVS or Walgreen's)
3. Project box from Radio Shack (270-1803) size 5" x 2.5" x 2"
4. MSP430G2211 microprocessor (part of TI Launchpad experimenters kit)
5. Proto board from Radio shack (276-148) size 1.5" x 1.75"
6. 2 - 4.7k resistors
7. 3 - 0.01 uF capacitors
8. 1 - 1.0 uF Ta capacitor
9. 1- 14 pin DIP IC socket
9. 2 - general purpose NPN transistors (example: 2n2222 or 2n3904)
10. Single AA battery holder salvaged from air freshener
11. Single throw Single pole mini slide switch salvaged from air freshener
12. AA battery salvaged from air freshener
13. Hook up wire
14. Optional - Stained Glass Copper Foiling Tape (available at Hobby Lobby or other
stores that deal with Stained Glass supplies)
Tools:
1. Solder gun and solder
2. Wire cutters
3. Needle nosed pliers
4. Drill and drill points (I prefer brad points for cutting plastic project boxes.)
5. hand or powered jig saw
6. Hot glue gun and hot glue
Important Links:
PIR Module
http://www.instructables.com/id/Re-purposing-an-Air-Wick-Freshmatic-Compact-i-Moti/step4/Aproach-1B-Digitized-Sensor-Output-Small-Module
Camera
http://www.instructables.com/id/Hacking-A-Keychain-Digital-Camera-for-Arduino-Cont
TI Launchpad
http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_%28MSP-EXP430G2%29?DCMP=launchpad&HQS=Other+OT+launchpadwiki
Craftman Drill
http://www.sears.com/shc/s/p_10153_12605_00917310000P?prdNo=3&blockNo=3&blockType=G3
| « Previous Step | Download PDFView All Steps | Next Step » |






















































Your idea of solar powered yard lights is interesting. These lights actually work by recharging a single rechargeable battery and using a joule thief type circuit to boost the voltage high enough to light the LEDs that provide the light. The internal battery used in these lights are generally pretty crappy and have very low mah ratings (usually less than 600 mah).
The Vivitar camera used in the project has a boost power regulator, so the joule thief part of the circuit of the yard light should not be used.
A issue with rechargeable NiMH batteries is that internal resistances cause them to discharge if not used. Older technology batteries would discharge in a matter of days if not recharged. Newer technology batteries are much better. This means that you could possibly replace the original yard lamp batteries, strip out the joule circuit, and only use the solar cell part. I would use a high mah new technology NiMH battery in the camera with the solar cell portions of the yard lights connect via an external plug. I would also use multiple modified yard lights in parallel (most likely at least 4) to provide a higher current for recharging. You do not need a blocking diode, if setup this way.
It is an interesting idea, thanks for sharing.
i think i totally messed mine up and i just wanted to see what i did wrong.
thanks!
The best picture I have is the one I added to step 6. The most likely way to mess up this board is if you have the wrong perspective of the IC socket. Remember the IC socket is on the opposite side of the board from the copper wiring. The pins are labeled as if you were looking through the copper side of the board. You can't see the IC socket when you are looking at the copper side of the board.
Here are some checks that you can make with an ohm meter. Refer to the primary image on step 6.
1. Place circuit board on a table with the microcontroller facing up.
2. Remove the microcontroller and put it aside.
3. Set your meter to 100k ohm scale.
4. Place the positive (red) lead in the IC socket at pin 1.
5. Place the negative (black) lead in the IC socket pin 2. The reading
should be max scale.
6. Repeat by moving the black lead to pins 3, 4, 6, 7, 8, 9, 11 ,12 ,13 ,14.
All of these piins should also read max scale with the red lead in pin 1.
7. With the red lead still on pin 1, place the black lead on pin 5. The reading
should be about 47K ohms.
8. Repeat by moving the black lead to pin 10. It should also read 47K ohms.
9. Place the red lead on pin 5 and the black lead on the wire marked PIR in
the picture. The meter should show a short or about 0 ohms.
10. Place the red lead on pin 6 and the black lead on the wire marked
Shutter in the picture. The meter should show a short or about 0 ohms.
11. Place the red lead on pin 7 and the black lead on the wire marked
Mode in the picture. The meter should show a short or about 0 ohms.
12. Place the red lead on the pin 14, now touch the black lead to each lead
of each capacitor, one side of the capacitor at a time. Each capacitor
should have a zero ohm side and a max scale side.
If you pass these tests, your board is most likely ok.
Were you able to program the msp430 without any problems?
Hope this helps you.
When soldering the non-insulated wire, I solder at the corners of a straight run and where component leads or jumpers touch the run. It helps to use a pair of pliers or a soldering heat sink clip between a previous soldered joint and the one I'm working to prevent the first solder joint from coming undone.
On this particular project, I was experimenting with copper foil glazing tape that is used by stained glass hobbyists. You can get a lifetime supply for about $6 at hobby shops. I cut the tape I had lengthwise in half to make the runs. I use this tape for various odd connections in some of my projects. It can come in handy.
The tape worked and I think it looked neater. I have now moved on to making my own PC boards using the toner transfer method.
Port 1 interrupts on the MSP430G microprocessors are set only on transitions, not static levels. P1IES is the Port 1 interrupt edge select register. So I believe the only 2 portions of the code that would need to be changed is:
Portion #1
From:
// turn on p1 interrupts
P1IE |= BIT3; // Enable p1 interrupt for p1.3
P1IES |= BIT3; // Interrupt edge select, high-low (falling edge)
P1IFG = 0; // clear p1 interrrupts
To:
// turn on p1 interrupts
P1IE |= BIT3; // Enable p1 interrupt for p1.3
P1IES &= ~BIT3; // Interrupt edge select, low-high (rising edge)
P1IFG = 0; // clear p1 interrrupts
Portion #2
From:
// if band time is reached and p1.3 still 0
else if ((band_flg == 1) & ((P1IN & BIT3) == 0))
To:
// if band time is reached and p1.3 still 1
else if ((band_flg == 1) & ((P1IN & BIT3) == 1)
I haven't actually tried these changes, but I feel confident that is all it will take.
Let me know if you run into any issues.
But for future reference, the Radio Shack PIR module produces enough pulses that it works with your original code despite outputting a low-high detection transition.
The one thing I had to do to make it work was add an NPN transistor between the PIR and pin 5 of the microprocessor as a switch. Base to PIR output, emitter to ground and collector (pulled up to Vcc with the 47 k resistor) to pin 5. That's because the output level was about 70% of Vcc, which doesn't seem to be enough to trigger the microprocessor. With the switch added, the system seems to be working fine.
bioyas,
The Radio Shack PIR module is made by Parallax. Parallax has updated the sensor to a Revision "B" which extends the Vcc range to 3.3 - 5 V among other improvements.
I am curioius, Is your sensor a Revision "A" or "B"? There should be small text on the side with the lens that says "REV A" or "REV B".
The use of a NPN inverter between the module and the MSP430 would invert the logic of the module so that the MSP430 would see a "high to low" transistion on a PIR trip. So the original code should work without issue.
Did you try using either an external or the internal pull up resistor in the MSP430 on pin 5, instead of the transistor? The logic would then be "low to high".
To turn on the internal pull up resistor on pin 5 (p1.3) you would change
from:
P2DIR |= BIT6 + BIT7; // all p2 pins output
P1OUT &= ~(BIT4) + ~(BIT5); // p1.4 and p1.5 output low
P2OUT |= BIT6 + BIT7; // all p2 pins high
to:
P2DIR |= BIT6 + BIT7; // all p2 pins output
P1OUT &= ~(BIT4) + ~(BIT5); // p1.4 and p1.5 output low
P1REN |= BIT3; // enable internal pullup/pulldown resistor on p1.3
P1OUT |= BIT3; // internal resistor on p1.3 set to pullup
P2OUT |= BIT6 + BIT7; // all p2 pins high
To use an external pullup resistor, you would just have a 47k resistor from Vcc to the PIR output. The PIR output would also be connected to pin 5 of the MSP430.
All that aside, I am glad you got it working. I am sure others will be using your instructions to make the camera with the Radio Shack / Parallax PIR sensor. It is a nice sensor.
I really appreciate you sharing your findings.
Any inversion from the transistor is irrelevant. The PIR module puts out a high level pulse when motion is detected, which returns after a period of several seconds, so for each detection, you get both a rising and falling edge. The falling edge is delayed by the length of the pulse, which for my purposes doesn't matter. So it should work no matter which polarity of pulse edge you set up the MSP430 for. I just couldn't get the low-high transition setup to work at all - not sure why.
The purpose of the transistor switch wasn't to invert the signal, but to bring the high level output of the PIR closer to Vcc. Even with the 47k pullup resistor (external only - I'm aware of the internal pullup option but didn't try it) it only went up to around 1.8 volts when directly connected, which wouldn't trigger the MSP430. The transistor brought the high level up to close to Vcc, and allowed the MSP430 to trigger properly.
So in any case, the code works with the Parallax PIR, provided the extra transistor switch is inserted between the PIR output and the MSP430 input. Further work might result in a simpler solution, but I'm out of time and it's working ...
The download link for the code seem to be broken.
It only allow you to download a .tmp file. I don't know for what it's useful. It appear in the link too.
Can you verify the download link?
Thanks (your project interest me).
You are the second person who indicated that they had issues downloading the code. I decided to investigate a little farther. I bet you are using Firefox as your browser.
Since the file has a .c extension, Foxfire opens a window titled "Opening F8UY5....YYY.tmp" and asks "What should Firefox do with this file?". You should click on the the "Browse..." button and select Notepad (Window) or gedit (Linux). Hit the OK button once or twice, then save the file with the name that you desire.
I will add a .zip version of the file to prevent confusion in the future.
I appreciate your comment. It will help others.
thanks!
I searched back through my project photos and found a picture of a partially completed bread board. I added it to the secondary images on step 6. It should give you a general idea of how I did it.
I hope it helps.
I just wanted to thank you for this "ible" and for introducing me to the Texas Instruments MSP430-series micro controller at $4.30/shipped each! Who knew a fun and versital little controller could be bought so cheap so I bought several! I am well on my way to collecting all items necessary to complete the motion camera. I also wanted to tell you and audience that I found a cheaper source for the PIR on Ebay if you can wait for it to be shipped from China. It's from seller "hi-etech" and is less than $5 (or offer) called "Pyroelectric Infrared PIR Motion Sensor Detector Module". If you want a PIR with LED lights that can be used at night, there is another ebay source item called the "Infrared PIR Sensor 6-LED Light Lamp Motion Detector" for cost of $4.15/shipped from seller "700store", also from China. Use as is or swap out the LEDs for 850n infrared LED so you don't startle the critters! With the PIR detector mocule you don't hack anything to obtain it. (it's not just the PIR but the whole module!) The other one just needs disassembly. With either one you just give it power and tie the output lead into your "ible"! With your camera sourced at $10, the micro controller at $4.30, and the PIR sourced under $5, that comes to $19.30 which leaves plenty of wiggle room for purchase of project box, breadboard, transistors, etc. One other thing. If you spend just $3.88 over the recommended camera, you save 2/3rds the space making it possible to use a project box 1/2 the recommended size. The cheapest miniature "spy" cameras can be had on Ebay, again from China, for $6.98/shipped plus Sandisk 2gb memory card for $6.88/shipped. Note: by changing to different camera, you may need to modify the source code for the MSP430 and if you do, please post it? Happy snipe hunting!
I actually have a type 808 key-chain spy camera (see FAQ on last step). It is a lot of fun. I am still looking for a project to best utilize its small size and video capabilities.
If you are looking at these cameras I strongly suggest that you look at this site. http://www.chucklohr.com/808/C8/index.html
It turns out that they come in many flavors, with some being better than others.
Also be sure not to leave it on charge for a long time. The camera has no provision to keep from overcharging and damaging the battery.
I also think that the MSP430 launchpad is a great deal.
Thank you for the good info and the kind words.
.
thanks!
I finally got around to checking the menu on both cameras. They both take the same number of button presses to get to the high resolution/compressed mode that the wildlife camera uses.
One differences is the code that you see in the mode LCD located on the front of the camera. For the Vivitar, the mode code is CP, which gives you 60 images at 352x288 compressed. For the Aries, it is Hd, which gives you 76 images at 640x480 compressed.
Bottom line is that you should not have to change the program.
In addition to the Vivitar camera that I used in the Instructible, I believe that the newer Aries 3-in-1 camera (without preview screen) being sold by Walgreens will also work without any changes to the instructible. I haven't actually tried it, but the instructions and features appear to be the same. The original Vivitar camera is available at CVS and some Walgreens.
The advantages of the Aries is that the resolution is a little higher (640x480). It also has a slighly faster shutter and can take 25 hi res- no compression pictures instead of only 20. The cost is the same.
There are some differences in color balance and sharpness. Below are pictures of the same objects taken at night under CFL lights on my kitchen table. The pictures were taken hand held (no tripod). The first one (bluer one) is from the Aries and is 640x480. The second one (greener) is from the Vivitar and is (352x288). When I look at the mat and objects under CFL lights the mat is closer to the green. During the day under daylight, the mat looks more like the blue. Both images were uploaded uncompressed, I don't know what Instructibles does to the images.
I would use the Aries if I was doing it again due to the higher resolution.
thanks!
I am not sure of the fastest way to get a Launchpad board. My experience with the TI site is that they are pretty fast, if they have them in stock . They are frequently waiting for more. The Ti site is also the cheapest.
You can check Digi-key's live chat feature or call Mouser Electronics' 800 number to get delivery time estimates from these sources. They are a little more expensive.
Mouser -- $6.80 plus shipping
http://www.mouser.com/ProductDetail/Texas-Instruments/MSP-EXP430G2/?qs=CLImetaeaXWH2pYG%252bA%252b4Vw%3d%3d
Digi-Key -- $5.03 plus shipping
http://search.digikey.com/scripts/DkSearch/dksus.dll?lang=en&site=US&WT.z_homepage_link=hp_go_button&KeyWords=launchpad+msp430
Ask them for estimated delivery time. The Ti site might have a similar feature. I know that they give estimated delivery when you make order.
Hope this helps. I have had a lot of fun with my camera (especially with the squirrels around here).
thanks!
http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_%28MSP-EXP430G2%29?DCMP=launchpad&HQS=Other+OT+launchpadwiki
There is a wiki at
http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_%28MSP-EXP430G2%29?DCMP=launchpad&HQS=Other+OT+launchpadwiki
which has a link to the first page also.
sadly in my house all I have is macs, and that is where everything stops, I kind of followed someone on how to connect the TI chip to my computer, it was futile.
i even downloaded xcode, have no idea of what to do.
sadness!
great project to get my hand wet.
josefrancisco and ataylor5,
I do not have much experience on Mac, however TI does have a wiki on installing a toolchain for the launchpad on Mac OS 10. The link is at:
http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_Mac_OS_X
I hope this helps.
could anyone please show me a way to send the pictures from the camera straight to a computer when they get taken
You should be able to go to step 8 and click on the file. When I click on the file using IE, the c code is displayed as text in the browser window. I don't know if this is the way that browsers are configured or if it is because I have the .c extention set to open in a text editor. The file opens correctly for me with IE and Vista.
If you continue to have a problem, I can drop you a private email on your instructible account with the code. Let me know how it comes out.
The project's current usage in the different modes are:
Start up
(initial changing of modes / turn camera off): 120 mA for 21 sec.
Standby
(waiting to take picture, powering SRAM): 5 mA
Taking picture
(turn camera on, take picture, turn camera off): 120 mA for 7 sec.
Almost all of the current is being used by the Vivitar camera, the PIR module alone only uses about 1.5 mA and the MSP430 uses micro amps..
Using a power supply I determined that the camera's voltage regulator drops out at 1.15 volts.
I when to http://data.energizer.com/ and selected their Energizer Alkaline product group and looked at the specifications for their AA and D battery.
Since the voltage regulator drops out at 1.15V, I used the 1.2V data on their service hour chart and the 10 mA constant current drain point. I used the 10 mA curve for best case calculations. since a start up and zero pictures would equal only 21 seconds at the elevated current (120 mA) usage.
The AA battery would use 2200 mAh of the battery's potential of 2800 mAh (if allowed to drain to 0.8V).
The D battery would 20000 mAh of the battery's potential of 21000 mAh (if allowed to drain to 0.8V).
Best Case:
Assuming you turned the camera on with an AA battery and took zero pictures, the battery should last about 366 hours or 15.25 days.
If you used a D battery, the battery should last about 3333 hours or 138.8 days.
These are best case numbers. In actual conditions you would turn on the camera many times and take many pictures. Based on the 120 mA point on the service hour graph, a rough estimate would be that every picture shortens the best case time by 70 seconds and every turn on shortens the time by 3.5 minutes
This is all theoretical and your mileage may vary. Using off brand batteries would also have an impact.
I wouldn't want to leave my Canon PowerShot unattended, but your suggestion would be good for the backyard. The resolution would be much better. Since the batteries are on all the time I wonder how long it would last before dieing. Unless you have a spare, the UV filter used in the waterproof case you mention is going to cost you 4 to 9 bucks. You might be able to use a piece of plain glass.