DIY surveillance

DIY 4-camera security system can identify vehicles
by Aiden James (10. 2.  2012)

Day: mega-pixel USB webcams modified for CS-mount lenses 
Night: 0.01 lux CCTV board cameras

All cameras are available under $50. All software is free for personal use.

Desktop PC:
MB   Gigabyte GA-G31M-ES2L
CPU  Pentium Dual-core E5200 (2.5 GHz) over-clocked  15%
HD   Western Digital SATA 250GB, 16MB cache
USB PCI cards   Masscool MTU25 (try the cheaper SKU 52832   PCI-USB NEC Card for Desktop Computer
OS   Windows XP SP2
SW   Yawcam, AutoHotkey & AutoScriptWriter (recorder)

Cameras are panned in pairs (photos):

1 HD webcam and 1 board cam, with a 5V bi-polar step motor with lead screw.  #17284-MS   New surplus
Haydon p/n 20841-05-028  5VDC/18ohm/5.5mH/.27A 
linear step 0.001"   max travel 1.25"   for 2-56 nut

Motors mount on a urethane hinge.  A model airplane 2-56 swivel ball link joins lead screw to cameras which pivot on a 1” nylon bushing and 0.125” dia dowel pin.   Not shown, another installation is used upside down with cameras pivoting on threaded bushings and a screw.
With a switch I control either of 2 steppers on ribbon cables with a single microcontroller and driver (SN754410) near the PC.  You can buy microcontrollers pre-programmed or do your own

Two mega-pixel (HD) CCD webcams were selected for relative ease of exposure adjustment, generally inconvenient on webcams.

1st choice:

Logitech QuickCam Pro for Notebooks (1600x1200 resolution), now sold as Portable Webcam C905 (960-000045) for Notebooks). 25 x 50 mm board.
The older QuickCam software is more convenient for security use.
Pro: 2 mega-pixel resolution. Auto-exposure. Easy to use 63' from PC.
Con: at intermediate lux, auto exposure maximizes exposure time over gain, necessitating manual control to minimize motion blur.

2nd choice:
Hercules DualPix HD720 for Notebooks (1280x800 resolution).  15 x 33 mm
Pro:  Its wide format is sometimes preferred. Small size
Con:  Daylight lux exceeds auto-exposure range; Must be set manually. Use over 15' and up to 63' from PC requires a Peltier cooled USB hub.

Although only 640x480 resolution, the Labtec 2200 webcam deserves mention for good auto-exposure, low CPU load, small 20 x 33 mm size and $20 price.  A USB 1.0 device with low current requirement, it can be used far from a PC with cat 5 cable and USB/RJ45 adapters. Its small sensor takes a shorter focal length lens than the other cameras in this article for the same field of view.  has CCTV cameras 10mm sq. and RF links to match.

Picture taken with original camera lens

CS-mount lenses with integral electrically switchable IR-cutoff filters:
Smaller lenses degrade HD cam resolution and lose focus with time.
Increased aperture reduces exposure time and motion blur.

Picture taken with modified camera (CS lenses)
In 4, 6, 8, 12, and 16mm focal length. About $17
Order CS lens holders separately; specify 20mm mounting centers.

Switching out filters increases sensitivity for low light.  Switching is by a momentary 4V pulse.  A brief pass with a permanent magnet works too. 

Camera modification for CS lenses
(QuickCam photo):
Desolder and remove original lenses, LEDs, and, on the QuickCam, the large transistor (circled).  Tape paper over the sensors to prevent resin splatter, then wick up solder for flush mounting of the lens holders. File the DualPix lens holder for component clearance.  Add strain relief for wires/cables (the square in the QuickCam photo). 

Mounting cameras:

Re-tap CS lens holders for 2-56 screws, de bur, and paint bases with nail polish to insulate.   Secure with an aluminum plate which includes a 6-32 screw (photo).  Between the plate and camera back I use soft, thermally conductive silicone sheet material (not a “paste”):
"Heat Sink Thermal Silicone Paste"  SKU 35819

USB connection:
For each HD webcam 63' from a PC I use 2 active devices:
a Cables Unlimited USB-1810 hub, connected to the PC by 15’ of cable  including the hub pigtail, and a 10m active extension cable plugged into this hub, terminated with 15’ of passive cable including the webcam pigtail.

Don't omit the hub’s power supply.  HD webcams require 0.5A.  To this value add requirements of the hub and active extension cable, although both (“Generic USB hubs”) are reported as 0mA in Device Manager by their generic drivers.   Self-power minimizes transients in the PC-hub link.

The USB-1810 hub includes a Schottky rectifier in series with the PC USB V+ permitting use of voltage higher than the PC USB V+.   For the QuickCam a 5V supply is fine, but the DualPix requires a higher voltage. I use discarded cell phone supplies.  The V+ jack accepts a 3.5mm dia. plug, center positive, which can be bypassed by soldering.  The board in these hubs has components on 1 side only, convenient for cooling necessary when used with the DualPix.

This active device chain must be installed by the OS stepwise:  Connect the hub (already energized with its power supply).  Wait for the OS to install it.  Then connect the active cable without the webcam to the hub and wait again.  Device Manager identifies both as "Generic USB hub”.
To record installation processes (including that for the webcams and, later, A/D converters) for reference, save screen shots of Device Manager with "Imaging Devices", "Sound...", and "Universal Serial Bus Controllers" tabs expanded.

Further suggestions:
For a PC to HD webcam distance to 15’ use passive cable.
For 15' to 30' use a USB-1810 hub and power supply with up to 15’ input and up to 15’ output passive cables, including pigtails.
Over 30’ plug a 10m active cable into the hub

