​ ​ ​ ​ Composite video signal detector
Results 1 to 10 of 10

Thread: Composite video signal detector

  1. #1
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,788

    Default Composite video signal detector

    This project uses a PICAXE to detect the presence of a composite video signal (CVBS) which is normally connected using a single RCA or phono jack ( usually coloured yellow ).

    This is a proof-of-concept part of a larger project designed to control an auto-selecting video switcher so it changes the signal for a TV to a composite video input whenever it is connected but can also be used in its own right as a "video present" indicator.

    Most auto-selecting video switchers monitor a signal on a SCART connector pin which goes high when the connected device is powered up but very few detect if an actual video signal is present. This circuit is the first step in generating such a signal which can control the SCART pin when composite video is present; here just a LED is lit to indicate that state.

    A composite video signal, whether PAL, NTSC or SECAM, is usually around 1 volt peak-to-peak, with the blanking level at 0V, sync pulses going negative, black level being just above 0V and white level higher. The technique used here is to simply look for levels somewhat greater than 0V and take that as an indicator of video presence. To handle the low voltage an internal hardware comparator is used with the voltage to compare against selected internally.

    The composite video passes through a 47K resistor to the comparator input. That is high enough to ensure there is minimal impact on the video signal itself and also helps minimise problems should the input pin inadvertently be set as an output. It may even be possible to increase this resistor value. The low current negative voltage sync signals will be clamped by the input pin internal diode but have little affect on the actual video signals due to the 47K. The resistor also protects the PICAXE from damage and being phantom powered if video is connected with the PICAXE powered off.

    To ensure the input does not float when a signal is not connected a 100K pull-down is placed across the video signal input. This again is a high value to have minimal impact on the video signal itself and can be omitted if the unit the video passes to has a suitable input resistance to 0V.

    Operation is simple; the comparator output will go high when the video signal is connected and somewhat greater than 0V. The comparator output is connected through to an output pin which can be used to drive a LED. So far we are using the PICAXE as nothing more than a hardware comparator with the program only configuring the internal hardware.

    To cater for misinterpretation of the video signal, black levels being interpreted as lack of video signal, the PICAXE program monitors the state of the comparator output and sets the software "detected" output pin immediately video is detected but clears it only when there has been a lack of video for a while. When the video signal is disconnected the "comparator" LED will extinguish immediately and the "detected" LED shortly after.

    While the initial circuit used a PICAXE-20X2 ( to cater for additional digital signal input and output to be added in the final project ) it can likely be modified for use with any PICAXE which has an on-chip comparator and suitable analogue input which feeds that comparator. Where there is no support for the COMPSETUP command ( as for the M2 range ) the comparator hardware will need to be configured using appropriate POKESFR commands as demonstrated with the code example for the PICAXE-08M2.
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Aug 2010
    Location
    Behind your TV...
    Posts
    787
    Blog Entries
    6

    Default

    Or if you wanted a hardware solution some thing like this should work:
    Code:
    In
     o
     |
     |---->|-------to device
     |        |
     o        =
    out       |
        0v o--'
    
    >| is meant to be a diode
    ...although you probably wont be able to drive an LED with it.

    Don't want to take the bounce from your bunge though hippy Great work
    Last edited by Jamster; 07-09-2011 at 16:25.
    20X2 Games pointlessly white text
    Non Hid compliant mice

  3. #3
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,788

    Default

    That would create a signal but how it would impact on the actual video signal I don't know, and it wouldn't drive the switcher which needs a signal greater than 4V. True, one can enhance it with an op-amp, probably even a transistor, so it's a worthy alternative.

    Of course you can't beat a PICAXE for adding capabilities above and beyond the basic functionality. One thing I've noticed with auto-switchers is they tend to switch to the last device powered-on where I want a priority system with auto fall-back, and composite video override so it's quick and easy to plug-in 'junk' from bootsales to check it works. And I can change things if I find I don't like the functionality I've created !

  4. #4
    Senior Member
    Join Date
    Aug 2010
    Location
    Behind your TV...
    Posts
    787
    Blog Entries
    6

    Default

    And besides, you couldn't post it on this forum.
    20X2 Games pointlessly white text
    Non Hid compliant mice

  5. #5
    Senior Member
    Join Date
    Jan 2011
    Location
    UK
    Posts
    4,480
    Blog Entries
    14

    Default

    Quote Originally Posted by Jamster View Post
    And besides, you couldn't post it on this forum.
    You could repurpose 'that' website
    Quote Originally Posted by eclectic View Post
    @Jamster.

    Seriously, don't waste time with the Support / surport site.

    Use Gadwin or Win7 screengrab
    to post a quick .jpg.

    e

  6. #6
    New Member
    Join Date
    Apr 2017
    Location
    New Zealand
    Posts
    5

    Default

    Hi Hippy!

    Great article! It is somewhat working on my setup but not 100% how I need to. I would like to ask you for a little help with modifying your program file for 08M2.

    I would like to
    1) change ReadADC to pin C.1 (but don't know how to... it will be trickier than to simply rewrite "ReadAdc 4, b0" to "ReadAdc 1, b0", right?)
    2) Instead of having output led that turns on/off, I would like to tell Picaxe to low pinC.4 after 5 minutes of no signal detection
    3) Can I make it more sensitive? In order to light up Video Detected Led, the volume coming from the amplifier needs to be almost at max. I would like to make it as close to lowest volume/noise as possible.

    Sorry to ask you these but this is way too much advanced stuff for me and all those SFR's and bit magic looks to me like Chinese letters I don't even know what I am looking at. The only part I am able to comprehend in the code is the Do -> Loop section by the end.

    Thank you!

  7. #7
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,788

    Default

    Welcome to the PICAXE forum

    Quote Originally Posted by Lup View Post
    1) change ReadADC to pin C.1 (but don't know how to... it will be trickier than to simply rewrite "ReadAdc 4, b0" to "ReadAdc 1, b0", right?)
    Yes, the program relies on using an internal comparator and the pins for those are fixed by the hardware. The READADC simply ensures the pin is configured for analogue rather than configuring anything else.

    The PICmicro datasheet shows it should be possible to use C.1 for the comparator input but I am not sure exactly what would have to change for that. It may simply be that CM0CON1/CM0CON2 can be used instead of CM1CON1/CM1CON2.

    Quote Originally Posted by Lup View Post
    2) Instead of having output led that turns on/off, I would like to tell Picaxe to low pinC.4 after 5 minutes of no signal detection
    That should just be a case of giving the 'timeout=100' a larger value to extend the 'turn off' time. If 'timout=65535' is too short one would have to add additional variables to allow a longer timeout to be achieved.

    Quote Originally Posted by Lup View Post
    3) Can I make it more sensitive?
    Possibly. The sensitivity is set by the "b0=%00010 : PokeSfr DACCON1, b0" commands. You can try "b0=%00001". You might be able to use "b0=%00000" but that may not work, cause false detection, or may require the DAC ladder configuring differently.

    You could use the DAC ladder driven from the FVR rather than V+, or even from an external Vref.

    Quote Originally Posted by Lup View Post
    the volume coming from the amplifier needs to be almost at max.
    Are you trying to use this with an audio amp rather than a video signal ? If so it may be that the signal is just too low for the comparator the way it is setup for video signal.

    Or it could be the nature of the signal, the code simply not suitable for the AC nature of audio where video is more DC-like.

  8. #8
    New Member
    Join Date
    Apr 2017
    Location
    New Zealand
    Posts
    5

    Default

    Hi Hippy,
    thank you for your fast reply!

    I was playing with the sensitivity and ultimately fried something inside Picaxe - perhaps comparator itself. both leds now stay on no matter how loud or quiet signal gets. When I download other program to test pins (pwm or simple high/low C.2....) leds flash. But your program does not work as it should anymore - I would say hardware problem. So new Picaxe is coming and so far I am at square one. I just don't know how to tell Picaxe "when song stops playing (from bluetooth module), go to sleep after XX minutes.

  9. #9
    Senior Member
    Join Date
    Sep 2012
    Location
    Melbourne, Australia
    Posts
    196

    Default

    Hi Hippy,

    If you don't mind adding 1 IC, why not use the LM1881 Video sync seperator IC?

    It accepts compostite video in, and generates composite sync out, vertical sync out, odd/even outputs etc.

    These would be very valid signals to feed into a picaxe for the confirmation of "real" video presence.

    just a thought ;-)

  10. #10
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,788

    Default

    Using the right tool to do the job would always be the best way forward. This was more a project to see if it could be done 'on the cheap' using a PICAXE and the components I had to hand.

    The original project came about because I had a composite video switcher to handle a variety of AV devices which I had to manually change and wanted the PICAXE to press the appropriate buttons for me when something was turned on or off. That would require multiple LM1881 to do it properly.

Bookmarks

Posting Permissions

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