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 · Share on Facebook Share on Twitter
«1

Comments

  • TTonyTTony Frets: 15135
    Sounds interesting ...
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • normula1normula1 Frets: 262
    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 · Share on Facebook Share on Twitter
  • poopotpoopot Frets: 1461
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • paulnb57paulnb57 Frets: 1187
    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 · Share on Facebook Share on Twitter
  • TTonyTTony Frets: 15135
    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!).
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • normula1normula1 Frets: 262
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    @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 · Share on Facebook Share on Twitter
  • 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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    edited January 14
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    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 · Share on Facebook Share on Twitter
  • Adam_MDAdam_MD Frets: 2995
    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 · Share on Facebook Share on Twitter
  • BigMonkaBigMonka Frets: 1514
    This is very cool. Not sure I could have done this even during my electronics degree!
    Always be yourself! Unless you can be Batman, in which case always be Batman.
    My boss told me "dress for the job you want, not the job you have"... now I'm sat in a disciplinary meeting dressed as Batman.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    Time for a couple thoughts.

    Now the relays have been selected, I thought I'd better check some power figures. Relay coil resistance is 178ohm, which means driven at their rated 5V, they should draw ~28mA. The shift registers I was looking at are rated at ~20mA. The relays can be driven using a lower voltage, and using 4V would only drop the current to ~22mA, which although would likely work, it is likely to increase failure. So it's going to mean adding transistors to the drive the relays. Not a big deal, but even with quad transistors (4 transistors on single chip), is still another 9 chips to fit on a board.

    The current plan, is the relay board will be separate from the controller board. I could combine them, but by keeping them separate, it means I can change the controller later while keeping the relay board.


    I've also been looking at sockets. I'm currently thinking of using PCB mounted jacks, which although means the relay board will have to be a good bit bigger, it removes the added complexity of connecting jacks to the board via wire, and the jacks should support the board in the final housing.

    The plan is to get all that combined into a schematic, and get a 3D model to see just how things will look. Then hopefully get some PCBs ordered within the next couple weeks.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • Winny_PoohWinny_Pooh Frets: 3065
    Fucking cool thread. Wish I had the know how (and time) to understand this stuff. Thumbs up
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    Relay board design is nearly finished. Just need to add a couple extra mounting holes, but here's a screen grab-


    And if I've managed to upload this correctly, this link should provide an online 3D model that you view - http://autode.sk/2D2PRLt

    Now just to get the controller board designed..
    0reaction image LOL 1reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    I've been doing a bit thinking over the controller board, along with a little bit research.
    It turns out there are Shift registers available with the current driving capability I need for the relays, so it greatly simplifies that part of the design. They also have inbuilt flyback diodes, so it eliminates the need for diodes on the relay board, but I'm just going to leave the relay board design as it is.

    As I'd like to add Midi, I had been thinking of designing the controller board with the Midi sockets mounted directly on the board, but I can't help but feel that's going to give me a bit of a headache in terms of mounting everything easily in a housing, so I'm now thinking just having headers on the board.

    I'm still debating LEDs. I think I'm going to add in an extra shift register for driving them, which will give me a total of 15 extra outputs, which I'll route to a set of headers.

    Switch inputs I think I've decided on a 3x3 input matrix, which will allow me to have up to 9 buttons. I may expand it to a 3x4 matrix allowing for 12 inputs.

    Power supply wise, everything is going to be run of 5V, so I'll take the easy option and use a 5V linear regulator, along with a standard 9V supply in.
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    Finally got the schematic done for the control board



    Tomorrow's plan is to hopefully get it converted to a PCB design, which may take a little big of juggling, then try and get an order in before China shuts down for their new year :-/
    0reaction image LOL 1reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • Adam_MDAdam_MD Frets: 2995
    Very cool I’m loving this.  
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • m_cm_c Frets: 421
    PCB order finally went in last night, after a few last minute component swaps. I'd mistakenly used metric headers instead of the far more common 0.1" headers for the cable to board connections, so had to change a few parts.

    So for those interested, here's how you go from schematic to PCB.
    Taking the above control board schematic, you import it to the PCB designer, and get presented with this mess-


    On initial import, all the components positions are taken directly from schematic, and all the blue lines represent connections.
    First job is to move everything where you want it, so you end up with something more akin to the finished article-


    The software does have an autoplacement function, however it will try for the most compact component placement possible, which means components end up in some very weird positions, and generally not in a good way. You can lock down key components, then autoplace the rest, but I find it just as easy to manually place everything.

    Once your happy, you hit the autoroute button, at which point all going well, you end up with this -

    At which point you just need to double check everything has routed correctly, by making sure there are no blue un-routed lines left, and carry out any slight tweaks. And having just looked at that this morning with a fresh set of eyes, I forgot to boost the size of the main 5V and Gnd tracks (not the end of the world as total current usage shouldn't be that high), and some of the components would of been better rotated around a bit to make track routing more direct. Ah well, that's why you make prototypes.

    Then once you're happy with the design, you need to export all the required files for manufacture, and send/upload them to your PCB manufacturer of choice. Which in my case is Seeedstudio's Fusion service. I've used them multiple times in the past, and they're normally pretty quick, but I just need to hope they get them made and sent before shutting on Sunday for two weeks...
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
  • paulnb57paulnb57 Frets: 1187
    This is so interesting to someone like me who is utterly clueless, much of it goes over my head, but I'm enjoying it a lot!
    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 · Share on Facebook Share on Twitter
  • Adam_MDAdam_MD Frets: 2995
    You’re way above my head too.  I understand it but certainly couldn’t design it keep us updated when you get your boards.  
    0reaction image LOL 0reaction image Wow! 0reaction image Wisdom · Share on Facebook Share on Twitter
Sign In or Register to comment.