As I get Raspberry Pi 02 ready, here is exactly how I set it up:
- Got the latest Raspbian image, and imaged my 8gb Sandisk Extreme SD card with it using Win 32 Disk Imager (as recommended on the Raspberry Pi Downloads page)
- Plugged everything into Pi, booted it up.
- In Raspi-config, set the overclock to medium – 900MHz.
- Set my time zone to London, set the password, enabled SSH, and set it to exapnd_rootfs (on next reboot).
- Started an xwindows session, configured WiFi.
- Installed software vital to mjpg-streamer (I am unsure if mplayer and VLC are required, I am fairly sure they aren’t – however on previous attempts at getting Pi02 working, I had no luck, however I am fairly sure this was due to a Chrome plugin, see next post about this. See my explained bash history below for everything I did (minus the ls’s etc):
ping 22.214.171.124 #Pinged Google to ensure internet connectivity
Update and Upgrade Pi software, then installed third party software. libjpeg8-dev and imagemagick are required for mjpg-streamer. Subversion (SVN) used to get the mjpg files.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mplayer
sudo apt-get install vlc
sudo apt-get install subversion
sudo apt-get install libjpeg8-dev
sudo apt-get install imagemagick
sudo reboot -n
wget http://lilnetwork.com/download/raspberrypi/mjpg-streamer.tar.gz (Thanks to this post for a different source of mjpg-streamer)
tar -xvzf mjpg-streamer.tar.gz
svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer
bash mjpg-start.sh #See this post for mjpg-start.sh script, alter for your file directoy
chmod a+x mjph-start.sh #forgot to do this at the time!
mv mjpg-start.sh static/
Add the cron job: ‘@reboot bash /home/pi/Documents/code/static/mjpg-start.sh’
sudo shutdown now
Removed the USB hub containing mouse, keyboard and webcam, plugged just the webcam into the Pi (as well as the WiFi adapter in the other port)
Now if you go to your IP address:port that you have set mjpg to use, you should see its homepage. This didn’t work for me this time, but going to the page where just the stream is viewed, worked fine for example: 192.168.0.18:8082/?action=stream
On looking through the new raspi-config (after doing the update and upgrade to the Pi), I found a few new options – including the option to add your Pi’s location to RasTrack - a website where you can see where Pis live all over the world! Also saw the option to enable the Pi camera – hopefully being released soon.
I have done this process a few times recently, with different set up steps trying to get a smooth webcam stream. I have gotten new SD cards, 1amp chargers, tried different webcams and WiFi dongles etc, all to the same laggy or non-existant webcam stream. Today I managed to get the Pi streaming, but after 10 seconds or so it would get more and more laggy until it froze completely. Looking at Chrome’s memory usage, I found it shot from 6mb to 500mb in that time, causing Chrome to lock up and the tab trying to crash. I have never seen this exact behaviour before, but opening the link in an incognito window works fine, leading me to think one of my plugins/extensions may be causing problems.
In an incognito window, the memory used by the page seems to increase from say 1 to 7mb, then straight back down to 1mb, every half a second, forever – which I assume is it loading the new photos, then disposing of old ones. Earlier in a normal window, it seemed to just accumulate more and more without ever throwing any away. Will try and look into why tomorrow, as well as trying to get Pi02 wired up and rolling!