Instructables

Raspberry Pi: Completely Wireless IP Camera. Solar Battery Pack, WiFi, Logitech Camera, Raspbian

This is one of the first projects I did with my Raspberry Pi. I wanted to see if I could make a completely wireless web cam and set it to stream over the internet. Below are the steps and items I used.

All items except for the Raspberry Pi were purchased from ebay.com

Raspberry Pi Model B 512MB RAM
5000mAh Solar Powered External Battery Dual USB For iPad/Mobile Phone/Tablet PC
802.11n/g/b 150Mbps Mini USB WiFi Wireless Adapter Network LAN Card w/Antenna
Raspberry Pi Case Raspi Enclosure Box with GPIO Access and Logo (optional)
Logitech QuickCam for Notebooks Deluxe Laptop Webcam (Other web cams may work)

The first thing you want to do is get the Raspian Wheezy Image from here. Once you install it and boot up, you’ll come to a configuration screen.

Go to Expand_Rootfs to allow the operating system to use the entire SD card.

Go to SSH and Enable it. This will allow you to remotely shell into the OS to make configuration changes and get updates.

Save changes and reboot the Raspberry Pi.

Once booted up, you will want to download updates.
sudo apt-get update
This can take sometime to complete.

sudo apt-get upgrade
Type Y for yes and wait for the updates to download and install.

Next we want to setup the WiFi adapter. Shutdown the RPi with “sudo shutdown now” and plug in your WiFi adapter.

When booted up login and then type: sudo nano /etc/network/interfaces
We want to give the Raspberry Pi a static IP address so that we can access it remotely. Below is an example of my configuration. Yours may vary. I set the Ethernet port and the WiFi to the same IP address so that I can access it from the same IP even if it is connected via Ethernet or WiFi.

auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.0.85
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.85
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
wpa-ssid “yourSSID”
wpa-psk “yourPASSPHRASE”

Save your changes using Ctrl-O and shutdown the device.
Unplug the Ethernet cable.

You should see your static IP on the verbose screen “My IP address is xxx.xxx.xxx.xxx”

Verify that you are connected to the internet by typing: sudo ping -c 3 google.com

From this point on, I do the rest of the setup through SSH and PuTTy on a Windows machine.

Log into your RPi via PuTTy using the Pi’s static IP address.

Plug in your webcam.

Next we need to install the “motion” service. This is a package that contains everything you need to stream your cam over the internet and view it from any browser.

sudo apt-get install motion

Once the installation has completed we need to start the service.

sudo services motion start

If your web cam has a light on it, you should see it light up.

Now lets configure the motion software.

sudo nano /etc/motion/motion.conf

In here there are a few basic changes that you need to perform:

Daemon = OFF to ON
webcam_localhost = ON to OFF
webcam_port = desired port number or 8088
control_port = desired port number or 8089
To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:
sudo nano /etc/default/motion

Then change the value “start_motion_daemon=no” to “yes”

sudo service motion restart

You can now open up a browser from another computer on the same network and go to: http://192.168.0.85:8088 to view your web cam.

You can remotely control the web cam settings by going to http://192.168.0.85:8089.

Power off the RPi, hook up the battery pack and turn it on. You should now only have the WiFi adapter and web cam plugged into the usb ports. Try viewing the cam from a web browser and walk around your house or even outside.

You will need to enable port forwarding on your home broadband router to the Raspberry PI on port 8088, that will mean you can access the web cam from anywhere in the world. You can also sign up with a service like www.dyndns.org.
Worked, but then dropped after a few seconds when looked at in firefox.
aoiivier1 year ago
Hey Ryan,
I sent you a private message. Old friend hoping to catch up!
-Amanda
rjwarpath (author) 1 year ago
This project is not a substitute for network security cameras. This is just a simple project that you can do with your Raspberry Pi.

If you are looking for a cheap security camera solution, I would suggest investing in a few wireless network cameras. Each camera has its own IP address and web interface. You can even view multiple cameras through one web interface. There are also several apps available for Android and iOS for viewing the cameras.

