C18Q1 A switching plan

What's Hot
As someone who likes to play around with pedals, is in general a bit geeky, and likes lots of options, I've often considered something like a Gig Rig, or a Boss ES-whatever, however I can't really justify that amount of expense for something just to save me moving cables.

The idea of building one has been simmering away in my head for a while, and having previously programmed Arduino's and ST ARM processors, along with designing and assembling a few PCBs, I think it is entirely doable.

So the general plan, and goal for this challenge -
  • Minimum of 4 switchable loops. I do think 6 will be a lot more useable, however 4 involves a good few less relays, and will still prove the underlying design. I may decide to go for a 6 way design, but won't make a definitive decision until I find out just how complicated the PCB would be.
  • Arduino for doing the brains. It's easy to program, and more than powerful enough to handle what is in reality a pretty low speed task.
  • Switches. One foot switch for each channel, then probably at least a couple more for altering how things work/react.
  • LEDs. So you have some idea what's on, and what's doing/connected to what
  • Have at least one basic mode programmed, where loops get added/removed in the order you press the respective buttons.
  • (I may add an LCD, however it won't really be needed for the basic mode)
As it stands, all this has just been in my head, so the next step will be to sit down with a pad of paper, and start with my tried and tested process of random doodles complete with illegible scribbles.
0reaction image LOL 1reaction image Wow! 0reaction image Wisdom
«1

Comments

  • TTonyTTony Frets: 27345
    Sounds interesting ...
    Having trouble posting images here?  This might help.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    The scribbles have commenced.



    And I even have a formula!
    The number of relays needed is (n^2*2)+n+1 where n is the number of pedal loops.
    So for 4 loops, I need 37 relays to get all possible combinations, or as per my check diagram, 22 for 3 loops, and if my formula really is correct, would mean 79 relays for 6 loops.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • normula1normula1 Frets: 639
    something like one of these might help. I used the four way versions in my existing loop switchers and have one of the bigger ones sat in a box along with a Highly Liquid MIDI board for when I can be ar*ed to get in the garage and drill the chassis that's sat under my desk.

    https://www.ebay.co.uk/itm/8-DPDT-Signal-Relay-Module-Board-DC12V-Version-for-PIC-Arduino-8051-AVR-MCU/372174225173?hash=item56a74fff15:g:2QQAAOSwBahVNgsA

    Here's my smaller one:



    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • poopotpoopot Frets: 9098
    How about building something along the lines of the Carl Martin octaswitch? All done with dip switches to select what pedals are in the loops.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    A little explaining about the scribbles for those who can't work them out.
    Along the top, we have the 4 loops, each with a Send and Return, and the final/Amp output.
    Working from the top, we have the (guitar) input, followed by what I'm calling interconnects (there probably is a more accurate name, but my mind is drawing a blank..).
    The purpose of the interconnects, is to link the loops together.
    And finally, each X is where we need a relay to allow for all possible options.

    Now the next problem is suitable relays.
    I did have in mind using analog switches, which are designed for multiplexing various signals including audio, but now I've checked some datasheets, they have a severe limitation in switchable voltages. As they are essentially a semi-conductor relay, the switched signal voltage is limited. The limitation is typically 0V to supply voltage (typically max of 5V). Now given that when the signal leaves the guitar, it's coupled to ground, and from a bit research the signal peaks around 1.2V either side of 0V.

    I could still use them, but it would mean either buffering/filtering the inputs to ensure they fell within the 0-5V range, or floating the supply voltage to the switches, so in effect they were supplied with -2.5, and 2.5V, so 0V fell at the mid-point of their switching range. However, I'm going to assume some pedals are going to output RMS voltages higher than that, so that's been added to my research list.
    And all that is before you consider the capacitance analogue switches add to the circuit. in the ON state, the one I looked at adds 84pF, and in the OFF state 23pF. So should you use all loops, you're looking at 10 ON switches, and 27 OFF switches, which loads the signal with 840+621=1'461pF, or just under 1.5uF. Off course, as that will be dispersed between all the pedals, it might not be that big an issue, but it will probably have a noticeable effect.

    The next option is conventional relays, which does significantly increase the cost of relays, but my concern there is reliability. Relay contacts rely on arcing to keep them clean. Picking a datasheet for a small 3A relay, which is designed to last over 100'000 cycles under load, it recommends a minimum of 100mA. Below that current, the contacts don't arc enough to stay clean, and can result in failure within several thousand cycles.
    I still need to have another look for relays, as I suspect I'm missing an entire category, as you can get relays rated for under one amp, but initial searches have not found any yet.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    poopot said:
    How about building something along the lines of the Carl Martin octaswitch? All done with dip switches to select what pedals are in the loops.

    Never heard of that before, but it certainly sounds interesting. I'll have a read of the manual later.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    A range of suitable relays has been found, so that is one problem solved, which has led me to the next dilemma, through hole, or surface mount.

    I have worked with surface mount previously, but a matrix of 37 relays is a bit beyond what I'd be comfortable doing manually, and I don't really want to have to build a reflow oven just for this (even though it would be handy for future use). However, surface mount gives me the advantage that trace routing underneath the relays wouldn't be affected by pins sticking through.

    Next step is to draw things up in some PCB design software, which for me is DipTrace, then I can try layouts to see how much of a pain through hole layout will be.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    And after a couple hours spent with DipTrace, we have the following schematic -



    Which generates in to the following PCB, using through hole relays -

    There are a couple traces I would manually alter, like the Audio GND along the top which could quite easily be a straight line on a single side, instead of starting of straight, before going all squiggly across both top and bottom, but this was just a proof of concept, to see if things would route successfully without lots of jumping around.

    The keen eyed amongst you will of noticed that there are 4 relays less than my scribblings above. While drawing it up in DIpTrace, I realised that there is no need to be able to connect the interconnects directly to the Amp out. The final pedal in the loop, simply needs to connect to the Amp out line.
    I could also eliminate R5, as it's purpose is to connect the Guitar In directly to the Amp Out, but if I loop the signal through the top bank of Send relay normally closed contacts, then with all those relays inactive, the guitar signal makes it's way to the output anyway.

    I now also need to decide whether I need relay back emf diodes fitted, but I'll discuss that in another post, once I've mulled things over for a while.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • paulnb57paulnb57 Frets: 3044
    I have huge admiration for folk who even remotely understand how to stuff like this works and also have the ability to design it too.


    Stranger from another planet welcome to our hole - Just strap on your guitar and we'll play some rock 'n' roll

    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • TTonyTTony Frets: 27345
    m_c said:

    The keen eyed amongst you will of noticed that there are 4 relays less than my scribblings above
    I was going to ask about that ...






    (I actually have no idea about any of this - just getting a simple guitar wired usually takes me a couple of attempts!).
    Having trouble posting images here?  This might help.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • normula1normula1 Frets: 639
    Appologies if I'm teaching you how to suck eggs; the accepted wisdom is that the back EMF diodes are required if you are driving the relay switching with something transistory as otherwise the drivers will blow when the relay is disengaged.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    @paulnb57 it's all about circuits. Relays are just electrically operated switches, so if you understand how a switch works, you're most of the way there. You just need to add an electromagnet into the mix.

    @normula1, that is the general wisdom, however it could cause a slight flaw.

    So flyback diodes, or no flyback diodes?
    For those who have no idea what I'm on about, at the heart of a relay is a small solenoid. You power the solenoid, an iron core moves, moving the contacts. All good.
    Now when you remove power, the electromagnetic field collapses, and the core and contacts are pulled back by a spring.
    All simple enough, however the collapsing magnetic field causes a power spike, with reverse polarity. In this case I'm using a 5V relays, however a collapsing field generates far more voltage than it took to create it. So for a 5V relay, when deactivated, will potentially cause a a several hundred negative volt spike. (it's this principle that ye olde car ignition coils relied on to fire sparkplugs. The sparkplugs fired when the points opened, not when they closed, as the collapsing magnetic field could produce a far larger voltage than the creation of the magnetic field).

    What a flyback / back EMF diode does, is rather than the relay coil simply going open circuit with a resultant voltage spike, it gets connected across the relay coil terminals, and allows that voltage spike to re-circulate through the coil, until it's dissipated.

    Why does this matter?
    As @normula1 has mentioned, when driving a relay via some form of semiconductor (transistor,FET etc), that voltage spike is very often enough to kill the it, so the diode protects whatever is controlling the relay.
    However, there is a drawback. By having a diode, the power is re-circulated through the relay coil, meaning it doesn't de-activate as quick.

    The datasheet for the relay I picked in the above schematic/PCB (might not be the final choice), has the following figures-
    Without parallel diode - 1ms Typ. 3ms Max.
    With parallel diode - 3ms Typ. 5ms Max

    Now is 5ms significant in the case of a pedal switcher?
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_c said:

    • Have at least one basic mode programmed, where loops get added/removed in the order you press the respective buttons.
    That sounds like a killer feature on its own. Is it something you came up with, or does it exist on, uh, existing switchers?
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    m_c said:

    • Have at least one basic mode programmed, where loops get added/removed in the order you press the respective buttons.
    That sounds like a killer feature on its own. Is it something you came up with, or does it exist on, uh, existing switchers?

    If I'm honest, I have no idea if it's been done before or not.
    My inspiration was looking at things like the QMX, and thinking I'd just as well just turning each pedal on and off. I want to be able to switch pedal order without getting on my hands and knees and getting tangled in cables.

    Going by the GigRig G2 manual, it does it, but it involves using the button pad. The PBC only actually has 3 loops (4+4+2) that can be re-ordered, within the 3 loops the pedal order is fixed. The only manual I've not had a good read of yet is the Boss ES one.

    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    ES manual has now been skimmed, and for all intents and purposes, it's very similar in operation to the G2.

    I also had a look at the Carl Martin Octa-switch as mentioned by @poopot. I actually like that level of simplicity. Just set the dip switches for what you want on, and you're good to go. Obviously doesn't let you change pedal order or anything like that, but is a step above the basic switchers.

    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    Now I know the basic layout will work, it's got me pondering a few other possibilities.

    To avoid static build up in pedals that are not currently connected, I could switch the relative inputs and/or outputs to audio gnd when not in the loop, probably via a reasonable value resistor.
    I'd quite like to implement delay carryover, as it's relatively simple to implement, but as it's purely a software thing, it can be added at anytime.

    Which brings me onto controlling the relays. For programmming simplicity, I'm going to use an Arduino to do the brain work.
    Now as I'm only planning on using 33 relays, and probably 8 LEDs, I could cheat, and throw lots of IO (Input/output - pins are not dedicated and can be used as either an input or output) at this in the form of a Mega, or Due, which each have 54 IO, so more than enough, but I'm wanting to try and keep things a bit more compact. Plus if I do scale this up to more than 4 loops, I'm going to need far more than 54 IO.

    So the starting point is going to be an old faithful Uno, which only has 14 IO pins. Which means multiplexing will be needed, in the form of Shift Registers. What a shift register does, is take a single serial input, along with three timing clock/triggers, and converts it to a parallel output. So for the use of 4 pins, you typically get 8 outputs. However, you can cascade shift registers (the serial stream cascades from one in to the next), and by using extra serial outputs and the same clock/triggers, you can get an extra shift register stream at the cost of only 1 additional output.

    Now I'm going to have find some shift registers, run some timing tests, and see how quick/slow each method is going to be. One drawback of using the Arduino development system, is some simple tasks are pretty slow, but I'll find out soon enough.

    Now I'm of to check what I have lying around, and possibly order some parts to do some testing.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    edited January 2018
    Dug through the electronics collection, and unearthed enough bits to create this lump of spaghetti -


    And using the example code from Arduino, which also uses a very convenient included library for driving shift regiseters (ShiftOut), and hooked it all up to a logic analyser to see just how quickly or slowly it works, which results in this screen grab -


    What you have starting at the top, is the Data line, followed by the Latch line, followed by the Clock line, with the remaining being the final 5 outputs from the shift register (what the LEDs are connected to in the mishmash above).
    Each time the clock signal rises, the current value on the data line is stored in the first internal register, with the previous value pushed through to the next register. Then when the registers have been updated, the latch line is triggered, at which point the new values are transferred to the output pins, and as you can see in the diagram, the lower five signals change at that point.

    From that diagram, I can see the time this is taking. From that diagram, from latch to latch, is taking 0.116ms. Now if I cascade through to more shift registers, you don't get that slight pause at the latch, and going by the times, the clock line is running at roughly 70-80KHz, so in effect if I drive all the outputs (33 relays + plus 8 leds = 41 outputs, but we'll round up to six 8 bit shift registers) via a single pin, it would take roughly 0.7ms to refresh all outputs.
    Which will be fast enough for this application. Things could be driven faster with some more efficient coding, but I'll avoid that for now.

    Now how many switches, and LEDs...

    (And given how easy this part is going, I'm tempted to add a few extra features to the challenge...)

    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    Time for some rambling about general design/layout thoughts.

    It's going to need 10 jack sockets. Now do I go for in a single row, or stack them up?
    Given a pancake plug is typically 20mm wide, for comfort you really need 25mm between sockets, so that then makes the minimum overall length around 275mm. Although having measured a couple pedals I've got with multiple sockets, they seem to be spaced at 22.5mm, so would need just under 250mm length.
    But having just folded up a bit paper to roughly 250 x 150, it does look a bit small to have a row of 4 switches, whereas 275 gives a bit more foot room.

    Which then leads on to the next problem Switches. I need some kind of momentary foot switches, but I can search for them later, unless anybody can suggest something suitable?
    The number and what they do is what I'm debating. For the basic purposes 4 would do. Quick press to add pedal/remove pedal to the loop, perhaps a longer press to move it up/down the loop.
    Add a second row of switches, then it opens up the possibility for more functionality, but I'm not entirely sure what..

    Next are LEDs and displays. I'm thinking 2 different colour LEDs per loop (or perhaps one LED per switch), but not entirely sure why, or what meaningful info two LEDs would show...
    For future additions, I'm also thinking about including a LCD display, which brings me onto added features. The big one I'm going to design into the main board is MIDI. Mostly because I can, but because it opens up a lot of options, so having a LCD display will be useful for displaying what's going on.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
  • m_cm_c Frets: 1211
    Decided on what relays to use this week, so have just finished updating the schematic to use the correct part.
    I still need to add flyback diodes, and decide how I'm going to connect the jacks to the board, but thought I'd have a play with the 3D rendering, which resulted in this -


    The pure black colour of the relays, makes them look very flat, but overall PCB dimension is 6.6" by 2.6" (I'll mention that even though most things in modern engineering are metric, electronic components are still very much stuck in the imperial system).
    0reaction image LOL 1reaction image Wow! 0reaction image Wisdom
  • Adam_MDAdam_MD Frets: 3420
    Wow I’ve just seen this thread excellent stuff @m_c I’m very interested in watching the rest of your progress.  Good luck 
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom
Sign In or Register to comment.