We wanted to make a small project to track the folks that came into our lab. Using some sensors we had for the Grove system, we connected them to the Raspberry Pi, along with a Raspberry Pi Camera, to add some security to our lab.
We use an Ultrasound Sensor to detect if anyone has entered the room. We use a Raspberry Pi Camera to take a photo of the intruder, and the Raspberry Pi sends an e-mail to us. We added a few actuators like a status LED, a relay used to control any electronic circuit (because we can), a power switch to turn the entire thing on and off, and a buzzer which makes a loud sound whenever someone comes in.
Setup
So here’s how all the sensors connect:
- Raspberry Pi Camera – camera connector near the Ethernet Jack on the Raspberry Pi
- Ultrasound Range Sensor– Port D7
- Buzzer– Port D5
- Switch– Port D4
- Status LED– Port D3
- Relay –Port D2
Code
The code uses the Python SMTP library to send the mail, it should be installed by default. We use the Raspberry Pi Camera, this should get you started on that and we use the subprocess library to call it from the Python code.
You can find the source code for the project here.
Results
The photos below were e-mailed to us by the security system.
And here’s the terminal output on the Raspberry Pi tracking our lab security:
Have a question? Ask on our forum.