KOI aquarium automation Chapter 1a

Project:

Setting up a video feed to watch the koi fish online via a web browser or android phone as well as be able to feed the fish with a click or button press anywhere in the world. This will be done with a Beaglebone Black and a C920 Logitech webcam. As for feeding the fish, that will be discussed in greater detail in proceeding chapters.

Chapter 1a: Setting up the software for the webcam

Chapter 1b: Setting up an IP dedicated webcam

Chapter 2: Building and testing the circuit to feed the fish

Chapter 3: Writing the computer and android programs to interact with the Beaglebone Black

Setup:

photo-7photo-2

Beaglebone Black is a $45 device that runs a ARM Cortex-A8 processor rated at 1GHz with 65 digital pins and 7 analog pins including 2GB onboard memory and 4x UART, 8x PWM, and the ability to host a microSD card.

The primary reason I am using the Beaglebone Black over my raspberry pi is because the necessity for a fully functional USB interface. The Raspberry Pi as of yet still drops quit a handful of packets which could make the video feed excessively glitchy.

As this is still a modern topic of discussion, little documentation is provided. As I am using Debian over Angstrom I will post the details to getting started.

Prerequisites:

Have Debian installed (I kept Angstrom and have an SD boot for Debian on a 16GB microSD card, instructions are found in the sources section)

A secondary computer with VLC installed to test the camera

Lets Begin:

Since OpenCV is not pre-installed on Debian, lets fix this. First install the required packages:

apt-get install build-essential
apt-get install cmake
apt-get install pkg-config
apt-get install libpng12-0 libpng12-dev libpng++-dev libpng3
apt-get install libpnglite-dev libpngwriter0-dev libpngwriter0c2
apt-get install zlib1g-dbg zlib1g zlib1g-dev
apt-get install libjasper-dev libjasper-runtime libjasper1
apt-get install pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools
apt-get install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-prog
apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev
apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev
apt-get install libxine1-ffmpeg libxine-dev libxine1-bin
apt-get install libunicap2 libunicap2-dev
apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils
apt-get install swig
apt-get install libv4l-0 libv4l-dev libav-tools
apt-get install python-numpy

Now its time to install OpenCV:

open your handy terminal and make sure you’re root type:

cd Downloads (or whatever directory you want to put this)
git clone https://github.com/Itseez/opencv.git

cd opencv

mkdir release

cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

make (This is going to take a WHIIILLLLEEEEE, grab some joe or whatever… don’t recommend watching this part)

make install

Great! We are almost finished with the setup. Now we can use a premade script to send the files through using UDP

git clone git://github.com/derekmolloy/boneCV.git

cd boneCV

./build (If you run into errors it will probably say it can’t find some dependency, Google and download it)

now open streamVideoUDP (nano streamVideoUDP) and change where its sending the packets (My other linux laptop I used the command “ifconfig” to find my local ip address). For me:

./capture -F -o -c0|avconv -re -i – -vcodec copy -f mpegts udp://192.168.1.31:1234

save it. (ctr+x>>press y>>press enter) if permission denied use the command “chmod 755 streamVideoUDP” and try again.

Run the script, “./streamVideoUDP”

go to your other computer and open VLC>>Media>>Open Network Stream>>Network tab type:

“udp://:@1234”

and with minimal lag and minimal processessing power from the beaglebone you can watch 1080HD footage provided by a C920 webcam.

photo-6photo

This concludes the first half of all the computer science technology I will be using for this project. Next I’ll explain how to setup an IP address through a server and watch the feed from anywhere on any device.

SOURCES:

Molloy, D. [DerekMolloyDCU]. (2013, May, 25). Beaglebone: Video Capture and Image Processing on Embedded Linux using OpenCV [Video file]. Retrieved from http://www.youtube.com/watch?v=8QouvYMfmQo

http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation

http://linuxconfig.org/introduction-to-computer-vision-with-opencv-on-linux

http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian

http://avedo.net/653/flashing-ubuntu-13-04-or-debian-wheezy-to-the-beaglebone-black-emmc/

Advertisements

About craiggleso

B.S. Industrial Management - Grove City College Studied Applied Electronics at Wake Technical Community College
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s