DIY Raspberry Eye Remote Servo Cam #piday #raspberrypi @Raspberry_Pi

Build a DIY pan/tilt webcam sentry, and watch it from anywhere online. by Matt Stultz via Make:

Webcams are a fun and useful tool. Being able to control where they’re looking remotely, though, takes their usefulness to a whole new level. Whether you’re watching your pets while you’re away or allowing friends to participate in an event from the other side of the world, a web-enabled camera puts the end user in control of the experience.

Put a Pi on the Web

The Raspberry Pi provides a perfect base platform for creating internet-connected devices. When researching how I was going to connect my device to the web, I ran into Make:’s very own Matt Richardson’s post describing how to use the Flask framework to easily create projects for the web on the Raspberry Pi. Flask allows you to take your existing Python apps (the preferred language for developing applications on the Raspberry Pi) and add in an HTML template to provide a web-page interface for the end user. In this project I provide an HTML template document that’s pretty bare-bones, so it’s easily understood by anyone who wants to look under the hood and also provides a good starting point if you want to customize it for yourself.

Stream Video from the Pi

The next tool needed was a way to send video from the Pi across the web. When using a less powerful system like the Pi, every little bit counts, and the real-time compression and streaming of video can be a huge drain on a system. After trying a couple of different options I opted to use MJPG-Streamer. The performance from MJPG-Streamer was hands-down the best of any service I tried on the Raspberry Pi.

Control the Servomotors

Finally I needed a way to control the servos for the pan/tilt mechanism. The standard library on the Pi for accessing the I/O pins is called GPIO. While GPIO makes it easy to do basic actions, its software-based PWM system is very inaccurate and temperamental for controlling servomotors. After running into problems and having a few friends review my code to ensure I wasn’t going mad, I decided to abandon GPIO in search of a better solution. The winner was an alternative to GPIO called RPIO. With RPIO, I had access to a semi-hardware driven PWM signal. This final piece brought it all together into a fully functional project and a great starting point for connecting your world to the web!

All the code for this project can be downloaded from Github and the 3D models from Thingiverse.

NOTE: eLinux has a list of Pi-compatible USB webcams. This project was built using the C260 webcam, which may no longer be available. The C525 reportedly “works fine without powered hub” but was un-tested with our design. The C270 reportedly “works fine with external power” in the form of a powered USB hub. The 3D design files are for the C260/270 but the premise for the design can be modified for the webcam of your choice.

Project Steps
1. Flash the SD card.
2. Make (or buy) the 3D-printed case.
3. Prepare the servo power cable.
4. Soldering the cable.
5. Mount the pan motor.
6. Add the tilt motor.
7. Wire the motors.
8. Attach the tilt motor.
9. Connect the servos to the Pi.
10. Power it up.
11. Zero the servos.
12. Attach the servo arms.
13. Attach the camera.
14. Launch the camera.
15. Wrap it up.

Full Tutorial

998Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!


Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 11/15/2024 Featuring Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: A New Arduino MicroPython Package Manager, How-Tos and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — The 2024 Recap Issue!

Maker Business – Adafruit Daily — Apple to build another chip at TSMC Arizona

Electronics – Adafruit Daily — SMT Tip – Stop moving around!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


No Comments

No comments yet.

Sorry, the comment form is closed at this time.