Sunday, July 1, 2012

Outlet Control Pictures


I took some pictures while I was making a permanent enclosure for my web-controlled power outlets. These are going in the kitchen and are attached to the old Gateway that plays my fridge music and serves up my tunes. I made it work in a way that each plug on the outlet can be independently controlled.

 

 Oh, and I used a ton of hot glue to seal everything up...

 



I took 12V DC control wiring from the IDE drives' power wires and ran it out of the front of the computer.



Very professional!




New update relating to my lamp: I was successfully able to install a webcam and set it up to monitor the lamp. This is more of a temporary solution until I can learn Python.

Any way! I installed a program called "streamer" which can do many things, including take a JPEG picture from a webcam. Then I wrote a script to run this program every second.

#!/bin/sh
while [ true ] do 
 streamer -s 640x480 -f jpeg -o /var/www/images/snapshot.jpeg 
 sleep 1
done

The picture gets rewritten every time it runs. That way the web server doesn't need to think about which picture to show. Now I need to execute this program as root at boot time. I added a line to the /etc/init.d/rc.local file:

/home/bryan/streamer &

Hooray! This method obviously takes quite a bit more system resources. If this was something that people would look at all the time, maybe it would be a good method, but I'll maybe use this once a week, so hopefully when I learn Python I'll figure out a way to execute the "streamer" program once when the page is requested.

No comments:

Post a Comment