A Clock That Falls Off the Wall When You Look at It
by Burke McCabe in Circuits > Raspberry Pi
707 Views, 8 Favorites, 0 Comments
A Clock That Falls Off the Wall When You Look at It
Have you ever wanted a clock that doesn't tell you the time. Me neither, but that's what you get when you put me in quarantine with a couple electronic components, and the internet.
Supplies
1. Raspberry Pi
2. 9g Servo (Any servo/motor should work)
3. Wall Clock
4. Webcam
5. Portable Charger
6. 3 male to female wires
7. Breadboard (optional)
Software
Firstly program your Pi. All it needs to do is detect when there is a face and then activate a servo to push itself off of a wall. Here's my code: https://github.com/SmothDragon/Fallclock. I used the cv2 library for the facial recognition, along with a face haar cascade. (The ones I used are here: https://github.com/Itseez/opencv/tree/master/data/haarcascades).
Connecting the Servo
Next step is to put all the components together. Connect the servo to the Raspberry Pi. Make sure to connect the red wire to a 5v pin, the black/brown wire to a ground pin, and the yellow/orange wire to one of the GPIO pins (just make sure you output to the correct pin in the code (You can also connect all of these to a breadboard, but I found it easier just to connect them directly because all we're connecting is the servo).
Connecting the Webcam
Now finally connect the webcam. I did it through USB, but you could also do it with a Raspberry Pi camera module. All you should have to do is plug it in.
Enjoy!
You can now enjoy not knowing the time, and having to fix your clock every time you look at it. I also have 2 videos on the clock. The second one goes a little bit more in depth.