Autocam, Camera with PIR sensor

Posted: December 14, 2009 in Uncategorized

Camera with PIR sensor for less then 10 euro!

This project I build just because I found a nightlight with PIR sensor and a mini digital camera for really cheap. I thought about using it for monitoring something like our cat´s entering and exit the house or point it at the garage door just for fun, to see what photo´s it would give me. It takes a photo at an interval of 44 seconds if there is motion detected. There is a timer set to make the camera not take to much photo’s in a small amount of time.

Components:

-Nightlight with motion sensor and 3 led’s (2,39 euro at the “action” store).
-Digital mini camera (4,95 euro at the “MAX” store).
-ATtiny13 AVR microcontroller.
-2 x 1k ohm.
-220 ohm.
-2x BC547(b).
-3 AA battery’s.

How it works:
The so called PIR sensor, in my case a nightlight with motion sensor triggers the microcontroller (if it detects motion), which make’s the camera take a photo.For more info about the PIR sensor see wikipedia, http://en.wikipedia.org/wiki/Passive_infrared_sensor

Specifications of the component’s:

-Nightlight with motion sensor and 3 led’s: The device is powered by 3 AA battery’s. The leds are only activated if it is dark, because it has an diode to detect if it is dark.

-Digital mini camera: The camera is powered by a single AAA battery. It can takes 20 photo’s at “high” quallity. It actually still is 352×288 so not actually a high quallity. It also can take 60 photo’s at a really low quallity. The device also has a serval functions like making a short movie and a timing function. It only has a Flash memory so the photo’s are gone when the battery is removed. The photo’s can be uploaded via USB.

How to make it:

The nighlight only illuminates the leds if it is dark, because of the diode that detects if it is dark. I removed the diode to trick the processor IC in the nightlight itself and let it think it’s alway’s dark, by removing the diode it never get’s an input from the diode. So the system works at day and night.

To control the camera and make it trigger from the output of the nightlight PIR sensor I used an AVR ATtiny 13 to make it al work properly and on the right timing. The ATtiny 13 read’s the state of the PINB.4 which is connected to a + of the led on the nightlight (which is driven by the IC of the nightlight thought a transistor). If there is any motion detected the ATtiny know’s it because IC of the nightlicht gives the ATtiny an high input. The ATtiny triggers the “Power on” button of the camera. Then it wait’s some time to let the camera initialize, if the camera is ready the ATtiny triggers the “Make a photo button” button. If the photo is taken the ATtiny makes triggers the “Power on” button again, which makes it turn off. All these actions to trigger are done by solder some wires to the original switches in the camera, and the 2 wires of a switch are connected by the collector and emittor of a BC547 transistor, the transistors base is connected via an 1KOhm resistor to the microcontroller to do the trigger actions (just see the schematic).

The 3 AA battery’s in the nightlight give the microcontroller the supply of power, and powers the sensor itself. Also to power up the camera with 1,5 volt’s there is a connection to the + and – of the first battery of the nightlight to make it all work on just 3 AA battery’s.

The photo’s of the camera can always be uploaded by the user with the USB connection on the camera.

Here are some photo’s the camera made and a little video:

The circuit:

The (BASCOM, basic) program:

$regfile = "Attiny13.dat"
$crystal = 1000000
Config Portb = &B11101111 : Portb = 00000000 'pin b.4 as input

Dim Pinb.4 As Bit

‘Mainprogram
Do

Wait 2
If Pinb.4 = 1 Then ‘wait for input from sensor
Portb.0 = 1 ‘camera on
Waitms 500
Portb.0 = 0
Waitms 1000
Portb.2 = 1 ‘trigger the camera
Waitms 500
Portb.2 = 0

Wait 2

Portb.0 = 1 ‘camera on
Waitms 500
Portb.0 = 0
Waitms 1500
Portb.2 = 1
Waitms 500
Portb.2 = 0

Wait 40 ‘wait for the output from the PIR sensor to become low
End If

Loop

End

Comments
  1. Jay says:

    I’ve been thinking about hooking a pir sensor to a USB i/o board. It looks like your schematic is just what I need. Great project.

  2. Jan Tijsma says:

    Is dit al verder uitgewerkt en is de microprossor klaar voor gebruik?

    • jjshortcut says:

      De microcontroller moet nog wel geprogrameerd worden maar het programma hiervan is relatief eenvoudig. Dus niet klaar voor gebruik maar moet geprogrammeerd worden..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s