You can connect the Raspberry Pi to a HDTV to view the cameras. Simply enable the desktop manager or (startx), then open a web browser and go to your network cameras web interface. You can also do the same thing with an old computer, instead of using a RaspPi connected to an always on monitor.
NFAZ101 year ago
I set up all the software got the IP and port working remotely. The realized that the RPi camera module is not supported. How can I enable this to work with motion
shrutin1111 year ago
Hey
I am planning to do something similar to this for my project.But I have to use the WAT-902H3 Supreme camera for video capture. I will have to use an adapter for video input. Can you explain me the hardware setup for your project...that might help me in my project.
Thanks
synaps31 year ago
Awesome build. Planning on using this for people i know on a farm that need it badly. thanks!
just wanted to know if there is a way of viewing more that one system at a time, say if you have 4 raspberry pi's around?
rjwarpath (author)  synaps31 year ago
Yes. Kinda of messy, but.... You can view more then one cam at a time with a custom html page. Lets say you have 4 Raspberrypi's....
Create a html web page with 4 iframes. Each iframe source will point to one of the raspberrypi webcam url's (http://192.168.0.85:8088). You will need to set each RaspPi to different IP addresses and port numbers. Port forward the IP's and Port numbers in order to acess the cams over the internet.

Web page example code.
Create a single html page (mycams.htm) and add the following to get started.

iframe src="http://192.168.0.85:8088" style="width:400px; height:400px; border:none; float:left;
iframe src="http://192.168.0.86:8089" style="width:400px; height:400px; border:none;float:right;
iframe src="http://192.168.0.87:8090" style="width:400px; height:400px; border:none; float:left;
iframe src="http://192.168.0.88:8091" style="width:400px; height:400px; border:none; float:right;

I can not figure out to add html code in the comment with out it disappearing. You can google search iframes or visit w3schools.org

You can also purchase Wireless WiFi IP Network Cameras from Amazon/Ebay. They can do a lot more then the RaspPi such as remote control, pan, tilt, record, audio. A good model is Foscam Indoor Wireless WIFI IP Network Camera Pan/Tilt Security Webcam
raind33r1 year ago
Wow that's cool.
Slightly OT.
Advice needed.
I'd like to do something similar.
Have the Pi hooked up to a HD cam to record squash games. Must be able to stream to a TV nearby (probably via wifi to 2nd Pi connected to TV) Must be able to start recording to Flash drive at user's discretion - maybe remote control?
Ideas?
rjwarpath (author)  raind33r1 year ago
Hmm. This sounds complicated. You may be better off using wireless video transmitters. I have seen them on amazon for less then $30. I believe they are low voltage, so you could rig up a battery pack to the one on the camera. The one on the TV could be plugged into a wall outlet.
If you were to try this using raspberrypi's:
You would need to configure one to be a wireless access point. The other would then connect to the access point to create a small wireless network.
The one on the TV side would then need to grab the video via the web, maybe with wget commands?
Starting and Stopping the recording without a keyboard and command line, you could use physical buttons connected to the gpio pins of the raspberrypi's.
I have not seen anyone doing this. It would be an interesting project to try.
peyot1 year ago
much better way of making static ip is to manage it on the router-side. it makes all stuff easier for the later time, if you decide to change something, or simply if you'll reformat your RPi's sdcard. I assume, that leaving io/wlan settings untouched will do the magic?
stew811 year ago
One detail that was causing me an issue (sudo: services: command not found) was the semantics of singular "service" vs plural service'S'. In the steps it had been written as services. After getting stuck with "command not found", I was w/o any ideas on how to fix it. So I took a guess and tried typing service. It worked!

I don't if anyone else has run into that, but I thought it might help to mention it. Great post though! Thanks rjwarpath.
I've just tried this, and I got an error (Exit motion, cannot create process id file (pid file) /var/run/motion/motion.pid: no such file or directory) when I run it. I'm using a 256 meg raspi, and it's conecting over ethernet using my PC as a gateway. I've tried pulling up the webpage with my IP instead of the current one, and it won't load. Any ideas?
Thanks in advance.
Run "sudo nano /etc/motion/motion.conf" to access motion config file

Try changing process id file to "process_id_file /home/[username]/motion/motion.pid"

The username should be "pi" or "default"

- hope this fixes your problem
Thanks. I'd got this working, but I'm getting very low quality video through. It's breaking up a lot, and turning green. I haven't poked at it for a bit, but seeing as the actual images were fairly high definition, is it possible to knock back the definition and get a more stable stream?
Quite cool, How long have you tested the Pi on that battery pack for continuously? I am still learning with my Pi and building a small rig that has a couple of wifi/bluetooth adaptors and wanted to size up a power pack as a UPS for it to run for several hours.
rjwarpath (author)  bugsy_malone 6661 year ago
The battery pack runs for about 5hrs with just the webcam and wifi adapter. The solar cells will keep the battery charged up to 50%. I suppose it would require more solar cells to charge the battery to full capacity. It works pretty well for what it is.