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!

Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here:

Join Adafruit on Mastodon

Adafruit is on Mastodon, join in!

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

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

Join over 36,000+ makers on Adafruit’s Discord channels and be part of the community!

CircuitPython – The easiest way to program microcontrollers –

Maker Business — “Packaging” chips in the US

Wearables — Enclosures help fight body humidity in costumes

Electronics — Transformers: More than meets the eye!

Python for Microcontrollers — Python on Microcontrollers Newsletter: Silicon Labs introduces CircuitPython support, and more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

Adafruit IoT Monthly — Guardian Robot, Weather-wise Umbrella Stand, and more!

Microsoft MakeCode — MakeCode Thank You!

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

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — #NewProds 7/19/23 Feat. Adafruit Matrix Portal S3 CircuitPython Powered Internet Display!

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

No Comments

No comments yet.

Sorry, the comment form is closed at this time.