The two channel video switcher

 

They say an Englishman's home is his castle and although my particular palace may only be a 1970's semi detached located in the elephants graveyard part of Leamington (where retired people come to die), I don't want it invaded by hordes of unwanted visitors intent on catching me on my doorstep in the hope I'll hand over cash for their cause, sign up for new uPVC windows or become converted to their religion. I don't care who you are or who you represent, just because you happen to have walked off the street and interrupted my privacy by knocking on my door, don't expect to take a slice of my bank balance and don't think you can convince me to subscribe to your particular version of 'the magic man who lives in the sky'.

Being as antisocial as I am, when I moved into my house in 2002 one of my first barmy projects was to install a camera onto my front door so that when scumbag charity workers and religious nuts came knocking I could see 'em coming from the TV in my living room and shout "fuck off" without having to get up off my arse or risk spilling my beer.

Indeed, my video cable runs around the house, behind walls, above ceilings and behind skirting boards. It's completely hidden and provides me with that all important 'heads up' from the living room, bedroom or from my lab of evilness where I spend many a dark hour hunched naked over a hot soldering iron.

For nine years my original cheap black & white door cam faced the worst of the British weather but its image output had deteriorated over this time to the point where any approaching visitor began appearing on the screen as a two-tone pixelated blob resembling some kind of Atari computer game from 1979.

Time to upgrade and fit a sexy new colour dome camera into one corner of the doorway. My new camera also has IR LEDs so I get a clear greyscale image at night. There was one problem however, while the old camera was mounted on the door frame and used a fish-eye lens allowing me to see both who was knocking at my door and who was walking up my driveway or parking in front of it, my new camera is directional and poining downwards only showing the doorway.

To remedy this, I have installed a second camera onto the front wall of the house to give me that all important driveway shot.

Of course, this meant two video feeds, however I only have the one inaccessible video cable running around the house. How to multiplex two video signals onto this one cable...??

IMAG0560

Caught on camera. Well, two cameras actually. Now take your double-glazing pamphlet, collection bucket
or copy of The Watchtower and shove it up your arse.



All the way from Hong Kong ('cos I couldn't find it readily available in the UK), I give you the Maxim MAX454CPD video multiplexer/amplifier. This 14-pin marvel is capable of multiplexing up to four video feeds onto a single output.

IMAG0549

Pins 1 and 2 are address inputs. The binary condition on these pins determine which of the four video inputs are presented to the output on pin 14. The clever fella has break before make connections to ensure there is no chance of a signal clash when it switches.


max454

A1
(MSB)
A0
(LSB)
Switched input
0 0 IN0
0 1 IN1
1 0 IN2
1 1 IN3



Despite being capable of handling four inputs, I only have two cameras so my switching circuit can discard IN2 and IN3. The purpose of my circuit is to switch alternately between these two cameras every few seconds so I can keep an eye on things from a single video screen. I'd like camera 1 which covers my front door to have a higher priority over camera 2 which looks out over the driveway simply because if the doorbell rings, I want to see who is standing there. That being the case, I'm going to design a circuit that gives camera 1 twice the screen-time of camera 2.

Here's what I came up with...


vidswitch

 

Integrated Circuits Capacitor Resistor
7805 Regulator C1, 0.33uF R1, R2, 24k
7660 DC-DC Converter C2, 100uF R3, R4, R14, 330R
555 Timer C3, 10uF R5, 150k
MAX454 Multiplexer C4, 10uF R6, R7, 1k
Miscellaneous C5, 330uF R8, 620R
LD1 - LD3 Green C6, 6.8pF R9 - R13, 75R

 

This breaks down into modular parts. Red: power control, distribution and indication. Green: timing and camera selection indication. Yellow: video multiplexing.

Both cameras operate from the same 10.8VDC supply and I'm also going to use that to power this circuit. A 7805 regulator drops the input voltage to 5V and a 7660 DC-DC converter works with C3 and C4 to provide the -5v source required by pin 4 of the MAX454 IC. LD3 provides power indication while C1 and C2 squash any noise on the power lines.

With only two inputs being used, dealing with the addressing of the MAX454 is simple. The Most Significant Bit (MSB) of the address on Pin 1 (A1) is grounded as it is only needed when the third and fourth inputs are being utilised so to switch between two inputs I only need to switch the Least Significant Bit (LSB) on pin 2 (A0) on and off to alternate between IN1 and IN0 respectively. An ideal job therefore for that old mainstay, the 555 timer. The timing of the circuit is governed by R1, R2 and C5. If I wanted the two cameras to have equal airtime, I would make R1 a tenth of the size of R2, however as I want to prioritise one of the cameras, I'm using equal values of 24k for both of these resistors. The timing of the circuit can be calculated as follows...

