Shop OBEX P1 Docs P2 Docs Learn Events
how to use the backpack board to select between two video sources — Parallax Forums

how to use the backpack board to select between two video sources

FranciscoFrancisco Posts: 26
edited 2010-01-11 20:35 in Propeller 1
I am using the propeller backpack board and need to switch between two video feeds so that only one is being used as the video source at a time. I was was wondering if anyone knew what I need to update so that any new pin assignment to to VIDIN will dynamically select the new video source as input. Thanks!

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-12-30 21:11
    Francisco,

    Can you clarify what it is you're trying to do? As I read your question, I'm envisioning a situation where you're doing an overlay on video coming in through VIDIN, but that you have two video sources that you want to select between before they reach the Backpack board. Am I correct?

    -Phil
  • FranciscoFrancisco Posts: 26
    edited 2009-12-30 22:51
    Phil Pilgrim (PhiPi) said...
    Francisco,

    Can you clarify what it is you're trying to do? As I read your question, I'm envisioning a situation where you're doing an overlay on video coming in through VIDIN, but that you have two video sources that you want to select between before they reach the Backpack board. Am I correct?

    -Phil

    Actually both video sources are directly into the board, maybe using 5 new pins if necessary, to allow the propeller to select between each as the source.

    To clarify, I want to select between two video sources at any given time during run time. Basically i want to have a digital switch between both input videos that the propeller can select between.

    Do you know if maybe this will work: use 5 new pins for video source 2 and wired up the same way that is in the schematic with components RP2, R3, C2, C3, Q1. Then have the chip select between these pins during run time as the video source, such as VIDIN. Thanks again.

    --Francisco
  • FranciscoFrancisco Posts: 26
    edited 2009-12-30 22:52
    or maybe a simpler solution? [noparse]:)[/noparse]
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-12-30 23:03
    What are you doing with the video? Does it get overlaid with text, or just output to a monitor unmodified? Or ... ?

    -Phil
  • FranciscoFrancisco Posts: 26
    edited 2009-12-30 23:11
    The first video source does need to get overlaid using the standard features. However when the second source is selected overlaid is NOT necessary but wouldn't hurt to have the option;nevertheless the easiest solution would definitely work for me.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-12-31 06:20
    Francisco,

    Here's a circuit that should work for you:

    attachment.php?attachmentid=66254

    Propeller pin A3 gates the auxilliary input to the output pin. A11, which gates VIDIN to the output pin, should be low when A3 is high to avoid video conflicts. Also, you won't be able to add an overlay to the auxilliary input, but you said that would be okay.

    The circuit mounts on a Proto-DB and uses the Parallax RCA jack adapter (mounted off-center):

    attachment.php?attachmentid=66255

    The transistors are surface mount (couldn't find adequate ones in a TO-92, sorry) and mounted on "Surf Board" adapters. The awkward part will be getting the output signal to the VID headers on the Backpack. These have a 2mm spacing and don't line up very well with holes in the Proto-DB. But I'm sure you can figure something out. smile.gif

    -Phil

    _

    Post Edited (Phil Pilgrim (PhiPi)) : 12/31/2009 6:32:48 AM GMT
    507 x 334 - 4K
    380 x 306 - 26K
  • FranciscoFrancisco Posts: 26
    edited 2009-12-31 07:39
    wow thanks for putting your effort on this. I will post my findings when I get a chance to try this out.

    By the way are you thee Phi Pi that is trademarked on the backpack board?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-12-31 08:04
    Yeah, I put my logo on the stuff I design, if I can fit it on the board. smile.gif

    -Phil
  • FranciscoFrancisco Posts: 26
    edited 2010-01-05 07:54
    Phil, Happy New Year. I managed to get your circuit on my breadboard. It looks like its want to work but something isn't quite right.

    here is the code i am using to test the circuit:


    PUB start | i
    
      LOW(3)
      pr.start(@buffer, BUF_SIZE)
      pause(2000)
      pr.str(string(DEFWIN, 10, 40, DBL|2, CHGCLR, $f, _0, 8|TPT, 1, APNDSP, 10, SHO|10, _0, 20, SHODSP, 10, WDWRAP, 1))
      pr.str(string("This is a demonstration of the Propeller Backpack video overlay."))
    
      repeat
        LOW(11)
        HIGH(3)
        pause(3000)
        HIGH(11)
        LOW(3)
        pause(3000) 
    
    
    




    When the program starts, the regular video is visible with the overlay but with a faint ghost image of the auxillary interlaced. Then when the the pins 11 and 3 swap state I don't see an image anymore.

    In summary it seems like the A3 gate is not strong enough to keep the auxillary video from leaking in and when A3 goes high to let the auxiallry video in, even with A11 low there seems to be a video conflict.

    Do you think I may have wired something incorrectly? Thanks!

    Please let me know if this doesn't make sense.

    (circuit pic is attached)
    1200 x 1600 - 813K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-05 09:04
    Francisco,

    I can't really tell from your photo if things are wired correctly. Would it be possible to post a picture that's more in focus? Also, if you have an active overlay, A11 will still be high, and you can't force it low in your top-level program. (Outputs from multiple cogs are ORed, remember.) For the time being, the only way to force A11 low is to stop the overlay object. Meanwhile, I will try to come up with a way to disable the overlay without stopping the cog.

    As to the ghosting, your auxiliary video may be AC-coupled, which means that the signal can make excursions below ground. This would allow partial conduction through the MOSFETs when A3 is low. It can be fixed using a diode clamp circuit ahead of the MOSFETs. This is something I'll have to address tomorrow.

    Meanwhile, please try it without the overlay, and report back.

    -Phil
  • FranciscoFrancisco Posts: 26
    edited 2010-01-05 18:57
    Thanks, I will work on this after work tonight.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-05 21:37
    Francisco,

    I've attached a special version of the overlay object for you to try. It has two new methods: on and off. Each is called without arguments. off disables both the onboard video passthru and overlay text; on renables both. off is also available from the terminal program by using an argument value of 64 to SHODSP. Any argument between 0 and 63 will automatically reenable the passthru and overlay to the chosen display number.

    You should use on and off (or SHODSP, 64) in lieu of messing with A11. Also, be sure to "break before make"; that is, turn one video off before turning the other one on. You should also delay about 17ms after invoking off, before raising A3, since the disabling is done on a video field boundary, and it could take up to 1/60 second for it to take place. Some video sources used for the overlay may take awhile to resynchronize when the passthru is reenabled, since sync tracking is also disabled during the "off" time. Also, since your two video sources are not genlocked to each other, your picture will probably roll once at each transition as your monitor resyncs to the new video signal. Finally, some LCD monitors, rather than rolling, will blank momentarily (sometimes as much as a second) when the video signal changes. What this means is that if you switch back and forth between sources too fast, an LCD monitor may never show anything but a blank screen.

    -Phil
  • FranciscoFrancisco Posts: 26
    edited 2010-01-06 08:32
    Phil, good job on your design smile.gif . Your code and design are working nicely with the exception of the coupling that is still happening. Here is the code that I used to test this:

    
    PUB start | i
    
      LOW(3)
      pr.start(@buffer, BUF_SIZE)
      pause(2000)
      pr.str(string(DEFWIN, 10, 40, DBL|2, CHGCLR, $f, _0, 8|TPT, 1, APNDSP, 10, SHO|10, _0, 20, SHODSP, 10, WDWRAP, 1))
      pr.str(string("This is a demonstration of the Propeller Backpack video overlay."))
      pause(10000)
    
      repeat
        pr.off
        pause(100)
        HIGH(3)
        pause(10000)
        LOW(3)
        pause(100)
        pr.on
        pause(10000) 
    
    
    



    The video output is swapped back and forth between the overlay video and the auxiliary without a problem. The only issue is the coupling which is seen during the overlaid video with the auxiliary video faintly seen over it passing by and some jittering.

    --Francisco
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-06 09:01
    Francisco,

    Okay, you probably need a clamp on the auxiliary video input. Here's a circuit that should help:

    attachment.php?attachmentid=66480

    Install this ahead of the MOSFETs. What it will do is keep the sync tips at 0V, rather than allowing them to go negative. That way, when A3 is low, it (and the MOSFET gates) will not be above the video levels. If you still get leakage, add another diode in series with the one that goes to ground.

    -Phil

    Addendum: If you're absolutely sure that your auxiliary video source is AC-coupled, you can eliminate the cap from the above circuit.

    _

    Post Edited (Phil Pilgrim (PhiPi)) : 1/6/2010 9:07:59 AM GMT
    393 x 213 - 2K
  • FranciscoFrancisco Posts: 26
    edited 2010-01-11 19:38
    Hi Phil, I haven't had time to do as much testing on this circuit as I would like to. However,preliminarily it seems that the clamp didn't really affect my results. As a side note i tried this experiment on a couple different monitors and with couple different video feeds and it seems that some monitors are more sensitive to this video leakage than others. On one setup the leakage didn't seems to be visible at all. The leakage was most apparent when i used an auxiliary video feed that had its own overlay source independent of the propeller circuit.

    I am guessing that leakage is happening on all the setups but it is less apparent on some because of the video quality, strength, etc.

    I am going try to get my hands on an oscilloscope to see if i can get a better picture of what is actually happening.

    --Francisco
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-11 20:35
    Francisco,

    When you connect your scope, look for the signal going to the monitor swinging negative by more than 0.62V w.r.t. Vss. This could happen if the signal on VIDIN has a negative component. If so, that could cause the lower MOSFET in the switch circuit I provided to turn partially on, even when A3 is at 0V. That's all it would take, since there will be conduction through the top MOSFET via its body diode.

    If this is the case, I believe it can be corrected with a couple more passive components. But let's see what's going on first.

    -Phil
Sign In or Register to comment.