Introduction: Web Controlled Surveillance Camera

Picture of Web Controlled Surveillance Camera

The purpose of this work is to show, how to build surveillance system with the web-page interface. The webcam can be turned in the vertical or horizontal direction throught the interface, but only in the area that border sensors will allow. The control page is secured with login system, where the user types in an username and a password.

On the control page the user can control how the webcam will turn and how many steps it will run. The user can also turn the webcam on and off via web interface. Information about the states will immediately update to screen. User can also turn the motion detector online, if the camera detectd motion, it will automatically save the frames. Naming of the pictures is done with "timestamps", so it is possible to find out when the picture was taken.

The camera interface is coded by using PHP and XHTML programming languages. The micro controller is programmed by using C-language. System works on Linux operating system.

Step 1: Step Motors

Picture of Step Motors

You can find the step motors from the old printer. Printer usually contains two step motors. The step motor can be bipolar or unipolar.

Step 2: Making the Box

Picture of Making the Box

Polystrol is cheap and easy to modify. You can bend it to right shape with (hot air) aerophone. Hot glue is good when you stick parts together.

Step 3: Assembly

Picture of Assembly

I have used lot of parts from the Lego kit. These are really useful =). Rest of the parts are taken from the old printer. Only the switches and wires are from the electronic shop.

Step 4: Motor Driver for the Bipolar Step Motor

Picture of Motor Driver for the Bipolar Step Motor

To control the step motors we have to build a motor driver. There is difference between bipolar and unipolar motor drivers. Bipolar motor driver is little bit harder to do, than unipolar.

Used parts:

- Attiny2313-processor
- 12MHz crystal
- 2x 27 pF capacitors
- L7805CV regulator with 100 nF and 4,7uF/35V capacitors
- L7808CV regulator with 100 nF and 4,7uF/35V capacitors
- 1N5408 diode
- 2x Dual-H-Bridge (model L293B)
- TTL-RS transducer (model ST232ACN) with five 0,1 nF capacitors
- 2,1mm DC connector
- screw terminals

L293B Dual-H-bridge does not contain internal diodes !
Model L293D contains diodes.

Step 5: Micro Controller Board

Picture of Micro Controller Board

Solder the components on the board and that's it. About the wiring.. there is nothing to say =)

Step 6: Done

Picture of Done

System is ready to use.

Step 7: Easy Motion Detector Program

This works only under Linux!

1. Install your webcamera.
2. Install capture software called Xawtv. It creates file called .webcamrc
3. Open the file with your favorite editor.
4. Delay defines how often the still-picture is sent to server. I used 7 seconds.
Dir defines location folder where the picture goes. Something like: /usr/webcam/pictures/
File defines name of the picture. Something like caption,jpgor what you want to use.
5. Save and exit.
6. Now you can try the command webcam & . The program start updating the picture on every 7 second to
the defined dir folder. & option, put it to run on background.

And next..

Install ImageMagick software.
Under Fedora command is: yum install ImageMagick

Software contains function called compare and this is what we need.

Now you have to code a Shell script. Use your editor to do that.

cp $PATH/caption.jpg $PATH/tmp/caption2.jpg
sleep 10
compare -metric PSNR $PATH/caption.jpg $PATH/tmp/caption2,jpg null > result
result2=`head -c 4 result`
if test $result2 -lt 300
time=`date +%_T_%F`
cp $PATH/caption,jpg $PATH/save/$time.jpg

Now you can run your script with command: sh gived_script_name
If the picture contains difference, it will be saved to defined folder. In my example it goes to /usr/webcam/pictures/ save/

About the ImageMagick and the compare function you will find more information from here

Step 8: Codes

Codes are commented in Finnish.


Juan CarlosA made it! (author)2017-06-18

Fue fabricado como proyecto de la materia de Ingeniería de control por computadora.

bondie7 (author)2011-09-20

i m trying to make a this project and plz tell me methodology