Output high = 0.693 x (R1 + R2) x C5 ...therefore...
Output high = 0.693 x (24x103 + 24x103) x 330x10-6
Output high = 10.9 seconds

Output low = 0.693 x R1 x C5 ...therefore...
Output low = 0.693 x 24x103 x 330x10-6
Output low = 5.48 seconds

With the output of the 555 timer coupled directly to the LSB of the MAX454 address bus, the camera connected to IN1 (pin 8) will be switched for twice as long as the camera connected to IN0 on pin 7.

Also hanging off the 555 timer output are LED indicators to show which camera is operational at any one time. When the 555 output is high, it sources current through R4 and LD1 which illuminates indicating camera 1 is active. When the 555 output switches low, it sinks the current flow through R3 and LD2 which illuminates indicating camera 2 is active.

The values of R5 to R8 and C6 are straight off the MAX454 datasheet and control the gain of the amplifier within the chip. I was missing a 620R resistor so I paralleled a 7.5k and a 680R to give me something in the right ballpark. R9 to R12 terminate the input lines.



P8190001

Prototyping in the lab. Feeds from the external cameras are hooked into this breadboard and the multiplexed display is showing on a black and white monitor.

 


P8200002

Once testing was complete, I looked around for a suitable housing for my new gadget. Amongst my junk was this old HP USB modem. The case was just the right size and it already had three green LEDs which I could reuse for the indicators.

 

P8210005

I built the circuit on some stripboard and hot glued it into the old modem case. Phono (RCA) connectors provide input terminals for the two cameras while power in and video out are on a terminal block. The LED indicators are mounted on the reverse (strip) side of the board so they can poke out of the casing on the other side.



final

Final construction with the thing fixed to the wall. The leftmost LED is a power indicator while the other two alternate as the cameras switch over. The leftmost cable is power in/video out while the two camera phono input connections are on the right. 

 

P8210006 P8210007


Building a video circuit on a stripboard probably isn't ideal considering the potential capacitance between the tracks but it works fine for what it does in this application. The doorway image on the left displays for ten seconds before switching relatively cleanly to the driveway shot on the right for five seconds and then back again.

Modifying the circuit for use with three or four cameras shouldn't be too difficult although I haven't sat down and worked out a schematic for it. I'd imagine you'd want to set R1, R2 and C5 to a suitable timing interval. You'd then need to stick some circuitry between the timer output from the 555 and the address inputs of the MAX454. I guess a couple of solutions would be a binary counter IC or using sequential outputs of a decade counter with an arrangement of diodes to present a different binary value at each output. The additional cameras would connect to the points marked 'a' and 'b' in the schematic above.

If you just wanted to select cameras manually, you could replace the 555 timer with a suitable physical switching arrangement. I guess you could incorporate both mechanisms for the option of manually selecting an input to display or automatically cycling through all inputs.

All I really know for sure is that my two cameras offer me something far more interesting to watch on TV than the likes of ITV can ever offer. I'd rather watch my parked Volvo than the X-Factor or Britain's Got Frikkin' Talent... which it hasn't.


Update 04/12/12 - I have upgraded this project - with a switch!

After much nagging feedback from the wife I have made a modification to this circuit to improve its functionality. Y’see, the trouble with the original circuit, as the wife *kept* pointing out, was that the video always seemed to switch at the wrong moment. You’d hear a knock at the door and would look at the screen only to see the driveway camera showing, or you’d be watching out for an expected visitor to pull up on the driveway cam and the door camera would clock on.

A quick look at the schematic gave me the idea of interrupting the 555’s timing cycle by the simple addition of a switch between the discharge and trigger pins (SW1 in the schematic below). With the switch closed, the timer would switch its output on and off as per the original circuit design, however flick the switch to open it and the timer stops, leaving its output in whatever state it happened to be in at that time (high or low), therefore leaving on whichever camera is associated with that state.

vidswitchmodified

You can use this trick to make the 555 into a pushbutton latch as below.

555latch

In this circuit PB1 is a push to close switch. Simply hold in PB1 until the 555 changes output state, then release and the 555 will remain in that state. Push again to reverse. Holding in PB1 would cause the 555 to switch its output on and off as a square wave. I used this in a circuit years ago when I needed to flash some LED’s but also have the option of leaving them in either an on or off state. Closing the switch would flash the LEDs and opening it would leave them on or off depending on what state they were in at the time the switch was opened.

The wife is now complaining at the effort of having to flick a switch, but figuring out some kind of thought controlled camera switching ESP interface is going to take me a little more time.