Intel Edison IP Webcam
Intel Edison IP Webcam

Who else loves 3D printing? Those of you who do, you must agree with me in that you hate finding your printer finished but it came off the bed half way. Buying an IP webcam is not an option, because you don't want to spend $150 on a camera. The only real option is to do it like any other hacker: make your own! There are so many single-board computers that we all have and love including Raspberry Pi, Beaglebone and now the Intel Edison. These computers really are computers, in that they run a full operating system, Linux. In this Instructable, I will be guiding you in setting up a webcam server on an Intel Edison. These steps may or may not work on other boards like the RPi or Beaglebone.

Before I get started, I must say that this is not entirely my work. I found a guide on Github and followed the process there. I hit snags, so my twist is showing you how I got around them. If you want to skip over my instructions and go straight for the original tutorial, you may do so here.

Also, I want to thank Intel and Instructables for being awesome by selecting me along with 249 others to receive a Dev Kit. That was very surprising to me, and I am very grateful for it. Thank you!

Step 1: Getting ready

Intel Edison IP Webcam

Most other Intel Edison tutorials and projects use the Edison in "device" mode. This project will have the Edison in control mode, which lets the board control the USB. To turn the Edison to control mode, flip the switch beside the USBs toward the large USB and power ports. Power up your Edison with a center-positive 7-15v power supply.

Note: before going any farther, you need to make sure your webcam is UVC-compatible which is supported by the program we use, ffmpeg. To find a list of supported cameras, go to this link here. Mine is a Logitech C600.

If you don't know so already, make a note of the name of your Edison, along with its password.

Step 2: Install the packages

Package Manager

You need to configure your opkg repository to include the following lines:

src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/allsrc/gz src/gz core2-32 http://repo.opkg.net/edison/repo/allsrc/gz

Do so by typing:

vi /etc/opkg/base-feeds.conf

Using vi as a text editor is different. If you need help, check out this page.

After that's done, browse to the edi-cam directory:

cd /edi-cam

Now type:

cp /etc/opkg/base-feeds.conf /etc/opkg

And finally update opkg:

opkg update

Install Git

Type:

opkg install git

Clone the repository:

git clone https://github.com/drejkim/edi-cam.git

Install the UVC driver

Install the driver:

opkg install kernel-module-uvcvideo

Make sure the webcam is seen

Unplug the webcam and plug it back in. Type the following and see the output:

dmesg -c

Near the end it should look close to this (this example came from the Github notes):

[ 92.910838] hub 2-0:1.0: USB hub found [ 92.910899] hub 2-0:1.0: 1 port detected [ 92.957888] pmic_ccsm pmic_ccsm: USB VBUS Detected. Notifying OTG driver [ 93.210150] usb 1-1: new high-speed USB device number 2 using dwc3-host [ 93.329961] usb 1-1: New USB device found, idVendor=041e, idProduct=4095 [ 93.329992] usb 1-1: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [ 93.330014] usb 1-1: Product: Live! Cam Sync HD VF0770 [ 93.330033] usb 1-1: Manufacturer: Creative Technology Ltd. [ 93.330052] usb 1-1: SerialNumber: 2014090439994 [ 93.339634] uvcvideo: Found UVC 1.00 device Live! Cam Sync HD VF0770 (041e:4095) [ 93.352641] input: Live! Cam Sync HD VF0770 as /devices/pci0000:00/0000:00:11.0/dwc3-host.2/usb1/1-1/1-1:1.0/input/input3

If you don't see anything close to this, your webcam may not be supported by UVC.

See if the device node was created:

ls -l /dev/video0

And it should look similar to the following:

crw-rw---- 1 root video 81, 0 Dec 20 21:23 /dev/video0

Install ffmpeg

You will need to change a setting in the install_ffmpeg.sh script. Look for:

FNAME=ffmpeg-2.4.3-32bit-static.tar.xz

and change it to:

FNAME=ffmpeg-2.5.1-32bit-static.tar.xz

Do the same in do_ffmpeg.sh.

Navigate to the bin folder within edi-cam and type:

./install_ffmpeg.sh

Install Node.js

Browse to web/server by typing:

cd /edi-cam/web/server

and install Node.js by typing:

npm install

Step 3: Run the server

You need to modify the variable wsUrl in /web/client/index.html:

vi /edi-cam/web/client

And change the following code:

// CHANGE THIS TO THE APPROPRIATE WS ADDRESS

var wsUrl = 'ws://myedison.local:8084/';

by replacing "myedison" with the name of your Edison.


Start the server and convert the video with ffmpeg

You will need to enter 2 commands into one line. This is because you need to run a command after starting the server, but the server locks out SSH commands.

cd to the root directory:

cd /

and type the following:

node /edi-cam/web/server/server.js | ./edi-cam/bin/do_ffmpeg.sh

Now your server should be running, and you can move on to the next step!

Step 4: Connect to the web server

Intel Edison IP Webcam
Intel Edison IP Webcam

Now that the hard part is finished, you can start viewing whatever is in front of your camera! Remember when you changed "myedison" to the name of your Edison? You need to first be on the same network as your Edison, then go to "http://myedison.local:8082" where myedison is changed like before. What should pop up is a blank webpage with a single box in the center. It may take a bit to load, but that box will turn into the live feed! My latency (lag) is very slight, which is surprising because my router is upstairs. Anyway, now all you need to do it put the Edison where you want it, face the camera at what you wish, and plug in your Edison. Once it boots up, connect to it via SSH and run the following 2 commands:

cd /
node /edi-cam/web/server/server.js | ./edi-cam/bin/do_ffmpeg.sh

And you can now view your webcam feed whenever you'd like!

Step 5: Mounting it

Intel Edison IP Webcam
Intel Edison IP Webcam

As I said in the beginning, I did this to spy on my 3D printer. My printer rests in my basement where it's cold and not very welcoming. I try to stay out of my basement as much as I can, which is a problem because I am constantly 3D printing. With over 700 hours on my printer, I've had quite a few hiccups costing many more hours. For large prints, I would check every 30 minutes to see if something went wrong so I can save the disappointment and even more plastic.

There's my reason to hack. What is yours? I'd love to see what others can do with this! Thanks!

 
 

Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel