7
CONSTRUCTION 70 • JULY 2010 ELECTRONICS FOR YOU WWW.EFYMAG.COM S.V.N. HARISH K. S. DAS GUPTA REMOTE-CONTROLLED 6-CAMERA CCTV SWITCHER auto (the switcher selects the cameras one by one and holds videos of each camera till the preprogrammed time) 5. Auto mode: You can change ‘on’ time of each camera (hold time) individually through the remote. Time can be programmed from 0 to 255 seconds. 6. Camera bypass: You can set any camera in bypass mode by entering 0-second ‘on’ time for cameras which you want to bypass or don’t want to watch during auto mode. 7. Audio: One-way audio. In this model, you can hear the audio from the camera selected by the switcher. 8. Video: Two video-out RCA sockets with 75-ohm im- pedance 1Vp-p are available at the rear panel of the master unit. You can connect two moni- tors in these sockets. 9. Other features: Wide in- put voltage range, long-range infrared remote commander, microcontroller-based design supported with CMOS digital integrated circuits, liquid-crystal dis- play to monitor the status and bilateral digital MOS switches for switching the analogue video/audio signals from cameras At the heart of the circuit is Micro- chip’s PIC16F72 microcontroller, which controls all the functions described in the design. Its pin configuration is shown in Fig. 1. The circuit Fig. 2 shows the main control circuit of the camera switcher. In this circuit, PIC16F72 microcontroller controls all the functions such as interfacing/ initialising the LCD to display all the desired characters on the screen, C losed-circuit television (CCTV) uses video cameras to transmit signals to specific monitors. It differs from broadcast television in that the signal is not openly transmitted, though it may employ point-to-point wireless links. CCTV is often used for surveillance in areas that need security, such as banks, casinos, shops, depart- mental stores and airports or military installations. Here is a remote-controlled CCTV switcher circuit to monitor six cameras on a single or dual monitor/TV. The salient features of this switcher are: 1. Cameras: Six cameras with one- way audio (audio incoming only) 2. Operation: Fully remote-con- trolled (infrared commander) 3. Front display: LCD to display the camera selected and all other func- tions/parameters 4. Camera selection: Manual (you can select any camera of your choice by pressing number keys or camera up/down keys on the remote) and Fig. 1: Pin configuration of PIC16F72 microcontroller in PDIP package PARTS LIST Semiconductors: IC1 - PIC16F72 microcontroller IC2-IC4 - CD4066 quad bilateral CMOS switch IC5 - UTC820 power amplifier T1-T6 - BC547 IC6 - 78S12 voltage regulator IC7 - 7805 voltage regulator X TAL1 - 4MHz crystal D1-D4 - 1N4007 diode LED1-LED6 - LED, 5mm red LED7 - LED, 5mm green IRx - TSOP1738 IR receiver Resistors (all ¼-watt, ±5% carbon unless stated otherwise): R1 - 10-kilo-ohm R2, R13 - 2.2-kilo-ohm R3-R8 - 470-ohm R9, R10 - 75-ohm R15 - 47-ohm, 1-watt R11, R16 - 47-ohm R12 - 1-ohm R14 - 1-kilo-ohm R17-R22 - 1-kilo-ohm VR1 - 10-kilo-ohm VR2 - 10-kilo-ohm, log, potmeter Capacitors: C1 - 1000µF, 35V electrolytic C2 - 220µF, 40V electrolytic C3, C10, C13, C16 - 100µF, 25V electrolytic C4, C5 - 33pF ceramic C6, C8, C14, C18 - 0.1µF mylar C7, C9 - 47µF, 16V electrolytic C11 - 680pF ceramic C12 - 22µF, 25V electrolytic C15 - 220µF, 25V electrolytic C17 - 10µF, 25V electrolytic Miscellaneous: X1 - 0-15V, 2A secondary transformer S1 - DPDT rocker switch SK1-SK6 - 5-pin DIN socket SK7, SK8 - RCA socket LCD - 16×2 LCD with backlight Remote - No. 6710V00079B (type LG TV) LS - 8-ohm, 6.4cm speaker CON1 - 7-pin bergstrip connector (male/female) CON2-CON7 - 2-pin SIP connector (male/female) CON8 - 12-pin bergstrip connector (male/female)

CCTV Switcher

Embed Size (px)

Citation preview

Page 1: CCTV Switcher

cONSTRUcTION

70 • July 2010 • electronics for you w w w . e f y m a g . c o m

S.V.N. HARISH k.

s. das Gupta

REMOtE-CONtROLLEd 6-CaMERa CCtV sWItCHER

auto (the switcher selects the cameras one by one and holds videos of each camera till the preprogrammed time)

5. Auto mode: You can change ‘on’ time of each camera (hold time) individually through the remote. Time can be programmed from 0 to 255 seconds.

6. Camera bypass: You can set any camera in bypass mode by entering

0-second ‘on’ time for cameras which you want to bypass or don’t want to watch during auto mode.

7. Audio: One-way audio. In this model, you can hear the audio from the camera selected by the switcher.

8. Video: Two video-out RCA sockets with 75-ohm im-pedance 1Vp-p are available at the rear panel of the master unit. You can connect two moni-tors in these sockets.

9. Other features: Wide in-put voltage range, long-range infrared remote commander, microcontroller-based design supported with CMOS digital

integrated circuits, liquid-crystal dis-play to monitor the status and bilateral digital MOS switches for switching the analogue video/audio signals from cameras

At the heart of the circuit is Micro-chip’s PIC16F72 microcontroller, which controls all the functions described in the design. Its pin configuration is shown in Fig. 1.

the circuitFig. 2 shows the main control circuit of the camera switcher. In this circuit, PIC16F72 microcontroller controls all the functions such as interfacing/initialising the LCD to display all the desired characters on the screen,

Closed-circuit television (CCTV) uses video cameras to transmit signals to specific monitors. It

differs from broadcast television in that the signal is not openly transmitted, though it may employ point-to-point wireless links. CCTV is often used for surveillance in areas that need security,

such as banks, casinos, shops, depart-mental stores and airports or military installations.

Here is a remote-controlled CCTV switcher circuit to monitor six cameras on a single or dual monitor/TV. The salient features of this switcher are:

1. Cameras: Six cameras with one-way audio (audio incoming only)

2. Operation: Fully remote-con-trolled (infrared commander)

3. Front display: LCD to display the camera selected and all other func-tions/parameters

4. Camera selection: Manual (you can select any camera of your choice by pressing number keys or camera up/down keys on the remote) and

Fig. 1: Pin configuration of PIC16F72 microcontroller in PDIP package

Parts ListSemiconductors:IC1 - PIC16F72 microcontrollerIC2-IC4 - CD4066 quad bilateral CMOS

switchIC5 - UTC820 power amplifierT1-T6 - BC547IC6 - 78S12 voltage regulatorIC7 - 7805 voltage regulatorXTAL1 - 4MHz crystalD1-D4 - 1N4007 diodeLED1-LED6 - LED, 5mm redLED7 - LED, 5mm greenIRx - TSOP1738 IR receiverResistors (all ¼-watt, ±5% carbon unless stated

otherwise):R1 - 10-kilo-ohmR2, R13 - 2.2-kilo-ohmR3-R8 - 470-ohmR9, R10 - 75-ohmR15 - 47-ohm, 1-wattR11, R16 - 47-ohmR12 - 1-ohmR14 - 1-kilo-ohmR17-R22 - 1-kilo-ohmVR1 - 10-kilo-ohmVR2 - 10-kilo-ohm, log,

potmeter Capacitors: C1 - 1000µF, 35V electrolyticC2 - 220µF, 40V electrolyticC3, C10, C13, C16 - 100µF, 25V electrolyticC4, C5 - 33pF ceramicC6, C8, C14,C18 - 0.1µF mylarC7, C9 - 47µF, 16V electrolytic C11 - 680pF ceramicC12 - 22µF, 25V electrolyticC15 - 220µF, 25V electrolyticC17 - 10µF, 25V electrolyticMiscellaneous:X1 - 0-15V, 2A secondary

transformerS1 - DPDT rocker switchSK1-SK6 - 5-pin DIN socketSK7, SK8 - RCA socketLCD - 16×2 LCD with backlightRemote - No. 6710V00079B (type LG TV)LS - 8-ohm, 6.4cm speakerCON1 - 7-pin bergstrip connector (male/female)CON2-CON7 - 2-pin SIP connector (male/female)CON8 - 12-pin bergstrip connector (male/female)

Page 2: CCTV Switcher

cONSTRUcTION

electronics for you • July 2010 • 71w w w . e f y m a g . c o m

Fig. 2: CCTV switcher circuit

Page 3: CCTV Switcher

cONSTRUcTION

72 • July 2010 • electronics for you w w w . e f y m a g . c o m

decoding the RC-5 command on pressing the required keys of the

remote control and providing high logic to enable corresponding bilateral

CMOS analogue switches to con-nect the video sig-nal from cameras to the video-out-put socket and au-dio signals to the power amplifier of the corresponding camera selected from the remote. Here we have used the remote con-trol of an LG TV (remote code No. 6710V00079B). It is readily available in the market.

A remote sensor is connected to port RB0 (pin 21), called interrupt port, of the controller and the software initialises interrupt routines along with timer-0 interrupt to decode the RC-5 command. The RC-5 protocol was de-scribed in March 2007 issue of EFY, so it is not discussed here.

Any transmission from the remote consists of two start bits, one toggle bit, 5-bit address and 6-bit command. Here we have not used the 5-bit address. A biphase-modulated bit can be thought of as two separate bits that are always the inverse of each other. A logical zero is represented by a ‘10’ pattern on the IR input, while a logical one is represented by a ‘01’ pattern. That is basically used to decode the received message.

Toggle bit is a particular property of the RC-5 protocol. This bit changes polarity every time you press a key and will remain unchanged as long as you hold the key. That enables the receiver to detect released keys, which helps to eliminate key bounces. We have also used this bit to detect so that if any key is kept pressed for a long time, the routine detects the command once, keeps the value in a general-purpose register called ‘pass-dummy’ (refer to ‘.asm’ file), and does not process and store any further com-mand till the remote key is released. The stored RC-5 command value in register ‘passdummy’ is used to per-form the necessary function given in the source code.

The LCD shows the camera num-ber selected from the remote and mode of operation (auto/manual).

For camera-hold time set for auto mode and other display text informa-tion, please see the LCD screenshot in Fig. 3. Use of the LCD makes the project more user-friendly.

All the cameras are to be con-nected to SK1 through SK6 (5-pin DIN connector) as shown in the circuit diagram. The extreme right and left pins are for 12V positive and negative supply (to be fed from the regulated power supply of the main switcher)

Table IPin Details of CCTV Camera DIN Socket

Socket Camera Signal Switch (IC) enable pins to microcontroller

SK1 Camera-1 Video S2a (IC4) Port (RC7)-pin 18

SK1 Camera-1 Audio S2b (IC4) Port (RC7)-pin 18

SK2 Camera-2 Video S3a (IC4) Port (RC6)-pin 17

SK2 Camera-2 Audio S3b (IC4) Port (RC6)-pin 17

SK3 Camera-3 Video S4a (IC3) Port (RC5)-pin 16

SK3 Camera-3 Audio S4b (IC3) Port (RC5)-pin 16

SK4 Camera-4 Video S5a (IC3) Port (RC4)-pin 15

SK4 Camera-4 Audio S5b (IC3) Port (RC4)-pin 15

SK5 Camera-5 Video S6a (IC2) Port (RC1)-pin 12

SK5 Camera-5 Audio S6b (IC2) Port (RC1)-pin 12

SK6 Camera-6 Video S7a (IC2) Port (RC0)-pin 11

SK6 Camera-6 Audio S7b (IC2) Port (RC0)-pin 11

Table IITruth Table for Port C

PORT RC7 RC6 RC5 RC4 RC1 RC0 Camera-ON

Port C 1 0 0 0 0 0 Camera-1

Port C 0 1 0 0 0 0 Camera-2

Port C 0 0 1 0 0 0 Camera-3

Port C 0 0 0 1 0 0 Camera-4

Port C 0 0 0 0 1 0 Camera-5

Port C 0 0 0 0 0 1 Camera-6

Fig. 3: Screenshots of LCD

Page 4: CCTV Switcher

cONSTRUcTION

electronics for you • July 2010 • 73w w w . e f y m a g . c o m

for the built-in camera module. The 12V power supply is permanently connected to all the cameras. Audio and video signals from the cameras are selected using switch pairs S2a-S2b through S7a-S7b (built inside IC2

through IC4) and fed to the audio power amplifier and video output sockets, respectively.

Each IC has four CMOS bilateral switches for transmission or multiplex-ing of analogue or digital signals. It is pin-to-pin compatible with IC CD4016, but has much lower ‘on’ resistance, which is relatively constant over the input signal range.

Video and audio signals from SK1 (camera 1) are connected to S2a and S2b, respectively, and both the enable pins (to switch on both the switches) are shorted out and connected to port RC7 (pin 18) of the microcontroller. Similarly, audio and video signals from SK2 through SK6 are connected to IC2 through IC4 and then to Port C of IC1 as shown in Table I.

Enable pins of switch pairs S2a-S2b, S3a-S3b, S4a-S4b, S5a-S5b, S6a-S6b and S7a-S7b of IC2 through IC4 are shorted to each other and fed to the corre-sponding port of Port C as shown in Table I. The microcontroller provides high logic at Port-C pins to switch on a particular camera. The truth table for Port C is shown in Table II.

Immediately after switching on the mains, the standby LED (LED7) connected to Port-C pin RC3 glows and the LCD shows the welcome page (refer to the LCD screenshot).

On pressing the power key on the remote, the standby LED turns off and the LCD shows which camera is ‘on,’ in which mode it is now and default hold time for the corresponding cam-era in ‘Auto’ mode.

As described above, pins of Port C (RC0, RC1, RC4-RC7) are connected to IC2 through IC4 for selecting the cam-era to be switched on. LED1 through LED6 are used to check the logic status of Port C. Pressing keys ‘1’ through ‘6’ on the remote makes the correspond-ing LEDs (LED1 through LED6) glow, indicating ‘on’ condition of the cam-eras (CAM-1 through CAM-6).

Here a 16-character, 2-line LCD is used in 4-bit mode. Data lines D4 through D7 of the LCD are connected to Port-B pins RB4 through RB7. En-able (EN) and reset (RS) pins are con-nected to RB2 and RB3 pins, respec-tively, and the read/write (R/W) pin is connected to ground as we have used the LCD in writing mode only. Preset VR1 (10-kilo-ohm) is used for setting the LCD character contrast.

power supplyA simple circuit for regulated supply (shown in Fig. 4) is used here. The +12V regulated output is used to pow-er all the six cameras, IC2 through IC4 and IC5 and fed to another 7805 volt-age regulator (IC7) to get the regulated +5V output for the microcontroller (IC1) and the LCD.

The current rating of the trans-former should be around 2A, depend-ing on the current consumption of the

Fig. 4: Circuit for regulated power supply

Fig. 5: Circuit diagram of power amplifier

Fig. 6: Pin diagram of UTC820 audio power amplifier

Page 5: CCTV Switcher

cONSTRUcTION

74 • July 2010 • electronics for you w w w . e f y m a g . c o m

cameras. Use a good-quality heat-sink for both the regulators.

power amplifierA simple power amplifier (see Fig. 5) is used to amplify the sound signal from the cameras and hear it on a small speaker.

The audio power amplifier is built around IC UTC820 (IC5). UTC820 is a monolithic integrated circuit audio amplifier delivering an output of 1.2 watts at 9V on an 8-ohm speaker load with 10 per cent total harmonic distor-tion (THD) and good ripple rejection. It is designed for audio-frequency class-B amplifier with a wide operating

supply voltage range of 3V to 14V and minimum external components.

The pin configuration of IC UTC820 is shown in Fig. 6. Components at pin 2 of the IC5 decide closed-loop volt-age gain (dB) of the ampli-fier. Here a 47-ohm resistor (R11) and a 22µF capacitor (C12) are used and, with these values, about 45dB closed-loop voltage gain is achieved. You can reduce the component values for more gain but it’s not required here as maximum gain of 75 dB is possible. Capacitor C10 (100µF) connected between pins 5 and 7 of IC5 is used for bootstrap and improving the low-frequency signal. The amplifier output at pin 5 is connected to the speaker via C13. The audio signal from the cameras is fed to input pin 3 of the IC via volume control VR2 (10-kilo-ohm), capacitor C17 and resistor R13. Here the output power is limited to about 500 mW at 8-ohm load approximately, so use of a good-quality 6.4cm speaker is recommended.

Functions of remote control keys

The functions of various remote keys are shown in Fig. 7.

Power on/off key. Press it once to switch on the switcher and press again to turn off or keep the switcher in standby mode and vice versa. (AC mains should be ‘on’ in both the cases.)

Camera selection key. Select any of the six cameras manually by press-ing any of the numerical keys ‘1’ through ‘6’ once. For example, to se-lect camera-3 press ‘3’ on the remote, and to select camera-5 press ‘5’ on the remote.

Auto/manual. By default, the mi-crocontroller sets the mode of selec-tion to manual. (In that case, you have

to select the cameras by pressing the number keys or the camera up/down keys.) To change to automatic selec-tion (auto) mode, press ‘Mute’ key and the switcher selects the cameras one by one automatically. Pressing this key again will return the mode of selection to manual, and vice versa.

Camera up key (PR∆ key). By pressing the camera-up key, the switcher selects the next camera. For example, if the LCD is showing cam-era-2, pressing this key once makes the switcher jump to camera-3. Each successive pressing of this key will make the switcher jump to the next camera.

Camera down key (PR∇ key). By pressing the camera-down key, the switcher selects the preceding camera. For example, if the LCD is showing camera-4, pressing this key once makes the switcher jump back to camera-3. On each successive pressing of this key, the switcher jumps back to the previous camera.

Time set up/down key (Vol+/Vol– key). In auto mode, the switcher selects the cameras one by one and the picture of the selected camera is held up for a certain time. By default, the microcontroller sets this hold time as 5 seconds. You can change this time for each camera individually from 0 to 255 seconds.

To change this time, press the edit key (TV/AV) once. The switcher goes to the edit mode. Select the camera (for which you want to change the time) by pressing the camera up/down key. On each successive pressing of the time set up key, the time increments up to 255 seconds maximum.

On each successive pressing of the time set-down key, the time decre-ments up to zero. If you set 0-second time for any camera, the switcher by-passes this camera during selection in auto mode. For example, if you set the time as 0-second for camera-3, in auto mode, the switcher selects camera-1, camera-2, camera-4, camera-5 and camera-6. Here the switcher bypasses camera-3. This function is useful if you

Fig. 7: Remote control of LG TV

Page 6: CCTV Switcher

cONSTRUcTION

electronics for you • July 2010 • 75w w w . e f y m a g . c o m

want to skip certain cameras.Edit key (TV/AV). To change the

camera hold-up time for ‘auto mode,’ enter ‘edit’ mode first by pressing this key once and then set the desired time by pressing the time up/down key as described above. To exit edit mode af-ter setting the time, press the same key on the remote once again. The control-ler goes back to manual mode.

testing and troubleshootingAfter assembling the circuit without microcontroller, apply the power using ‘on’/’off’ switch S1. Check the DC volt-age at pin 3 of regulator IC7. It should be +5V. Check the same voltage at pins 1 and 20 of the base of IC1.

Now, switch off the power, insert the microcontroller in its base and re-check all the connections from the PCB to the LCD and IR sensor TSOP1738. On applying the power, page-1 and page-2 text should display on the LCD screen. Using the remote, switch on the switcher and change the functional sta-tus on the LCD by referring to CCTV switcher remote commander (shown in Fig. 7) and LCD screenshots (shown in Fig. 3).

Adjust VR1 for maximum con-trast on the LCD. If you don’t get any output on the LCD, troubleshoot as follows:

1. No output on the LCD. Switch off the power and check continuity between the LCD and various pins of IC1 and regulator IC as shown in the schematic diagram. If the connections are Ok, switch on the power, vary VR1 and check the voltage at pin 3 of the LCD (0V to 5V).

2. No backlight on the LCD. Check the voltage at pin 15 (+5V) and pin 16 (0V) of the LCD.

3. Page 1/page 2 is shown on the screen but the remote commander doesn’t work (nothing happens on pressing functional keys of the remote). Check the supply at pin 2 of the IR sen-sor. It should be +5V. If +5V is avail-able at pin 2, check the voltage at pin 3 of the IR sensor. If there is no voltage

at pin 3, replace the IR sensor or check the PCB, etc for shorting.

Once the LCD shows page-1 and page-2 text properly and the remote commander is working, switch off the power and then switch it on again

using S1. Now the LCD should show page-1 and page-2 as shown in Fig. 3. At the same time, pin 14 of the MCU should go high (+5V) and the power standby LED should glow. Now press ‘Power’ key on the remote. Pin 14

Fig. 8: Actual-size, single-side PCB for the remote-controlled 6-camera CCTV switcher

Fig. 9: Component layout for the PCB

Page 7: CCTV Switcher

cONSTRUcTION

76 • July 2010 • electronics for you w w w . e f y m a g . c o m

of the MCU should go low and the standby LED should turn off, and vice versa, on pressing the same key again. If this doesn’t happen, replace the mi-crocontroller.

Connect LED1 through LED6 to connector CON1. Press ‘Power’ key on the remote to switch on the switcher. Page-3 text should appear on the LCD, showing camera-1 is ‘on,’ the switcher is in manual mode and the default time of camera hold for auto mode. At the same time, Port-C pin RC7 should go high and LED1 should glow. Select other cameras either by pressing keys 1 through 6 or camera up/down keys of the remote and check whether the correspond-ing LEDs (LED1 through LED6) are glowing (refer to Port-C truth table). Simultaneously, page-3 should show the corresponding camera number

accordingly. If the LEDs don’t glow according to the truth table, replace the microcontroller.

When camera-1 is selected, the LCD should show camera-1 and LED1 should glow. If the monitor does not show the video of camera-1, or you hear no audio from the power ampli-fier, check 5V logic at pins 5 and 6 of IC4. If there is no voltage at these pins, check the availability of 0.6V at the base of transistor T5, +5V at its emitter and +12V at its collector. Follow the same procedure for all other cameras and their corresponding switching cir-cuits.

softwareThe source program is written in As-sembly language and compiled using MPASM tool suite. The explanation of the Assembly source code is included

in this month’s EFY-CD.

ConstructionA single-side, solder-side PCB layout for the microcontroller-based remote-controlled six-camera CCTV switcher is shown in Fig. 8 and its component layout in Fig. 9.

Connect CCTV cameras in the sockets provided (SK1 through SK6). Also connect the LCD and remaining components (as shown in Fig. 2) and +5V and +12V from the power supply circuit. Now a welcome message will appear. Press ‘Power’ key on the remote to start the switcher.

EFY note. The complete project folder containing the source code and other related files is included in this month’s EFY-CD and is also available on www.efymag.com.