instructaboy2 (author)2011-05-26

hey man can you please link me to where you got your components for the build i got the step motors there a bit monstrous but they work i just need the rest of the stuff my Email is

tinker234 (author)2011-05-22

cool wow if i could shrink this with micro servos then i could make a robot like bladeruner

bengus (author)2010-11-19

hi..nice work!
where can i find the firmware for this and a better resolution schematic?

cliffyd (author)2010-10-25

Ok you have done a nice job but it's just so over kill. I did the same project with two servo's ( eliminating the need for the whole stepper thang here) and it's just such a mess of wires. the exact same thing can be done with 2 servos, a free webcam software download called Yawcam and an arduino, That's it! I will say it must have taken quite sometime put into it and is nice. A+

iideetee (author)cliffyd2010-10-25

I have done it also with servos:

thisisweak (author)2010-06-23

Use my instructable to make it work on bright sunlight!

andersop (author)2010-03-17

possible to get the codes commented in english?  (a) :D

Openz (author)2010-02-21

please im Engineering project on Object tracking
can u send me full information about this please

pesworld66 (author)2010-02-02

i am very serious on this project can u please provide more details , as to how to store the video in the hardware.....and also any  furthur details if u have missed here...
my id

plzzzzzz help!

bsommers (author)2008-05-21

Cool instructable. Am I missing the link and instructions about programming the Atmel microcontroller?

iideetee (author)bsommers2008-05-21

You are right, these things are missing. I have documented every step on this work and it contains 56 pages. My English is what it is, so it is hard to translate them all, but I can do it if someone needs more information about some step.

mzmaker (author)iideetee2009-02-17

Also I though about using the Arduino? what at your thought on that?

ewertz (author)mzmaker2009-09-16

Clearly you can do it. Assuming that you want to continue to use steppers (rather than servos), you could do it with the help of a motor shield like that from

mzmaker (author)iideetee2009-02-17

Hello, I am building this for actual surveillance in long ranges at night time using infrared, could you please please send me the missing information to and also maybe I could use google translate to translate the whole 56 pgs document? Take Care Martin

exchequer598 (author)iideetee2008-08-06

Hi! I'd like to work on this project. Can you please send me the link and instructions about programming the Atmel microcontroller?

slasher03 (author)exchequer5982008-09-30

hi id would like to ask if you could help me in building this web controlled camera please send me the instructions guide on how to build it including the micro controller and its parts used ill be using this as a project in our school hope you reply soon here is my email address to where you can send it its, thank you in advance

Wickedweed (author)iideetee2008-06-06

hi, can you send me the instructions about programming the Atmel microcontroller too ? Thank you.

yousokwesi (author)2009-04-20

off topic question... anyone know how to make a 2.4 wireless security camera hard wired? i get a lot of wifi interference and i just want to run direct RGB line if possible instead of buying 5 new cameras.

ewertz (author)yousokwesi2009-09-16

The level of integration in off-the-shelf consumer products (even moreso at the high-end) usually makes mods like these non-trivial. The first thing to check out is if your camera vendor offers a wired-equivalent to your wireless camera and see if there's simply a board that you can purchase from them to swap-in. This would seem to be your best bet. Most analog cameras that are hard-wired use coax. My guess is that if you're actually considering hacking your existing cameras, that you might just want to get/build a wireless receiver to co-locate with your camera(s) that converts to coax.

ewertz (author)2009-09-15

Since you pointed out the difference between the L293B and L293D, why'd you choose to go with the "B"? Is it a case of "I had a B around (and not a D) and chose to use it" ?

iideetee (author)ewertz2009-09-16

Yes, "D" ones were out of stock.

vince086 (author)2008-05-23

Cool Instructable!!!!! Is it difficult to build a controller for a steeped motor? I have this old printer and I tried to get the ink tray to move, but no result, and you sound like the guy that would know how.

iideetee (author)vince0862008-05-26

Reply mailed =)