Chained active USB devices aren't hot pluggable; once the OS has installed a chain, leave it alone.  Only the camera at the end may be re-plugged hot and only while deselected.
Don't boot the PC without the hub power supply, or open the chain at any point, except at the camera,  with the PC on. 
As a remedy if you do, shut down and fix things, and then boot up.  If this doesn't work, dismantle the entire chain; disconnect the cam, the active USB cable, and the hub. Then uninstall them in Device Manager (to show hidden devices, Search "Device Manager hidden devices") and repeat the entire installation procedure.

All my DualPix cams used with hubs and active extension cables exhibited image splitting.  The problem is lux dependent; use a bright scene for tests.  Simultaneously cooling the hub and raising its voltage eliminated the problem.

I use a single Peltier cooler 40mm sq (Digikey # 102-1678) under a pair of USB-1810 boards, without shells.  The cooler with the chips (1 per board) centered over it is powered by a DC-DC converter (Digikey # 555-1055) adjustable by resistor.  After reducing the temperature, gradually raise the hub voltage with an adjustable switching supply until the image is stable.  Do not exceed 5.5V.  With Peltier coolers anticipate and prevent condensation and electrolysis.

I've operated 2 DualPix cams 63' from PCs this way since June 2011.
Had I known then how to use 2 QuickCam cams simultaneously (see below), I might not have bothered solving the DualPix 63' problem.  But in some cases its wide format or small size makes it preferable to a QuickCam. 

Initial CD-prompted installation of the HD webcams must proceed by plugging them directly in the MB (any free socket), even if they will be used only with passive extension within 15' of the PC.  Afterwards connect them, one at a time, to passive cable or any chained active links previously installed, checking Device Manager for success. 
At night CCTV cameras (board cams) are required, in addition to artificial light.  There appears to be only one design for lowest lux (0.01), employing Sony EXview sensor and Effio DSP.  I use NetView NV-0B470  32mm sq.  Resolution is 700x576 (PAL). They came with IR-cut filters easily removed after warming with a hair dryer.  Adhesive residue came off with isopropyl.
Suspect board cams claiming lower lux.  "sense-up",  a multiple exposure gimmick useless for motion detection, may actually conceal a high lux sensor.
Use CS lenses and holders described above.

The NV-0B470 requires a cable, sold separately, which plugs into 2 camera sockets: video, gnd & +12V; and OSD (On Screen Display) menu. For pan-mount cameras, where a thin flexible cable is desired, I divide the cable and connect the OSD menu portion only for programming.  To program cameras installed a distance from the PC I use a small monitor:  SKU 49796 3.5" TFT LCD Monitor...(NTSC/PAL DC8-15V) $22.60
Search "  BoardCam OSD  Manual.pdf"

In certain daylight settings board cams can supplement CCD webcams, in freedom from glare effects as well as in revealing shadow detail.

With webcams installed the OS crashed with every A/D converter I tried; Easycap (NOT plug & play in Windows XP !), Atlona USB-202, and Diamond VC500.  The solution was to plug the convertor into a USB PCI card, Masscool MTU25.  With 2 cards installed I can use two converters simultaneously. 
Or I can use 1 converter and a duplicate of one of the webcams plugged in the MB. Running 3 HD webcams is the limit for my hardware.

Even if duplicate webcams aren't used simultaneously there's an advantage to having one of the pair on a PCI card.
Switching analog cams is easy... a mechanical switch.
Duplicate webcams can be plugged in the MB but accessed only singly with an interval, duration depending on hardware, with neither device selected... or the OS crashes.  No interval is needed if one of the duplicate cams is plugged in a PCI card.

To each USB PCI card I connect only one device, either a webcam or an A/D converter.

I disconnected  and uninstalled all USB peripherals before installing the USB PCI cards, 1 at a time.  In Device Manager | Universal Serial Bus controllers,  expand each USB Root Hub and uncheck “Allow the computer to turn off this device to save power”. 

I had to install PCI card Esycaps before motherboard HD cams, or the OS used an HD cam driver for the Easycap and the Easycap installation failed.

(Windows XP Easycap installation failure scenario and fix.

With Windows XP installing Easycap requires first plugging it in, then, once detected, overriding all defaults directing the search to the folder with its support files.  In addition, it may need to bethe first imaging device installed.

If the failure results in simply the appearance of an "Unknown Device" entry in Device Manager | USB Controllers....
Leave the Easycap plugged and disable the entry. Then re-plug.)

Counter-intuitively, correcting this requires re-installing the working HD cam, then disconnecting and uninstalling it before installing the Easycap.  Try this when a device fails to install and an unexpected Device Manager entry appears in place of the expected one (here “USB 2.0 Video Capture Controller” in place of “Syntek STK1160) which can't be uninstalled after you disconnect the un-installable device.  The “cannot uninstall” message explains that a driver is  being used by another device.  To identify which one, look at the Driver Details for the
un-uninstallable device entry.

The OS often fails to recognize a successfully installed Easycap after booting.   In Device Manager hidden devices view, the Easycap entry appears correctly labeled but grayed out as if disconnected.  Simply unplug and replug the Easycap.  Likewise if an HD cam is grayed out, simply unplug and replug it (only the cam, not the hub or active extension cable, if used).  In Universal Serial Bus Controllers, you can uninstall any “Unknown Devices” whether they are grayed out or not.  Having attended to these boot up nuisances all HD cams and converters are usable simultaneously.

When “chkdsk c: /r” after a crash doesn't fix things suspect hardware, connectors first.
I partition HDs with Partition Wizard, keeping data off the system partition.
After all imaging devices are installed and application programs set up, I use Macrium Reflect to save a system partition image.  To restore I invoke Macrium from a bootable BartPE thumb drive, handy too for invoking “chkdsk c: /r”.