Introduction: Cheap Motion Detection Wildlife Camera
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.
Step 1: Parts 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:
Camera
https://www.instructables.com/id/Hacking-A-Keychain-Digital-Camera-for-Arduino-Cont
Craftman Drill
http://www.sears.com/shc/s/p_10153_12605_00917310000P?prdNo=3&blockNo=3&blockType=G3
Step 2: Preparing the PIR Module
If you have followed the instructable https://www.instructables.com/id/Re-purposing-an-Air-Wick-Freshmatic-Compact-i-Moti/ your PIR module should look like the picture below.
We need to do a few things to make the module easier to fit into the project box.
1. Remove the two connectors.
2. Move the two large capacitors to the back of the board. Make sure that you put the leads in the same holes that you removed them from. These capacitors are polarized.
3. Attach wires to Vcc, Gnd, and PIR sensor output. The second picture shows where to connect the wires.
Step 3: Preparing the Camera - Part 1
Many thanks to smb and his instructable https://www.instructables.com/id/Hacking-A-Keychain-Digital-Camera-for-Arduino-Cont/ on his discovery of the hidden screw that you need to remove to open up the case of the keychain camera that we are using.
Since we know where the screw is, you can use a Dremel tool or a sharp knife to remove the material just above the screw. Once it is exposed, you can remove it and the case easily.
After the case has been removed, unsolder the piezoelectric buzzer from the back. This buzzer is pictured in the second photo below.
The third photo shows the location of the two switches that we will later remove and the location of the voltage regulator that will be used to power the PIR module and microcontroller.
Step 4: Preparing the Camera - Part 2
This step is the hardest of the project. You will remove the switches from the camera and replace them with transistors. You will also solder a wire to one of the camera's voltage regulators to source power tor the rest of the modules, and finally attach wires to the battery connections.
If you are a visual learner, you might find the diagram on step 7 helpful in understanding where the wires go. Also, the information in smb's instructible can help guide you.
When desoldering parts from a board with surface mounted devices, using solder wick is very helpful. It is a copper braid that "wicks up" the solder so the part can be removed easily.
Procedure:
1. Remove the shutter switch located near the top of the camera's PCB. This switch has two leads and two supports. You have to unsolder all 4 points.
2. Remove the mode switch located near the bottom of the camera's PCB. This switch has only the 2 leads holding it. There are no additional support points.
3. Solder a wire to the base of each of your two transistors. Note that you must know the pinout of your specific transistors, do not blindly fellow the pinouts I used. My transistors may have a different pinout than yours.
4. Solder a wire to the left most lead of the surface mount voltage regulator located just above the mode switch's location.
5. Directly solder the collector pin of one of your transistors to what was the left most lead of the mode switch.
6. Directly solder the emitter pin of the same transistor to what was the right most lead of the mode switch.
7. Directly solder the collector pin of your other transistor to what was the left lead of the shutter switch. Do not attach to the support point that is near the edge of the board. See the diagram on step 7, if you are unsure.
8. Directly solder the emitter pin of the same transistor to what was the right lead of the shutter switch. Again, do not attach to the support point.
9. Finally, solder wires to both the the positive and negative battery points on the camera's printed circuit board.
Step 5: Preparing the Camera - Part 3
To retain the use of the LCD screen you have to retain its support. I achieved this by using a jig saw to cut out the black plastic portion of the front of the camera case. This is shown in the photo below.
note: See FAQ on step 11 for alternate method.
The second photo shows the two screw posts that you want to retain to support the LCD.
The third photo shows the plastic piece mounted on the camera. You want to do this after you have completed the wiring to the camera PCB board.
You attach the screws from the back of the camera's PCB board into the plastic. I found I also had to create a third support using hot glue to get the LCD to work consistently.
Step 6: Wiring the Bread Board
The picture below shows how to layout the microprocessor bread board. The red traces are the runs made on the copper side of the board. A fourteen pin dip IC socket is represented as a black rectangle with the IC pins displayed in small blue squares. The socket is placed on the non-copper side of the board, and the numbering reflects this perspective.
All components are placed on the non-copper side of the bread board.
The two yellow traces shown in the picture are jumpers that are placed on the non-copper side of the bread board. The black circles represent connection points.
The second photo shows the schematic.
Step 7: The Circuit
The picture below shows how the modules of the Motion Detection Wildlife Camera are connected together.
note: Use the pinouts for your transistors. Do not assume they are the same as mine.
The diagram below does not show the plastic piece that you cut out to hold the LCD to the camera PCB board.
Step 8: The Code
The c code for the MSP430 microprocessor is attached below. The picture shows a simplified flow diagram of the program.
If you are new to microprocessors, particularly the MSP430, I suggest that you look over the instructions in the instructible https://www.instructables.com/id/MSP430-Based-Chronulator-using-Launchpad-chip/ . It gives a step-by-step on how to use the Launchpad and the IAR Kickstart compiler. For this project you only have to place the chip in the Launchpad and transfer the program, then put the chip in your bread board.
Step 9: Drilling the Project Box
I always find getting the holes in the project box correct a little daunting. I have tried to make it easier for you by providing the measurements in the three photos attached to this step.
Only the holes for the camera are critical, the holes for the PIR module and switch can be moved about slightly without any major concern.
Step 10: Assembling the Project
The picture below shows how the modules fit in the project box. I placed them in to the box in the following order.
1. Camera
2. PIR module
3. Battery
4. Microprocessor bread board
I wired each module's connections before I put it into the box. This made the soldering easier.
Each module is held in place by two small spots of hot glue. Consideration of how you would unglue if you had to should be made when tacking the modules into place.
I found that I had to add a drop of hot glue between the camera PCB board and the plastic holding the LCD in place to make sure of consistent LCD readings. The two screws were not enough.
Step 11: Using the Camera and FAQ
Operation
To transfer pictures from the camera you must install the driver and MyPicture application that came with it on to your computer. You do not need to install the bundled photo editing program. The camera has SRAM memory. This means that if the camera loses power the pictures are lost. We use this feature to re-initialize the camera.
To use, start with the switch in the off position, wait 10 seconds, then turn the switch to on. You will see the LCD switching through several modes. You have about 30 seconds after you turn the camera on to position it and walk away before it will start to take pictures.
When you retrieve the camera to see what you got, do not turn it off . Go to your computer and plug in the USB cable, start the MyCamera application, and download the pictures. After you have saved the pictures to your computer, you can turn the camera off.
FAQ
Q: What is the resolution of the camera and how many pictures does it hold?
A: In high resolution mode the camera's resolution is 352 x 288 pixels. It can hold 20 non-compressed pictures or 60 compressed pictures. The program places the camera in high resolution and compressed, so 60 images can be stored at a time. If 60 pictures are taken the program puts the camera to sleep.
Q: What is the best distance between target and camera?
A: Because of the low resolution you want to be close, but not too close. I have found 3 to 6 feet from the target is best.
Q: What is the range of the sensor?
A: The sensor can pickup large movements at up to 15-20 feet. An example would be a deer or human moving into the line of sight of sensor. At short range, less than 5 feet it can pickup a leaf blowing across the sensor. A very small movement, for example a squirrel moving a hand from a pile of seeds to his mouth without a stance change, might not trip the sensor. In this case, it helps to spread the seeds from a large single pile to a small area so the squirrel has to move a bit.
Q: How do I change the PIR's sensitivity?
A: We can't change the sensor's sensitivity directly, however we can change the system's sensitivity to a PIR trip. If you look in the code at the TA interupt service routine you will find the following lines:
// set band time
cntr_val = 15000; // 15000 ~= 0.125 sec <----------- line of interest
interval_delay(1,0);
cntr_val = 120000; // 120000 ~= 1 sec
By changing the cntr_val number in the line
cntr_val = 15000; // 15000 ~= 0.125 sec
we change how long a PIR imbalance must exist before taking a picture. I would not change it to a number less than 4000 (~1/32 sec) or more than 30000 (~1/4 sec) .
Q: Why didn't you write the code to take multiple photos when triggered?
A: I originally had the camera take pairs of pictures spaced by 5 seconds, but I decided that I preferred to have more "events" than sets of photos. It is just a matter of preference. The code change is easy. It depends on how long you plan to leave the camera unintended, the target that you are trying to capture, and the purpose of your shots. For example if you want to know if there are deer going to your location you would be interested in events and you might want to increase the minimum time between shots. If you are looking for cute pictures (what I'm doing) you might want to do sets of photos.
Q: How much did the project cost?
A: I was lucky and was able to buy both the air freshener and the camera from Walgreen's on sale. Together they cost me ~$10. Normally they would be double that. The microcontroller was part of the TI Launchpad kit which sells for $4.30 plus shipping. The project box cost $4 from Radio Shack. The other parts were in my junk box. So total cost between $20 and $30 dollars.
Q: Why didn't you just use the Launchpad instead of making a bread board?
A: I re-use my Launchpad for multiple projects, so I can't have it tied up in a project that I plan to keep for awhile.
Q: Why did you put the transistors directly on the Camera's PCB board instead of just attaching wires and mounting the transistors onto the microcontroller board, like smb did in his instructible?
A: My first thought was to eliminate two wires and make the microcontroller board simpler. In hindsight the collectors of both transistors could be tied to Vcc on the microcontroller board, so no wires are actually saved. You could put the transistors on the microcontroller board and just bring over a wire where the emitter of each transistor are currently connected. If I had to do it again, this is how I would do it.
Q: Could you not cut the front of the camera case, and attach it to the camera PCB
board?
A: This is another hindsight moment, the way I did it worked out easy enough, but I had a simple way to cut out the plastic. Others might not have this luxury, and retaining the whole camera case front should work. I believe there is enough room in the project box. You would want to remove the side with the USB plug so it would fit into the
hole in the project box side.
Q: Did you originally plan to use this particular camera?
A: No, I originally planned to use a type 808 keychain spy camera from eBay. They are higher resolution, smaller, and have video capability. I actually bought one, but the project kept being delayed because I was having too much fun with the 808 camera. When I had an opportunity to buy the Vivitar mini keychain camrea for $5, I jumped at it, and the project moved forward. If I had used the spy keychain camera the project would have cost about $20 dollars more due to camera price difference and need to purchase a mini-SD card.

Finalist in the
What Can You Do with a Dremel Tool?

Finalist in the
Joby Transform It! Challenge

Participated in the
Craftsman Tools Contest

Participated in the
Epilog Challenge
76 Comments
6 years ago
Instead using the USB, How can i send those captured pictures with companion of wifi to my telegram?
8 years ago on Introduction
Hi everyone,
One could also use Kerberos.io, it runs on the Raspberry Pi and it's also open source.
9 years ago on Introduction
Does anybody know how the lcd works? I have never seen an lcd like that before. How does the lcd connect to the traces?
9 years ago on Step 6
I forgot to ask what the jumpers are for.
9 years ago on Step 6
What a great project. I am really enjoying connecting the dots and want to make sure of a few things before I flip the switch and fry the whole thing. At top left of your schematic VCC goes to ground through two capacitors. One of them is marked (Tw) -- what does Tw mean? I wonder why there are two capacitors there? Thanks!
10 years ago on Introduction
Doug,
Thanks for your reply, error message number 2 persisted till then, but now OK.
I have another problem now, of my own making - I have ripped off the right-side bit of copper trace from the camera circuit board, the one to which the shutter switch was attached. Is there an alternate spot in the circuitry at which I could solder the emitter pin of the transistor to get the unit to function? Or is it now hopeless?!
Many thanks for a reply.
10 years ago on Introduction
Thanks for posting this project Doug!
I am trying it out but have been having some difficulty with uploading the code onto the chip, which in my case in an MSP430G2553. The compilers (I’ve tried with both the IAR and CCSv5 compilers) throw up three “error” messages and I am unable to fix these and proceed further for lack of programming knowledge.
The details are as follows:
Error 1. For the line marked in bold below, the message says "../main.c", line 148: error #29: expected an expression
Error 2. Also for the same line, and the message says "../main.c", line 148: error #20: identifier "j" is undefined
(I managed to ‘lose’ the second error message by inserting a line that said “unsigned int j = 1”/0 near the beginning of your code, but without really knowing what I was doing.)
void chg_mode_to_compressed(void)
{
// set mode to compressed high resolution
// turn off p1 interrupt
P1IE &= ~BIT3; // Disable p1 interrupt for p1.3
P1IFG = 0; // reset all p1 interrupts
interval_delay(1,1);
// push mode switch 8 times
for (int j=1;j<=8;j++)
{
Error 3. This has something to do with the timer as the message reads "../main.c", line 199: error #20: identifier "TIMERA0_VECTOR" is undefined
I looked up for help on this and changed the lines from
/******************* ISR ********************/
// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A0 (void)
{
To
/******************* ISR ********************/
// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer0_A0 (void)
{
This seemed to have worked with the compiler but I am not sure if I have chosen the right timer for the job. Please help and let me know what I did wrong.
Reply 10 years ago on Introduction
Letria,
It looks like that you found the solutions to your problems. The reasons for the differences in code when moving from the MSP430G2211 to the nicer MSP430G2553 microprocessor is that the MSP430G2553 has two timers instead of the single timer in the 2211.
The include line (#include msp430.h) at the beginning of the code, calls a file based on the microprocessor used. This file defines all of the interrupt vectors for the specific microprocessor.
The file for the 2211 (with a single timer) uses TIMERA0_VECTOR to define the timer. The file for the 2553 (two timers) uses TIMER0_A0_VECTOR and TIMER1_A0_VECTOR.
Note: There are other timer related interrupt vectors, but that would only add confusion to this
situation.
Luckly, the pin functionality used by this project is the same between the two processors.
The other error involving the for loop (for (int j = 1; j <= 8; j++)), I have seen before. Some compilers will accept declaring the loop variable in the for statement and some compilers will not. The version of IAR workbench that I originally used did accept this form. Apparently Code Composer 5 doesn't. You mentioned getting the error using IAR, I can only guess that they changed to be compatible with CC5.
The solution is as you discovered, is to declare j before the for loop:
From: for (int j = 1; j <= 8; j++)
To int j;
for (j=1; j<=8; j++)
It is interesting that CC5 recommends that the loop count down instead of up. In that case,
you could use;
int j;
for (j=8; j>=0; j--)
10 years ago on Introduction
There is no direct way to connect a DSLR to this project.
If your DSLR has a method of processing an external electronic shutter trip, you could modify the project to provide that signal based on activation of the PIR module. You would to need to know the specifications of the specific camera.
I would search for a project that more closely matched your needs.
10 years ago on Introduction
Hello! Is there a way to connect a DSLR camera to it?
10 years ago on Introduction
So after looking all over for the I motion, I decided to order it online and accidentally bought the scented oil one that plugs in. What would i need to do differently to make this work? I have almost no knowledge of programming or small electronics.
Reply 10 years ago on Introduction
I would recommend returning the scented oil product.
The scented oil product was designed to work on 120VAC. The circuit is extremely different from the air freshener used originally in this project.
Your best options are either use the original product (~$8), or use an inexpensive Chinese PIR module from eBay (search eBay with: "PIR module", ~$2 with free shipping), or use a Parallex PIR sensor module from Radio Shack (Cat# 276-135, ~$11). PIR sensor prices have dropped since this project was published, and the modules are easy to use.
All of these sensor options use 3 connections to hookup: Vcc, Gnd, and Sensor Output (marked PIR on circuit diagram).
If you use the original camera, the microprocessor program should work for all of the above options without modification.
10 years ago on Introduction
Doug, How much do you think the whole project cost you?
Reply 10 years ago on Introduction
If you have none of the parts, the cost would be about $25 to $40. The major expenses were the air freshener unit (~$8), the project box (~$7), the camera (~$10), the MSP430 kit ($4.30), prototype board and electronics (~$5-10).
My costs were very low because I was reusing parts from other projects, had the project box already, and bought the camera on sale ($5).
If you can't find the air freshener unit, Chinese built PIR sensor modules are now selling on eBay for $2. They can be substituted without much hassle. Also, keep your eye out for older digital cameras that can often be picked up at garage sales or thrift shops for a few dollars. These older cameras offer higher resolution and better images storage. You do have to figure out how to interface them, but that is often fairly simple and fun.
The Vivatar camera used in this project was very easy to re-purpose. I later played around with an Aries key chain camera for another project. The Aries camera was similar in functions and look, but the internals had been engineered to lower cost. It was much harder to interface the power and shutter.
Using an alternate project enclosure is another area that could be used to cut costs.
10 years ago on Introduction
Could you use an ATtiny45/85 with arduino software to do this instead of the TI launchpad controller? I see it is only using 4 pins (not including vcc and ground), and the ATtiny45/85 controllers have 5 analog/IO pins, so i think it could work. They are like $1.60 on digikey and i mainly use arduino, so these are better for me. I have been wanting to do a cheap security camera setup for some time but was looking for a cheap and compact option and this looks like it is perfect. Just got to get the camera and freshener.
Reply 10 years ago on Introduction
There should be no issue using an ATtiny45/85 as the microcontroller for this project. Of course, you would need to make approprate changes to the code and wiring.
I used the MSP430G2211 because it came as part of the TI Launchpad board. They send you the board which has a built in programmer and two MSP430 micros for $4.30. Since this Instructible was written, TI has upgraded the two microprocessors included with the Launchpad to one each of the MSP430G2553 and MSP430G2452. If this class of micros meets your needs, it is a heck of a deal.
11 years ago on Introduction
Could the battery life issue be fixed by gutting some solar powered yard lights and adding a blocking diode? Unfortunately I don't know enough about electronics to know what it would take.
Reply 11 years ago on Introduction
With an AA battery you could expect the camera to be active for about 2 weeks of continous use. Using a D cell battery would give you about 135 days. It is important that you never lose power, since the camera uses SRAM to store the images. In other words, if you lose power before downloading the images to your computer, you lose the images.
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.
11 years ago on Introduction
I have been thinking about doing something like this for along time but all the others i have looked at seem to involve a microprocessor board of some sort so thanks for this simple instructable
11 years ago on Step 7
would it be possible to send me some pictures of your finished circuit?
i think i totally messed mine up and i just wanted to see what i did wrong.
thanks!