silentdmx (author)iideetee2009-04-03

Hey wondering if u need any help sending all the emails to these people ill gladly send them for you and if you speak french or spanish i might not need 2 much translation. My email is

vince086 (author)iideetee2008-05-27

sorry for not replying to your very helpful mail. It is a bipolar one. Is it difficult to make a micro controller to make it go back and forth? Or is it possible to get one on the Internet? Makes cool sparks when you touch the battery !

iideetee (author)vince0862008-05-28

No it is not difficult and the micro processor needs only couple lines of code to work that way. What is your operating system ?

vince086 (author)iideetee2008-05-28

Windows XP. thanks for the help

iideetee (author)vince0862008-05-29

I'm dumb with the Windows. I use only Linux systems and that's why I don't have any idea how to communicate via serial port in Windows.

vince086 (author)iideetee2008-06-15

is it possible to buy a microcontroler that will move the motor back and forwards depending witch way you flick a switch ???

iideetee (author)vince0862008-06-17

Everything is possible, but you have to have some knowledge about electronics and C-programming. There is also ready build controller boards, just add the motors. Google will help you to find more information about these boards.

vince086 (author)iideetee2008-06-17

sorry for all the questions but it would be cool to be able to control a stepper motor. I was wondering, I am taking a new printer apart, would there be microcontrolers in it to control the motors?

yaelyney (author)vince0862008-06-19

can i watch the video through the internet using this surveillance camera? how?

vince086 (author)yaelyney2008-06-19

no idea, your asking the wrong person.

KaptainKaveMonkey (author)2008-10-24

Where do I get the Polystrol?

you can find them in some craft stores they use them to make "slide-in" picture frames and they are cheap so you can cut them up and do whatever

akatsuki666 (author)2009-02-09

it said something on there about i microcontroller bord. wheres the program for that if you need one ps i didnt realy read much into it so..

hdogg (author)2009-01-16

hey that's amazing!!!!!!!!!!!!!!!!!! will any printer's motor work?? also could you email me the instructions too???

godsmoney (author)2008-11-04

Man I have like a mountain of questions here: which interfacing port did you use? what microcontroller and how did you program it? how did you drive the clock for the circuit? and so on you see there is a ton of information you didn't mention. I am really excited about this I want to make one of my own but this is just not enough I'm afraid. I guess what I am trying to say is how can I get these info from you?

iideetee (author)godsmoney2008-12-02

Something about this project. I can't recommend to do this. There is lot of things what have to be change so it will be useful and functional. Maybe it looks cool but it is not anything else. Yes it works, but the controlling is painful. My advice if someone wanna build this kind of system is forget the stepper motors. Servo motors are 100 x better for controlling the camera. That's why I build the new system with the servo motors and it is functional and lot of easier to do. I also made new web controlling system for that.

elsiecc (author)2008-10-30

Hi! Do you have any programmes to recommend tt i can use for window XP? I read through your instructable and decided to head on with it for my project. =) you can also reply me at

ray_blader38 (author)2008-10-29

do u have the code in english? thanks alot.

rsgino7 (author)2008-10-03

Can anyone who has the instruction please send it at

rsgino7 (author)2008-10-03

Hey, great instructable! I want to start this ASAP. Can you please email me the instructions at Thanks in advance.

CAR_RAMROD (author)2008-05-20

Nice use of lego technic parts!

awkrin (author)CAR_RAMROD2008-05-20


andyhuntdesigns (author)awkrin2008-06-15

You've never heard of Lego?The most famous of all Danish toy companies?

awkrin (author)andyhuntdesigns2008-06-23

I know what lego is. I even know some of its history, but my question was: what lego parts were used in this instructable?

CAR_RAMROD (author)awkrin2008-06-23

Did you read the intructable?

About This Instructable




More by iideetee:Atmega16/32 Development Board With LCD30$ Surveillance System With User InterfaceBinary Clock
Add instructable to: