background preloader

Open Source Building Automation

Open Source Building Automation

Webcam Streaming Video On Raspberry Pi via Browser I was playing with face recognition on Raspberry Pi and found a lot of people were having issues with webcam streaming video, so I made this step by step guide to help you to setup the webcam, and also get you to the point where you can stream video from webcam on another machine via a browser. First thing we need to do is to get a version of ffmpeg that can stream. If you haven’t installed Git on your Raspberry Pi, do that first. sudo apt-get install git Once git was installed, I went into /usr/src to download the source for ffmpeg. cd /usr/src git clone Git retrieved the source code and we will need to build ffmpeg from scratch. cd ffmpeg . Compiling ffmpeg on the Pi will take a while, probably a good idea to leave it overnight. Once ffmpeg is installed, we need to create a configuration file to enable ffmpeg to stream to ffserver. ffserver is what will host the stream. /usr/sbin/webcam.sh When you run it, you should get this as a result. ** 1 dup!

Raspberry Pi Color Tracking Using PID In this project I implemented OpenCV color recognition on the Raspberry Pi that uses PID to control the pan-tilt servo system. In this post, I will explain briefly how color tracking works, and how to use PID control algorithm to improve tracking performance. Like my previous face recognition tutorial, I will be using the Wall-E robot in this Raspberry Pi Color Tracking project as an example. The Raspberry Pi has relatively small computational capacity compared to a laptop or PC. We can use Raspberry Pi to control the servos directly using interface like ServoBlaster. So this is how it works: the Raspberry Pi detects the color, work out the coordinates and send to the Arduino via I2C. PID is a closed loop control system that is trying to minimize the error. To understand more about the PID control system, I found this basic PID tutorial very useful. The most important factor of a optimal PID controller is its three constant parameters. How to Use Arduino PID Controller I (integral).

Raspberry Pi Face Recognition Using OpenCV About a year ago, I created a Wall-E robot that does object and face recognition. It uses Arduino as the controller and need to communicate with a computer that runs the face detection program to track the target. Raspberry Pi face recognition has become very popular recently. With the powerful processor on Raspberry Pi, I can connect it with the Arduino using i2c on the robot and run the object recognition program on-board. However, building such a robot will be a project for near future. Note: Please be careful about the indentation in the Python codes, sometimes my blog decides to mess this up randomly. I wrote an article on how to use SSH and VNC to control and monitor the Raspberry Pi, and that’s what I will be using in this project. To install OpenCV for Python, all you have to do is use apt-get like below: sudo apt-get install python-opencv To test the installation of OpenCV, run this Python script, it will switch on your camera for video streaming if it is working.

Related: