2016-08-13

How to Set Up a Foscam C1 Using cgi-bin Commands

Background

The Foscam C1 is a relatively nice ip camera, offering 720p for <$60 (at the time of this post). However, the web interface is a complete disaster. For some reason they ask you to download some web plugins to be able to admin the thing, and those plugins aren’t compatible with Linux. We tried using my wife’s Macbook but the plugin file she downloaded popped a virus warning.
Ok, fine, we will not be using that crapware.

Time For Plan B

A bit of googling reveals that Foscam has a fairly robust cgi-bin interface to their cameras. Annoyingly, they of course try to obfuscate and hide the information as much as possible. But I was able to track down an old cached version of one of their cgi-bin interface documents. It turns out that one can completely set up the camera via cgi-bin commands. Here’s how to do it.
  1. Start fresh (or reset the camera). Plug in the power and connect the cam to your router with an ethernet cable. Press the “wpa” button for 10 seconds until the camera makes a silly little series of chimes. Go to your router and find the ip it grabbed. I’ll assume it is 192.168.1.25 for all of the sample commands below.
  2. Change the default (blank) password on the admin account.
     https://192.168.1.25/cgi-bin/CGIProxy.fcgi?cmd=changePassword&usrName=admin&oldPwd=&newPwd=mynewpassword&usr=admin&pwd= 
    
    Of course, in the above, replace the ip address to your camera’s actual ip and “mynewpassword” to your desired new admin password. You should see a simple return output from the command with the result code = 0.
  3. Check that the command works by grabbing a screen shot using your new password.
     https://192.168.1.25/cgi-bin/CGIProxy.fcgi?cmd=snapPicture&usr=admin&pwd=mynewpassword
    
    You should see an image of whatever the camera is pointed towards. But it probably looks rather bad because the default setting is a highly compressed jpeg.
  4. Fix the snapshot quality.
     https://192.168.1.25/cgi-bin/CGIProxy.fcgi?cmd=setSnapConfig&snapQuality=2&saveLocation=1&usr=admin&pwd=mynewpassword
    
    Now if you ask for a screenshot again (as in step 3) the image should be much better.
  5. Set a static ip address. Let’s assume you want to use 192.168.1.100. Use this cgi command:
     https://192.168.1.25/cgi-bin/CGIProxy.fcgi?cmd=setIpInfo&isDHCP=0&ip=192.168.1.100&gate=192.168.1.1&mask=255.255.255.0&dns1=192.168.1.1&dns2=8.8.8.8&usr=admin&pwd=mynewpassword
    
    Wait for 20 seconds or so and verify on the router that the camera is connected with the new ip address.
  6. Set up wifi (assuming you are using it). Press the WPS button on your wifi router and then press the WPS button on your camera. The blue led on the camera should start rapidly blinking after about 30 seconds. Wait another 2 minutes and then power it off, remove the ethernet cable, and power it back on. The camera should now be on wifi, and using the ip set in step 5.
So at this point the camera is set up and connected to wifi. You can check by grabbing a screenshot as in step 3. And at this point you should be able to download an app like OWLR on your smartphone and use it to stream video.

This doesn't get into setting up motion detection, but the cgi-bin document indicates that it should be possible to turn motion detection on and set up either smtp or ftp transmission of images. I'll look into that later.

No comments:

Post a Comment