Web Controlled Webcam

Out of boredom, I decided to salvage some parts from my house and build a remotely controlled webcam. It’s a webcam connected to a stepper motor that’s connected to a motor driver IC that’s connected to my computer’s parallel port. So using my computer, I can command the camera to pan around. But that’s not enough. I wanted a camera that you can control using any computer or pda or device that’s connected to the net. And this was how I made it.

Obviously a big table is not enough to contain my messiness.

Just a run through of the various pieces of hardware show in the picture above. A computer power supply supplies the stable 5v to power the L293D IC and the stepper motor. The L293D receives input from the parallel port and drives the stepper motor accordingly. I have written special batch files to send the proper signals to the parallel port to drive the stepper motor. A stepper motor (especially a bipolar one) is a pain to drive. They require a specific sequence to make it rotate in the direction you want it to.

Click here for more information on driving stepper motors with the L293D.

This project uses just one IC: the L293D.

The L293D was chosen because it was perfect to drive bipolar stepper motors. And since the current rating was higher than what I needed, and I had some spares lying around, it was the best solution to my problem. It does get quite hot after a while if you keep the stepper “latched”. Thus, there’s a special script that “releases” the stepper motor so the IC won’t have to constantly drive it. It’s more of a precaution than a necessity because the L293D can easily handle the current the stepper motor takes.

Got this from a broken printer. I have 2 of these. If I had more powerful stepper drivers, I would drive them at 12v for some shaft breaking torque.

The stepper motor is a bipolar type. It has 4 wires coming out from it. It’s more difficult to drive bipolar stepper motors because you need to REVERSE the current during the sequence. You don’t need to do that with unipolar stepper motors.

I superglued the plastic “IC holder” to the gear of the stepper motor and tied the camera to it. Then I taped the stepper motor to a sealed lead acid battery (selected for its weight). Very fast and dirty way of building a motorized camera mount.

The circuit I’m using. I modified it from one of the schematics found here: http://www.seattlerobotics.org/encoder/may98/steppers.html

You need to connect only pin 2, 3, 4, 5 and ground to the circuit. The software will take care of the sequence needed to drive the stepper motor. You can download my customized software from here. The software is modified from winportcontrolajax.zip which can be downloaded from http://www.epanorama.net/circuits/parallel_output.html


To use the software, you need another 2 additional pieces of software. First, you’ll need Pryme which is a software that will automatically take a picture using your webcam at specific intervals. Next, you’ll need Abyss web server and also php support. The links are below:

Download Abyss web server.

Do this after installing Abyss:
Adding PHP support to Abyss web server.

Download Pryme.

Once you get everything installed, you need to put the files in camcontrol.zip to the “htdocs” directory in you Abyss installation. And you need to configure Pryme to save the pictures into “htdocs” (or the same directory as where you put the files in camcontrol.zip) using the filename “image.jpg”

Once you get everything configured, you should see this page. Buttons are self-explanatory. “Release stepper motor” will cut current to the stepper motor. Image will be updated once every 2 seconds. It’s recommended that you use Pryme to take pictures every second so there won’t be a sharing violation (i.e. browser trying to read the image file while Pryme tries to replace it with a newer one).

And the best thing is, if you configured your router correctly, you should be able to access this from anywhere in the world. I’ve volunteers (some have been forced though) from Nilai and one all the way from London! And it works! It was just amazing. A click of a button from halfway around the world can move a camera connected to a PC in Malaysia.

Wanna see who’s in your room when you’re at Starbucks? No problem!

Of course, this is just a proof of concept. You can virtually control anything with your parallel port with the right hardware. Maybe you want to turn on the lights at your home when you’re on vacation to give the thieves (or neighbors) the false impression that you’re at home. Or you can use it to drive your car if you have a wifi enabled PC in your car. The possibilities are endless. Go play! Continue reading

Play the Mafia Game

“Mafia (also called Werewolf or Village) is a group role playing game of strategy, survival, and the ability to spot a fraud. The imaginary setting is a small village where the local townspeople and Mafia are in an all out battle for survival.

There are numerous variations of the game. The version described here requires a deck of cards and works best with between twelve and twenty four players. ”

I played this game before and it’s very very addictive. One of the reasons is because it’s a team based game and you really enjoy the suspense of the game. Try it out and you’ll know what I mean. Full instructions here. Continue reading