How to switch between video inputs


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default How to switch between video inputs

    Hi. I have a bunch of cheap CCTV cameras that have SCART outputs. The video uses the normal video pins that can be wired directly into a phono sockets (the yellow one on the front of the TV). I want to be able to switch between cameras on both a timer and by PC control.

    How can i switch between the video inputs? I was thinking of using a PIC chip to control which input gets to the output but im now sure what to use as a switch. In the past ive used relays for this but they are big, noisey and use a lot of power. Is there an IC that simply acts like the relay would. When it gets an input from the PIC it connects the video input to the output?

    Audio isnt a big concern but is there something that would handle that too? A simple switching IC would be ideal because it would be able to handle both video and audio just like a relay.

    Im hoping for something really cheap because i have 5 cameras plus a few other things i would like to attach to it

  2. #2
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default Easy

    Google Analog mux, for example 74HC4051. Use a Pic and muxes to switch things as you want. Maybe 4051 is not the best for you in this case because of fairly high ON resistance but the idea is the same. Use the control pins to select input and the signal is connected to the output pin. 4053 is a dual mux and will make it really easy to connect video and audio if you see a need for it.

  3. #3
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Use a CD4066 quad bilateral analog switch.
    http://www.fairchildsemi.com/ds/CD/CD4066BC.pdf


    Same problem you have: (See CD4066).
    http://www.petesprojects.com/stereo-video/section4.htm

    Best regards,

    Luciano

    EDIT: With 5 cameras the 74HC4051 is a better choice.
    Last edited by Luciano; - 3rd May 2008 at 19:57.

  4. #4
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ive been looking at the datasheet for the 74HC4051. From what i can see there are 8 pins and each one can be set to an input or an output. I do have a few questions about them though. Sorry if the datasheet answers these (if it does then i didnt understand it)

    I assume i pick a pin for example pin1 (A4) and use it as an output. Then i turn each input on seperately and it will come out of the output pin.

    How do i set which pins are inputs/outputs and how do i set which input is active? Im guessing i have to send the data through "COM out/in" (pin 3). Is that serial?

    Are the address pins just so you can control multiple chips using a single data line?

    Just thinking about the in/out pins. Are they actually an input or an output or do they just turn on/off and any pins that are on will all connect together?

  5. #5
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default Datasheets

    OK, let us start with the basic idea of multiplexers. You can look at them like a "One of Eight" switch where one line of the switch stays the same in all cases. 4051 is actually a MUX/DEMUX but let us not complicate this for the moment. Let us look at the datashet for example http://focus.ti.com/lit/ds/symlink/cd74hct4053.pdf PAGE 3


    Functional diagram of 4051:
    COM In/Out HERE IS WHERE YOU CONNECT YOUR TV
    CHANNEL In/Out HERE YOU CONNECT YOUR CAMERAS
    ENABLE pin must be low to make enable the chip
    S0,S1,S2 are the Select Pins (Adress) and they decide how you switch the signal, look at the diagram under the picture in PAGE 3
    S2=0 S1=0 S0=0 >> Connect Pin 13 to Pin 3
    S2=0 S1=0 S0=1 >> Connect Pin 14 to Pin 3
    and so on


    So you see 4051 does not use serial communication, it uses a 3 pin + enable parallell interface. If you want to have many chips on the same Slect Pin bus you have to figure out a way to only enable one chip at the time, this can be done by connecting the enable pins from each 4051 to the PIC or..... Connect the enable pins to a 4051 and control enable for all chips that way. Just at matter of how many pins you have left on your PIC.
    You can also connect 2 4051 in parallell, and feed video to one chip and Audio to the other chip, by doing this you always get the audio from the selected camera.

    Does this make things more clear?

  6. #6
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sinoteq View Post
    Does this make things more clear?
    Perfectly!

    I think i was going wrong because to me "COM" means serial. OK, i know it should be "COMM" but lots of people seem to miss off the last M. It does make perfect sense now since there are 3 address pins (2 states each) and 2^3=8 (8 inputs).

    It didnt help having pins labeled "in/out" either. Just a small question on these, does that mean i could use this chip the oposite way? (1 input and 8 switched outputs)

    I like the definition of "X" in the datasheet :P "Don't care"

    I should have realised how it worked before because when i was at school i actually use a chip that does pretty much the same thing but it was only for LEDs.

    One last question. Would i be right in saying that the grounds on the video inputs/outputs should all be connected to each other but *not* to the chip. Then the signal wires go into the correct chip pins

  7. #7
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    Yes, you can connect one camera and eight TV and run it backwards so to speak, that is why I said 4051 is MUX/DEMUX. I would connect all GND to the same place to make sure you get the same potential on all cameras this also includes GND to the PIC and 4051.

  8. #8
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ok, Thanx for the info! Now if only i could find somewhere that sells the correct SCART sockets

  9. #9
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ive just been looking at the datasheet again and ive noticed another pin called "VEE". What does that do? The datasheet doesnt seem to mention it so i assume its another one of those basic things i should have been taught in school

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Vee have to be tied to GND or V- if you're using bipolar signal.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    If you're going to use the 4051, you will need a video amp after it.

    I actually tried it once. And was NOT happy with the results.
    Like sinoteq said, the ON resistance is too high.
    With a 1V p-p signal, I ended up with .8v p-p. Picture gets darker, and sync isn't great either.
    Not to mention the Cross-Talk, ... really bad.

    Maxim, has some very nice analog multiplexors and cross-point switches. Many are even less than 1 ohm ON resistance. No Amp required.

    http://www.maxim-ic.com/products/switches/

    .
    DT

  12. #12
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    If VEE needs to be connected to GND then why isnt it connected inside the chip?

    I dont really want to use any extra components (especially a video amp) so ill have a look at that link. I dont think it would matter too much because these are only little £12 cameras and are black and white but i was planning to have my PC and skybox plug into this circuit too and i do want the best possible picture for those.

    Im sure i saw "low resistance" in the datasheet somewhere but maybe dropping 20% is classed as "low". I suppose i could always put a resistor in the middle of a wire to test how the picture would look before buying any chips. Im sure the datasheet would specify how much resistance there is

  13. #13
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    Vee is actually for signals that has both a positive and negative part. Look at a normal waveform and you can see that part of it is "under" the GND level. Vcc is feeding the signal during the positive part and Vee feeds the negative part, that would be the simple explanation. For TV this is not something to care about becasue all TV signals are on the + side of GND but to make the 4051 behave you have to connect Vee to GND. The problem with the on resistance is not really that big unless you are planning to load the camera with a low ohm (z) equipment, most TVs are 75ohm. The higher current you use in your cable the more you will loose inside the 4051. One the other hand if you want to place the camera far away from your TV for example make a CCTV system for you house it is possible you have to put amplifiers on the cameras to boost the signal if the cables get really long. How long is really long? Well that depends on how cheap your cameras are, some has really strong internal buffers and some are so weak that even the shortest cable makes things starting to fade. It is possible to make a simple video amp with a simple OP-amp so it is not that hard to fix if you later see you have a need for it.

    One more advantage of 4051, cheap... really cheap so you do not risk alot by testing them.

  14. #14
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sinoteq View Post
    One more advantage of 4051, cheap... really cheap so you do not risk alot by testing them.
    I had noticed The problem i have is the postage is more than 10 times the cost of the chip. There is a place where i was thinking of going soon anyway who sell the chip for 5 times as much (still pretty cheap) but they said they will only sell it through their website . Im gonna have to com up with a list of things i want to make the postage worth while.

    My cameras are also very cheap and the wires are all 15 meters long. The quality isnt bad during the day but it gets a bit snowy at night when the infra-red is on. That doesnt bother me too much because im more worried about things happening in the day (kids kicking footballs at my car and putting nails around the tires etc). The only time they have to perform well in the dark is at halloween but this year im putting some green/blue lights up to help with that.

Similar Threads

  1. Replies: 14
    Last Post: - 26th September 2007, 05:41
  2. dip switchs & inputs
    By grounded in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th September 2006, 13:37
  3. Newbie - 16F628A and switch latching
    By malc-c in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 19th May 2006, 02:35
  4. Switch Sequence
    By Tissy in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 13th February 2005, 20:36
  5. Switch Polling vs Interrupts
    By eric blair in forum General
    Replies: 1
    Last Post: - 17th October 2003, 09:38

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts