Note from Brook: (August 1, 2016)

After a few months, I went through this tutorial and found I made (or forgot) a couple things.

  1. I updated the Coder app to include relative links – USE THIS LINK>>  skycam080116.zip
  2. My microswitches were shorting the circuit out so I unplugged them. You don’t need them.
  3. When copying and pasting code into a Terminal, the double quotation marks were translating wrong… beware of syntax and such.  It only takes one character to fail 🙂

Changes to the Coder App:
In the HTML, it now reads: <img src=”http://coder.local:8090/?action=stream” />
In the NODE code, it now reads: var piblaster = require(“./pi-blaster.js”);

Good luck!!
Brook


Raspberry Pi is a great platform to build a robot!  You can even build your own custom User Interface (UI) and stream video live to your browser. Below, you will find instructions on squaring away all the open source software you need, including:

  • Google Coder (the software platform we will use)
  • Pi Blaster (the software library that communicates to the servos)
  • MJPG-Streamer (the software that streams video from the RPi camera)

Hardware needed:

Raspberry Pi B+ – $29 on Amazon

MicroUSB Cable for Power – $4.49 on Amazon

Edimax EW-7811Un – $9 on Amazon

Cat5 Ethernet Cable  – $9.49 on Amazon

Raspberry Pi Camera – $27 on Amazon

4GB microSD Card – $5.61 on Amazon (can be a different size card, like 8GB)

 

Installing Google Coder for Raspberry Pi

1. For this project you must have an Edimax EW-7811Un adapter. Plug your Wi-Fi adapter into your Raspberry Pi now. However, for the setup and installation of the required programs, you will need to connect your Pi to your router directly using a Cat5e ethernet cable.

WARNING: Do not connect your Pi to your router yet.

2. Go to http://googlecreativelab.github.io/coder/ using a computer with a browser and select the “Wired” instruction set for how to install and connect. Complete steps 1 through 3. During step 3, you will see a message in your browser when you first attempt to connect to your Pi that “Your connection is not private”. Click on “Advanced“, and then “Proceed to coder.local“. Everything is fine!

Google Coder

3. You will be prompted to provide your password, which will be the one you chose when setting up Coder initially. Once you are logged into your Pi and are at the home screen for Coder, we will setup the wireless capability for the project. In the top right corner of your browser window you will see a gear icon, click on it and select “Wifi Setup”. Follow the onscreen instructions.

4. Disconnect the ethernet cable from the Pi so that you are now running on a WiFi connection with your network. Reboot your Pi.

5. Log back into your Pi by going to http://coder.local/ in your browser.  Ensure that your wireless connection is working correctly. Nice job! You are on your way.

Feel free to explore the Coder environment.  You will be able to inspect and even edit the code right there in your browser window!

Coder Interface

 

Edit in your browser with Google Coder

Install Pi-Blaster on Raspberry Pi

1. To get started you will need a network scanning program to be able to identify the IP address of your Pi. We used LanScan from the Apple Store, but any free network scanning software you want to use will work.  Windows has a lot of options as well.

LanScan

2. Once you have your network scanner, search your network for the name “Edimax Technology Co. Ltd.”. This is your Pi, and the IP address associated with this name is what you want to write down. For me it is 192.168.1.115 .

3. Open a terminal or command line on your computer, and type ssh 192.168.1.115 -l pi and press enter. You will of course insert your IP address in place of mine.

4. You will be asked if you want to continue, type in yes and hit enter.

5. You will be prompted for a password, enter your Coder password here and press enter.

6. Type the command wget https://github.com/sarfata/pi-blaster/archive/master.zip and press enter. You will now see your Pi go to the website and download all of the required files. This may take a moment.

7. Once the download is complete, you will want to unzip what was just downloaded. To do this, type
unzip master.zip and press enter.

8. Now we need to get into the the Pi-Blaster folder that was just created. To do this, type
cd pi-blaster-master/ , and press enter. Your new command prompt should read pi@coder: ~/pi-blaster-master$ .

9. We now need to install files that are in the pi-blaster-master folder. To do this type sudo apt-get install autoconf and press enter. You will be asked if you want to continue, type Y and hit enter.

10. These files now all need to be built together so we start by typing the command ./autogen.sh and press enter. This will take a moment to run.

11. Now we will type ./configure and press enter.

12. And finally type the command make and press enter.

13. To make sure that pi-blaster starts every time that you power on your Pi, we need to type the command sudo make install and press enter.

14. Everything is now installed and Pi-Blaster is ready to run on your Pi. Do not exit from the ssh session with your Pi yet, there is more to be done. The last thing you need to do is enable your camera so that you will be able to see what your Pi’s camera is “seeing”!

Install MJPG-Streamer and enable your Camera

1. The first thing we need to do is enable the Camera function in your Pi. To do this, type  sudo raspi-config and press enter. You will now be in the Raspberry Pi Software Configuration Tool.

2. Use the arrows on your keyboard to move down and highlight option 5, which is “Enable Camera”, and press enter.

3. You will be asked if you are sure, and will want to move to highlight “Enable“, and then press enter.

4. You will now be back at the main manu screen. Press your right arrow key once and you should have moved to and highlighted “<Finish>“. Press enter. You will be prompted that you need to reboot to enable the changes you just made. Reboot your Pi now.

5. Once your pi has rebooted log back into the Pi over the ssh connection as we have done before. We need to run an update on the Pi so that it will know where to look for all of the files and information we are about to load onto it. To update the Pi, type the command sudo apt-get update and press enter. This will take a few minutes.

6. For steps 7-11, when prompted for a yes or no, answer yes or the installation will be aborted.

7. Once your Pi is updated, type  sudo apt-get install subversion libjpeg8-dev imagemagick libav-tools cmake and press enter.

8. Next type git clone https://github.com/jacksonliam/mjpg-streamer.git and press enter.

9. Next type cd mjpg-streamer/mjpg-streamer-experimental and press enter.

10. Next type make and press enter.

11. Finally type sudo make install and press enter.

12. To make sure the new M-JPEG streamer knows that you are using a Raspberry Pi Camera, we have to tell it. Type the command: ./mjpg_streamer -i “./input_raspicam.so -fps 5” -o “./output_http.so -w ./www -p 8090”
13. Now we can check and make sure that the streamer and your camera are working together by opening an internet browser window on a seperate computer and navigate to the address http://CODER-IP:8090 . Be sure to place your Pi’s IP address in the “CODER-IP” location. For instance, I would enter http://192.168.1.115:80 and press enter.

14. You should see a page like the screen shot below. The second picture; under the flower, should be a snapshot of whatever your camera is pointed at. If you can see this picture, your camera is working.

M-JPEG

15. Back in the command line for the Pi, hold down “Control” and press “X” so that we can stop the M-JPEG streamer from running. We need to stop it so that we can configure it to start automatically whenever your Pi is powered on. To do this, type in sudo nano /etc/rc.local . You will now be in a settings folder. We want to add these lines to the folder just before the “exit 0” command at the bottom:

cd /home/pi/mjpg-streamer/mjpg-streamer-experimental/
 ./mjpg_streamer -i "./input_raspicam.so -fps 5" -o "./output_http.so -w ./www -p 8090"

16. Here is a screen shot of where to place the two new lines:

Insert Code

17. Once you have added the two lines to the config folder, hold down “Control” and press “X” to exit. You will be asked if you want to save the changes, type “Y” for yes and press enter. You will then be given the option to change the folder name, do not change this as we want to overwrite the config folder to have the new settings, so just press enter to continue.

18. Now re-boot your Pi and you are ready to go! The command is sudo reboot .

WHEW!! That was a lot. Loading libraries and configuring a RPi has always been a mystery… until now. HUGE thanks to Mick Balaban (friend and code wizard) and Nick Ernst (Printrbot Engineer) for getting me sorted, writing these tutorials, and collaborating on fun projects like these!  May we have many more chances to “play”!!

-Brook Drumm