Hardware Reference
In-Depth Information
Network Cameras
Cameras that connect to the Internet have been available
for several years now, and the prices on them, predictably,
get cheaper and cheaper. For about $60, you can get a
small camera that has a WiFi module onboard and that
runs as its own server. The one used for this project, the
D-Link DCS-930L, was purchased at an office-supply store
for $70.
insecure because anyone who views source on the page
can see the password, so make sure the account has no
privileges whatsoever to change or view settings!
Once you think you know the public URL of your camera's
image, test it in a browser. It's a good idea to test away
from your home network. When you're satisfied it works,
embed the link in the index.htm page that you wrote previ-
ously, and try it out. You'll also need to make the change
to the image's URL in the JavaScript in the document's
head. Now your server is on the Internet for real!
Setting up these cameras is very straightforward, and is
explained in the documentation that comes with them.
First, you need to connect to the camera through a wired
Ethernet connection, and open its administrator page in
a browser (just like you're building for the air condition-
er—hey, how about that!). There, you configure the WiFi
network you want to connect to, save it to the camera's
memory, and restart the camera.
There's one last stage of this project. You have to replace
those placeholder variables for the temperature, thermo-
stat setting, and air conditioner status. To do that, you
need to add some more code to your sketch.
X
Since the camera is running a server, you need to know
its address. You can use the same methods to make your
camera public as you did for your Ethernet module. You
may have to change the port that your camera serves
images on, because you probably want port 80—the
default HTTP port—to point to the Ethernet module. Port
8080 is usually a good second bet.
Figure 10-10
Screenshot of the final CatCam Thermostat control,
taken on an Android phone.
Once you've set up port forwarding for your camera, you
can embed the address in a link in the Ethernet module's
HTML. For example, if you're using the DCS-930L, the
path to the image as a .jpg file is /image/jpeg.cgi. Let's
imagine the public address of your home router is
63.118.45.189 (it isn't, so go look it up), and you set port
forwarding on port 8080 to point to your camera's port
80. The link for the public page would then be <a href
=”http://63.118.45.189:8080/image/jpeg.cgi”> . However,
the D-Link cameras, and many other brands, expect you
to supply a password to access the camera. So, add a
visitor user account that has view-only access to the
image, and change the URL to <a href =”http://username
:password@63.118.45.189:8080/image/jpeg.cgi”> (fill in
the username and password that you set). This is highly
 
Search WWH ::




Custom Search