I should preface this by saying that it is no where near as polished as it could be. But it works, and the objects taken by the camera are recognizable. Eventually, if I have the funding, I will upgrade the Camera.
There are many elements to this project. There really isn’t a great place to start with this project, so well start with the fritzing schematic and a list of materials needed.
You will need:
So let’s look at this schematic:
When motion is detected, the signal pin on the motion detector gets pulled low. at this point the 3.3v attiny pulls pin 1 high, sending a signal into the rpi (it’s 3.3v so it’s safe for the broadcomm) and illuminating an LED so the user can see that motion is being detected.
The raspberry pi then sends a signal to the 5v attiny indicating that motion has indeed been detected. Once this occurs, the 5v attiny pulls the 5v pin going to the webcam high. I had to integrate this step of turning the webcam on via the attiny because there is a hardware misconfiguration that causes the software i’m using to take the picture hang. Turning the camera off and on each time a picture needs to be taken gets rid of this problem, because the camera always takes the first picture after being turned on.
At this point a picture is taken and moved to a flash drive. They could be moved wherever, but a flashdrive works the best for now, as I will be deploying this system in a place where there isn’t internet (in my garage)
Now time for source codes!
Software wise you will need:
The Arduino IDE
Python (I’m using Geany on the raspberry pi)
fswebcam which you can obtain by running
sudo apt-get install fswebcam
On your raspberry pi.
This is the source for the 3.3v attiny85
This is the source for the 5v attiny85
This is the Fritzing document.
Here’s a sample image from the camera. It is looking at the breadboard.