Intelligent Video Switcher

Monitoring several cameras on one monitor is usually done in one of two ways:  divide the screen into sections and show them all at once, or time sequence the cameras onto the whole screen.

This device uses the second method (which, if you don't already know, requires about 100 times less parts), but adds motion detection to switch cameras.

The usual way to detect motion is to store a complete video frame and then look for changes on successive frames.  Again, a lot of trouble can be saved by only sampling 64 locations on the screen at a low resolution (i.e. just using the A/D in the PIC).

Since this device is designed for up to 4 cameras, that is still a lot of data to store in our PIC.  Another method was developed to greatly reduce the memory requirements.


Three numeric sums (modulo 256) are computed from the 64 samples in the video frame.  The first sum either adds or subtracts the video sample on a 'checkerboard' basis (see fig-1).  Any object moving from one cell to an adjacent one will create a shift in the sum. A second sum is made using the pattern in fig-2.  This sum is more sensitive to larger objects that may not affect the first sum.  Likewise, a third sum is made using the pattern in fig-3. Now we just add the 3 sums!  A single 8-bit value now reacts to almost any changes in the visual field. All we need to do now is take the samples.  There is no way for the PIC's A/D to sample 8 times on a single video scan line.  However, it has no trouble taking one sample per line. 


The figure at left shows how this is done.  After detecting the horizontal sync pulse for each of the 8 lines, a variable delay is generated before the sample is taken.  Since we are only interested in a 'low resolution' data sample,  the line skewing really makes no practical difference.


Referring now to the Schematic.  Each of the 4 video inputs goes to both U1 and U2.  U1 controls which input is routed out to the monitor.  U2 controls which input goes to the detection circuit.

U4-A acts as a 'video clamp': it forces all of the sync tips to zero volts.  This allows U4-B to 'slice' off the sync pulses and feed them to the PIC.  The PIC can now locate the Vertical Sync by looking for a set of 6 wide Horizontal Sync pulses.   It then counts Horizontal Sync pulses to find the start of any particular video line.

The  Source File only implements the 4 cameras. You can connect any number from 1 to 4 and the software will sort out the detection and switching. Motion on any video input switches the output immediately to that source.

Additionally, any IR signal detected switches to the next camera.

The Object File, and Board Layout are also provided.