• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Turn that old computer into a security system!
#1
Thumbs Up 
I don't know if this is really going to be considered a tutorial. The code is not groundbreaking, but the information is going out as per request of MarkW7 on my old computer thread.

I make a few assumptions here:
You have an old computer on your network.
You have a webcam installed on it.
You have a workgroup.
You have VB6 or want to run my executable.
You have internet access.

1. Get the computer ready. Mine is a thin Dell 500mhz with 384megs ram running Windows XP trimmed and tuned for maximum performance. I had to change some bios settings so the computer 'halts on no errors' because it has no monitor, no mouse, no keyboard. I installed Teamviever so I can access the actual computer. This is important the way I am doing this(with 2 cameras), because the control that handles the cameras asks every time which camera is which and I have no idea at this point how to circumvent that technical annoyance. I shared out the desktop on the network, because the application saves the images as a DIB on the desktop and a little http file serves up the images with a refresh. Also it make it easier to update the program on the computer. You just drag from one window to the other and BAM the file is downstairs.

2. If you are going to make the executable yourself so need to download and install (ON BOTH COMPUTERS)the ezVidCap control by Ray Mercer with the included register.bat file from here:
http://www.martin2k.co.uk/vb6/tips/vb_35.php
Or you can download my executable from here(even if you use my file, you will have to install the control). It is made for 2 cameras so if you are using just one, click past the second dialog that comes up and it will work fine. After you install the ocx you downloaded, you need to make it available for your coding. You do this by clicking Projects, then Components. An applet pops up and you have to find the ezVidCap Component by Ray Mercer (VB6). Put a check in the box and click ok. Then you will see you can add the control(circled in red below) to your form.
[spoiler][Image: ocx.jpg][/spoiler]

3. Add a button and an ezVidCap control and a timer(not in picture) to your form so it looks like this- more or less:
[spoiler][Image: form.jpg][/spoiler]


4. Add the code(you may have to change the names to match the names of your components):
[spoiler]
Code:
Option Explicit

Private Sub Command1_Click()
ezVidCap1.ShowDlgVideoFormat
End Sub

Private Sub Timer1_Timer() 'every .5 seconds save a new image to desktop
On Error Resume Next
Call ezVidCap1.SaveDIB("outside.bmp")
End Sub
[/spoiler]

5. Make the executable and test it on the computer you are using.


6. Make the display page to match the name of the .bmp file(s). Heres some html code for that:
[spoiler]
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<META HTTP-EQUIV=Refresh CONTENT="1; URL=cam.htm">
<title>Camera</title>
</head>
<body bgcolor="#00">
<p align="center"><img border="0" src="outside.bmp" width="320" height="240">&nbsp;&nbsp;
<img border="0" src="inside.bmp" width="320" height="240">
</p>
</body>
</html>
[/spoiler]

Looks like this tonight:
[spoiler][Image: cams.jpg][/spoiler]

7. Set that computer up near where you want the cameras. I have mine behind the couch with usb network dongle connecting it to the network. See the picture:
[spoiler][Image: camcomp.jpg][/spoiler]


8. Make a shortcut-favorite-bookmark in your browser to the htm file. Mine is 'file://Basement/desktop/cam.htm' if you just point it at the bmp file, you will not get a refresh. Now a nice variation of this application would be to add an inet control to this application that ftp uploads your image to to your hosting service. This would get the images outside of your network and you could view them anywhere- of course the cam computer does have Teamviewer installed so it already can be accessed anywhere on the planet but it's kind of a pain to do it that way. I'd rather open any browser and whip out a short url.

9. You're done. A quick easy solution that costs just about nothing. That button I put on the form lets you change the resolution of the camera. If the image is load too slow and you can see fine, lower the resolution and I think you will like the results better.

My house has 3 levels and a wireless network so rather than running wires all over the place, I can just add another computer. Even if I just want to put the a camera temporarily on something like watching paint dry, I can. I just put a netbook where the cam can see it, run the program, share out the folder it saves the images to, and I'm locked and cocked. A future tutorial, if I do it, will feature some more advanced security features that interface the parallel port such as motion and breach detection. Everyone needs lasers and mirrors watching their intrusion points- a physical firewall.

Ooh, nice reverse metaphor!


This is a recycled thread from hf
Having long hair is great until you have to pull a footlong out of the dog's butt. flatank.blogspot.com
I. AM. LATCH.
  Reply


Messages In This Thread
Turn that old computer into a security system! - by latch - 19-11-2010, 02:31 AM

Forum Jump: