Building an AV switchbox - electronic or analogue switching?

Discussion in 'Modding and Hacking - Consoles and Electronics' started by MangledLeg, Jan 23, 2013.

  1. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Thanks for the details guys!

    I've started playing with Eagle, and while the learning curve has been a bit tricky, I'm getting there.

    The latest thought I've had is to see if I could also whack in optical audio switching for the component inputs in addition to analogue audio. I've been researching my options this morning, and a lot of it has gone over my head!

    However, I think I've finally understood the principles behind this solution which has cropped up a lot online while I was hunting.

    Prior to this I was looking to see how reliable it would be to switch using relays, using 1x SPST relay to take the input, with all the optical connections by default powered and grounded (like so), but I don't think the signal likes relays much.

    Another option was converting all optical signals to coax, then switch the signal using a 75ohm-happy SPST relay, and then finally convert it back to optical for output to the amplifier, but this was also getting a bit tricky.

    If I understand the solution linked to above, he's using a CD4051 multiplexer to take up to 8 inputs and pushing them to a single bus output (since the 4051 uses discreet in/out for each signal)... though since its an analogue multiplexer, in my mind it doesn't make sense why using a mechanical switch should be any different since neither instance is leaving everything in a digital loop.

    Anywho, with the 4051 solution, my guess is that in addition to the relays handling the analogue inputs I would have a set of 3 relays sending a combination of +5v and GND to the A/B/C (pins 11, 10 and 9 respectively) on the 4051 to control the behaviour.

    So, to activate the IC, INH (pin 6) needs to be grounded, as feeding it +5v deactivates it. For input 1, pins 9, 10 and 11 are all fed GND. For input 2, 11 is sent +5v and 9 and 10 are sent GND. For input 3, pin 9 is sent GND and pins 10 and 11 are sent +5v; and so on as per the truth table on the datasheet.

    For the CD4051 then, pin 7 is fed -5v, pin 8 is fed GND and pin 16 is fed +5v. I'm assuming I can use a 7905 voltage regulator to get a regulated -5v by sending +5v to the center pin, GND to the input and the output then sends out -5v. It's an extra component but I already have a couple floating about.

    Another alternative which may be better is to use a 74HCT251N, which uses a single output (rather than paired ins/outs on the CD4051) and doesn't need -5v to operate. Assuming that +5v and GND reflect the high/low settings sent to the S0/S1/S2 pins (same as the CD4051, pins 11, 10 and 9 respectively), I could use this IC to control the digital switching behaviour.

    So, using the above, to operate the IC pin 8 is set to GND, pin 16 is sent +5v and pin 7 (OE) is set to GND to activate the multiplexer. Pin 5 is the combined output.

    To switch to input 1, pins 11, 10 and 9 are all sent GND. To switch to input 2, pin 11 is fed +5v and pin 10 and 9 are sent GND. To switch to input 3, pins 11 and 9 are sent GND and pin 10 is fed +5v; rinse/repeat for the rest of the truth table (assuming that I have the correct pin for the output, as it has a complementary output on pin 6).

    ... I realise the above is probably a bit convoluted, but writing it out this way helps me slowly work through electronics theory which I'm not familiar with!

    So, with this in mind, what are the thoughts on using either of those ICs combined with relays to drive the logic combinations to switch optical sources at the same time as moving component video + stereo audio? My preference is to go with the 74HCT251N since it means one less bus and one less component (i.e. the 7905 regulator). I'm hoping I'm getting there with my understanding of it!

    In looking back at all my notes, the only question I have is around the voltage input for the MC14490 and the 4017B ICs. The relays Calpis linked to are +12v SPST relays, so I'm assuming they'll need +12v to drive the transistor, which in turns powers the coils on the relays. So, with this in mind, is it best to add a 7805 regulator to bring the +12v from the power supply back to +5v for the ICs and continue running +12v to the relays, or would +5v do for the whole lot?

    I'll end this long-winded essay here :) Looking forward to what Retro Swim has been up to as well!
     
    Last edited: Feb 19, 2013
  2. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    You can definitely use a 7805 linear regulator to tackle your power issue, the MC14490 and 4017B would only draw a few mA each, if that, so the reg would generate minimal waste heat with a 12V source. Remember to look at the datasheet for the 7805, it needs 2 capacitors to work properly and reject ripple on the input.

    Your audio switching logic is all sound (ha!).

    I'm just confused here. The bandwidth properties of the optical-via-transceiver and co-axial signals are the same, they are just different voltage levels. The signal from the transceiver is 5V TTL, and the signal from the co-ax is 0.5-0.6Vpp. Either should be happy to go through a relay. (In fact, the TTL signal would give less of a crap about the impedance of the relay)

    If you have a look at this conversion circuit:

    [​IMG]

    There is no manipulation of the signal going on, just some passives and a hex inverter (which is being used as a buffer here, see how the signal goes through the gate twice). It'd be pointless converting both ways.

    So by my reckoning, the easiest way to switch your SPDIF signal would be the same way you're switching your other signals. Just go from the receiver's data pin to the relay, then from the relay to the transmitter's data pin. Simple.
     
    Last edited: Feb 19, 2013
  3. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Thanks for the feedback mate - wasn't aware of the need for caps on the 7805, would I need to do the same with the 7812? And just to check, if I use the +12v to the relays, that should do the job?

    Thanks as well for the info on the toslink's signal utilising one of the relays - will keep it nice and simple, requiring less components and means the layout can remain pretty similar to the rest of them.

    How's your RGB switch going? Speaking of which, what gets routed from the SCART for RGB switching? I was thinking you'd need to route R, G, B, Sync and L & R audio, with GND sourced from anywhere else and no need for +5v from the SCART socket for the same reason?
     
  4. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    I'm fine-tuning my PCB layout, and figuring out how to put it all in a case.

    The 74CBT3244 can switch 8 lines, I use 6 of those as you pointed out: R, G, B, CVBS, Left Audio, Right Audio.

    Since I'm using my RGB->YUV converter box, I've omitted the trigger/blanking signal pins of SCART for simplicity. If I need them later, it would be trivial to add them, I'd just build a small daughterbord to generate the voltages, and feed them straight to the output plug. No need to switch them.
     
  5. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    I figured adding the voltage would be trivial, so I was considering going down the same route myself!

    I'm planning on using an old PC case and repurposing it for the switchbox. The dimensions when it lays on its side (it is a tower case) actually suits the other AV gear in the rack, with some modifications to sort out a few things though!
     
  6. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    And then there was a circuit board:

    [​IMG]

    Still has the toner etch-resist coating applied, to stop the tracks from oxidising before I get to solder, and that's why it looks dull right now. Underneath that coating lies shiny copper traces.

    The dark bits in the top right are some touch-ups I did with a permanent marker, where the toner-transfer stuff didn't peel off the sheet properly.

    Tonight: drilling.....
     
  7. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    Pics! :O

    [​IMG]
    [​IMG]
    [​IMG]

    Special thanks to my 1.3mm drill bit, for being a complete piece of shit and burring a bunch of the holes...
     
  8. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    The AVR is successfully running off the ISP (In-System Programming) header!


    [​IMG]

    Completion is close!!!
     
  9. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Nice work!!

    I'm actually plugging away at my circuit design at the moment - just sorting out the bus lines for the various inputs, I'm still pretty slow with Eagle but getting the hand of it!

    I've decided I'll plug ahead with a master circuit diagram, and then I'll create a couple of sub-circuits that are a little more easier to follow that will more closely tie to the physical build of the sucker. I've decided that due to the case design and a couple of other factors that I'll look at having one main board with most of the ICs, status LEDs and power distribution setup so that it's as close to the panel controls as possible, then will run keyed headers to each board that only take the logic triggers to activate or deactivate the respective relays for each family of inputs (and the +12v and GND as well). This way the relays will sit as close as possible to the inputs (thus reduced noise on the AV lines) and the ICs can be covered up in some light shielding on the front panel to keep things as clean as possible.

    I'm still thinking of using a combination of perfboard and stripboard since I'm not confident about building PCBs (and I've got my head around creating board layouts to suit either of these options in Eagle), and it also means where I've had to create components in Eagle, if the physical dimensions are out of whack I'll still be fine!

    Keep the pics coming!
     
  10. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    Speak of the devil and he shall appear!

    I have selected a case. I was originally going to buy a proper project/instrument case from Jaycar, but found that they were quite expensive, and even their largest ones wouldn't be quite big enough anyway.


    So I found this 286 small form factor system lying around the workshop. The motherboard has some slight acid damage but works well, and it's an "all in one" design too, so it may see life in another project in the future. For now though, the case is perfect!


    [​IMG]


    I started by hollowing out the backplane. I'm going to need every little bit of space I can get for 12 SCART sockets.


    [​IMG]


    Then I bogged up the front panel to fill in the holes, and make it nice and flat for a coat of paint later.


    [​IMG]


    I've also written about 90% of the control software for the Atmega AVR. More on that later!

    Edit: Oh, almost forgot!

    I attached the mini-coax cables to the main PCB, that will eventually go to the SCART inputs:

    [​IMG]
     
    Last edited: Mar 3, 2013
  11. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Looking awesome there!! Gotta love repurposing those old PC cases, should be a great match for your switch!

    I was originally going to do something similar as I have three identical slim PC cases (they're old PII machines, so not as old as yours but still made of hefty aluminium), but with the scope increasing to 40 inputs, the current case I've earmarked is better suited for the job.

    Nice to see your PCB getting wired up too!
     
  12. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
  13. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Didn't realise you had a YouTube channel - will check it out along with the cool stuff your working on for your AVR! That display in particular looks really nice too!
     
  14. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Bump - Had a look through those videos last night, that display panel functionality looks really nice mate! Now it has me thinking about doing something similar for my switch.......... dangerous thoughts!
     
  15. omp

    omp Familiar Face

    Joined:
    May 22, 2011
    Messages:
    1,017
    Likes Received:
    8
    Good to see this forum being "inundated" (how sick are you of hearing that word) with aussies! Looks like a neat project you have there!
     
  16. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Yeah, we're good like that :)

    Thanks to RetroSwim, I've started looking into something fancier than LEDs... and while going down the microcontroller route is out of my depth (I don't have the gear for it and it hurts my brain), I've looked into going old-school with some 14-segment displays instead.

    I don't think I'll have any trouble working out the wiring (connect voltage to x number of pins to light up segments to create an alphanumeric character), but I figure there might be the need for transistors and resistors on the circuit to drive the display efficiently and not burn the thing out. The output from the CD4017B can drive a single LED with a resistor thrown in, but I imagine using that output to drive a series of pins on a 14-segment display would not be a good idea. I'll have a look at some 7-segment and 14-segment circuits to see the best way of doing this, unless someone knows off the top of their head how it's done.

    Damn scope creep... and I'd virtually finished the simpler LED-based indicator circuit too!
     
  17. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    Best solution would be a a 10-to-4 binary encoder (the 74HC147), with a binary-to-7-segment decoder (the 4511).

    The encoder changes the decimal input from your counter to a 4-bit binary value, which the 7-segment decoder will read and display on the display.
     
  18. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Awesome, I figured there'd be a smarter way of working with a segment display :) I've decided on using an 8-digit 14-segment display, so I'll take a look at the principles for the parts you've listed and see if I can apply them to this setup. Using an 8-digit display means I can set it up as:

    CVIDEO.xy
    SVIDEO.XY
    YPBPR.xy
    RGB.xy

    (where xy is the number - 01, 02, etc to 10)

    And utilise the one panel to sort it out. Pretty sure some quick Googling showed I can get an 8-digit display module, which I'm guessing will look a bit nicer than chucking in 8 individual displays.

    Damn scope creep :)
     
    Last edited: Mar 8, 2013
  19. RetroSwim

    RetroSwim <B>Site Supporter 2013</B><BR><B>Site Supporter 20

    Joined:
    Dec 10, 2012
    Messages:
    605
    Likes Received:
    26
    Did a little bit more today, etched+drilled the output bus PCB, and attached it mechanically and electronically to the switch board. Meccano pieces FTW!

    [​IMG]

    Serious hand cramps after all the soldering though...
     
  20. MangledLeg

    MangledLeg Peppy Member

    Joined:
    Jul 11, 2010
    Messages:
    353
    Likes Received:
    4
    Nice!!

    So, correct me if I'm wrong, but the bottom board takes all the inputs and houses all the electronics, and the top board is purely the bus that will carry the outputs from your ICs and send them to a single output socket?

    BTW, did some research into your suggestions above and have thrown together the following circuit theory in Eagle to demonstrate how to get the push button to trigger a count on a 7 segment display:

    [​IMG]

    Another circuit I found that might also do the job is this one - not sure which would be better though, or if I'm even on the right track with the circuit I posted. Apologies if the circuit is messy, I'm still learning!!
     
    Last edited: Mar 11, 2013
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page