Thai Hacks #2 -- Raspberry Pi USB Webcam TweetBot

March 5, 2015 -- BIT Magazine Ever want to take pictures of something to keep an eye on it even when you are not around? What if it was a fish tank + a garden with an automated fish feeder and constantly running water? It might be nice to look in on it and see if it's all ok.


Remote monitoring an automated system can be done a number of ways and if you are an engineer, programmer, or experienced maker it's probably an easy thing to do. But if you are just starting out, maybe you can appreciate this beginner's tutorial on using a Raspberry Pi B+ (RPi) and a standard USB webcam to take and tweet pictures to a Twitter account set up specifically for the project.

The project above (we made in-house) uses the Twitter account @UrbanAgBKK and regularly posts images throughout the day.

Things you will need include an Internet connection for the Raspberry Pi (connecting to it either with an Ethernet cable or a WiFi adapter), a webcam obviously, and the Raspberry Pi board itself, including a power adapter.



There's a lot of tutorials out there on how to turn your Raspberry Pi into a TweetBot, and this good one on how to tweet photos. If you run into imaging problems however, you might have to abandon pygame and use fswebcam. Then add into the code a command to skip frames giving your webcam time to adjust itself before capturing an image. This is also included in the beginner's tutorial. You might be able to do this in pygame, but the tutorial doesn't cover that.  

This TweetBot is just the beginning. In the pictures it is taking you can see an automatic fish feeder (the green object hanging over the fish tank), 3D printed and driven by an Arduino Uno. It is standalone but in the future, it, the webcam, and other sensors might all be integrated under the command of a single RPi.

BIT Magazine is a bi-lingual platform for Thailand's maker movement to connect, grow, and collaborate with maker communities abroad. Follow us on Twitter here or on Facebook here.
3DClass370         Ad_370