Universal MIDI Expression Pedal

Hi @Pio, can I ask the purpose of the two resistors R7, R8?
exp_sim4_copy.png


In my experience with buttons, all you need is a SPST switch connected on one side to the Sense pin, and the other to ground, using the internal pull-up resistors on the Sense pin. In fact I've not needed to connect buttons to power on Teensys.

I see the two resistors form a voltage divider, with 0.033V reaching the Sense pin. Is this for pullup purposes? Or ESD protection?

Sorry to ask what may be very basic questions, and I really appreciate your expertise. I want to understand your schematic if I am going to adopt some or all of it - and again, many kind thanks for your time.

Mike
 
You can actually omit the R7 + R8 if minimizing the part count has a high priority.
I tend to use an external pull up + one small series resistor for signals that connect to the outside world. Sure. it's not directly connected, the S -switch gets disconnected from the ground if a plug is inserted, but this the wold of guitar pedals, where these devices often spend time in harsh environments (dirt, smoke, beer). R7+R8 are not strictly necessary, but giving the small cost of two resistors, they improve long term reliability.
R7 could be lower, ie 10-20k. Lower values increases current that flows through the switch contacts which extends their lifespan (wetting current).
 
You can actually omit the R7 + R8 if minimizing the part count has a high priority.
I tend to use an external pull up + one small series resistor for signals that connect to the outside world. Sure. it's not directly connected, the S -switch gets disconnected from the ground if a plug is inserted, but this the wold of guitar pedals, where these devices often spend time in harsh environments (dirt, smoke, beer). R7+R8 are not strictly necessary, but giving the small cost of two resistors, they improve long term reliability.
R7 could be lower, ie 10-20k. Lower values increases current that flows through the switch contacts which extends their lifespan (wetting current).
Amazing explanation @Pio - many kind thanks!

I'd probably go with a lower value then but I appreciate your explanation very much.

Only thing I'd like to add to your design will be a switch to disconnect TR so I can also use it for a foot switch - the whole idea behind this is to truly make a universal pedal input.

I'll post a suggestion soon and if you can critique it that would be amazing.,

Many thanks again. What a treasure you are.

Mike
 
Hi again @Pio, here's a slightly modified version of your schematic. It's not complete, but am I on the right track?

Expr + footswitch.jpg


SW1 could be an analog switch SPST.

Not sure if ADC2 would need the protection resistors like you have on the other inputs.

Also R7 lowered to 10K for longevity and wetting current as you suggested for longer life. Could use the internal pull-up resistors or additional external - whatever would be safest and most reliable.

Any thoughts?

Thank you again so much.

Mike
 
Looks good.
Ring will be exposed to the outside world, i would add at least a simple RC protection (1k + 100n, same as R3+C2) plus an internal pull-up enabled. The ADC2 can be any logic input, not an ADC one. You can use ADC to sense digital signals, but it's not necessary.
With SW1 open the input can take either a TRS jack with two footswitches: Tip+Sleeve, Ring+Sleeve or a single mono TS jack. The latter will have the ADC2 signal inactive, always shorted to GND by the plugged in mono jack.
SW1 could be a small single analog switch like the 74LV1C66.
This solution would use 4 Teensy pins:
  1. Analog input for the expression pedal
  2. Digital input "Sense" as INPUT_PULLUP
  3. Digital input "ADC2" sensing the Ring contact, INPUT_PULLUP
  4. Digital output - controlling the analog switch SW1
plus I2C bus to control the MCP4018 digital pot (needs 10k pull ups on SCL and SDA, too).

With the SW1 closed (Exp pedal mode) pin 1 would be used to AnalogRead() the Expression pedal position. ADC2 will have to be configured as INPUT (no pull-up since it would added in parallel to the R1, we want it to stay at 100k).
With SW1 open, the ADC pin can be configured as INPUT (opamp has a push-pull output, no need for the pull-up resistor) and the pin ADC2 as INPUT_PULLUP, both read as DigitalRead()

I can share the KiCad project with the above schematic if you want to play with it and modify things.
 
Looks good.
Ring will be exposed to the outside world, i would add at least a simple RC protection (1k + 100n, same as R3+C2) plus an internal pull-up enabled. The ADC2 can be any logic input, not an ADC one. You can use ADC to sense digital signals, but it's not necessary.
With SW1 open the input can take either a TRS jack with two footswitches: Tip+Sleeve, Ring+Sleeve or a single mono TS jack. The latter will have the ADC2 signal inactive, always shorted to GND by the plugged in mono jack.
SW1 could be a small single analog switch like the 74LV1C66.
This solution would use 4 Teensy pins:
  1. Analog input for the expression pedal
  2. Digital input "Sense" as INPUT_PULLUP
  3. Digital input "ADC2" sensing the Ring contact, INPUT_PULLUP
  4. Digital output - controlling the analog switch SW1
plus I2C bus to control the MCP4018 digital pot (needs 10k pull ups on SCL and SDA, too).

With the SW1 closed (Exp pedal mode) pin 1 would be used to AnalogRead() the Expression pedal position. ADC2 will have to be configured as INPUT (no pull-up since it would added in parallel to the R1, we want it to stay at 100k).
With SW1 open, the ADC pin can be configured as INPUT (opamp has a push-pull output, no need for the pull-up resistor) and the pin ADC2 as INPUT_PULLUP, both read as DigitalRead()

I can share the KiCad project with the above schematic if you want to play with it and modify things.
Incredible. Thank you so much.

99.99% you, and a tiny bit me, but you/we are creating a terrific universal pedal for the Teensy! To handle all kinds of pedals!

I would be grateful for the KiCad files and make your suggested changes, and repost to get your feedback, unless you want to add those changes, but I'm happy to.

Thank you again @Pio!
 
Here is a new, updated with the suggestions version, KiCad8. I haven't touched the PCB or footprint associations. It's schematic only.
exp_sim7.png
I have used a simpler variant of this circuit in the 1st prototype of the TGX4 pedal. Using it on daily basis to control the WAH section. Works great without any issues.
 

Attachments

  • ExpIn.zip
    107.2 KB · Views: 15
Fantastic @Pio! Thank you so much for the update, as well as sharing the KiCad files.

I really appreciate your generosity of time and knowledge!

I'm going to study everything you shared and may have a question or two.

Thank you!

Mike
 
Hi again @Pio, I am going to be building this in EasyEDA to test it, so I translated from KiCad the schematic. I know KiCad can do it all, but I've used EasyEDA for a couple years and am more comfortable in it. Plus you can generate a PCB automatically and have JLPCB build it too.

So here's your schematic, translated again into EasyEDA format.

I wonder if by chance you, or anyone, can help me proof it? I've gone over it twice very carefully, but it's so easy to miss obvious things. Plus sometimes I get confused/perhaps slightly dyslexic when symbols are turned around, which I can't help when using other libraries with their premade symbols for components.

Thanks so much, and I'd be happy to share the EasyEDA project files too if anyone wants it.

Pio Circuit in EasyEDA.jpg
 
Bottom row of 10k resistors + MCP4018 needs power. Add VCC to the left side of C4.
C4 should be placed close to the pin1 of U3.
 
Excellent catch @Pio ! Thank you so much.

Corrected...
Pio Circuit EasyEDA 2.jpg


If you see anything else please let me know...PCB Layout adjusted to put C4 near pin 1 of U3, although not reflected in schematic.

I appreciate it so much.

Mike
 
Is the "PEDAL" connector keyed, like the JST ones? Or just a pin header?
Having the Vcc and GND as 1st and last pin will create short of someone accidentally plugs the cable backwards.
Putting GND right after VCC will be safer.
I can take a look at the layout if you share it. I have an EasyEda account.
 
Hi @Pio , that's amazing!

Yes the connector is keyed, and it's an internal connector that will only ever be plugged in and out while the board is unpowered. But I do think putting GND/PWR together for that reason is a good idea. Not yet updated with that suggestion.

Here is the link to the project: https://oshwlab.com/phillmj/universal-pedal-board

Thanks,

Mike
 
Last edited:
exp_sim9.png
A few points about the PCB design:
  1. Layers and stack up. This is a simple circuit, it is possible to route it on 2 layers only. Using 4 layers and with unconventional stack up - no dedicated ground plane, but the whole bottom layer is 3.3V, internal layers used to route a few tracks only is not efficient and not necessary. Much better and commonly used method is to use the internal layers for ground or ground+power and route signals on the external layers. Here - i'd do this on 2 layer only and have a cheaper PCB.
  2. Component packages: i understand why most of the passives are 1206 (except one capacitor), they are easier to hand assemble, yet there are tiny SC70 chips contradicts this approach. If the board will be assembled by the JLC, why not use a much common 0603 sizes for everything and make the PCB smaller.
  3. Marked with blue arrow - why split the track in two and use separate vias?
  4. There is a piece of leftover 3.3V track and a via on the top layer, marked with white arrow.
  5. Mechanical design. Specifically placement of the two mounting holes and the "PEDAL" connector. Plugging a connector there will execute a bending force on the PCB, which might be bad for the solder joints and SMT components. Assuming the connector is a vertical one..
I've made a quick route using the previously posted KiCad project. Sorry, can't really get used to EasyEda and i can open your project as read only.
Routed on 2 layers only, using 0603 passives with bottom layer used for the components. Placing them there allows to use the space underneath the Jack connector and makes reworking or troubleshooting easier, as using hot air won't melt any through hole components.
The top layer is a solid ground plane with a short power track only. Board size is under 50x50mm which fits into the cheapest option at JLC.
exp_sim8.jpg
 

Attachments

  • ExpIn_2.kicad_pcb.zip
    107.4 KB · Views: 12
Hi @Pio, as per usual, fantastic suggestions! Thank you so much for ALL the time and effort you have put into this - it's truly a universal pedal input now! I mean, honestly, you must have spent hours at this...please DM me and I'd like to at minimum buy you a coffee. I can't thank you enough for your insights and brilliance!

So, to address a few points...

First, sorry EasyEDA project is read-only; didn't realize that. I'll try to change it. I just learned how to share.

I'm limited in sizing of the PCB due to the constraints of the rest of the design. I can't move the screws back as you have them, because the metal shell it's going into won't allow for it. And it can't be much longer as there are some PEM nuts in the way. The screw holes are so huge because I use a locking M3 nut that makes assembly really easy, but it has almost an 8mm diameter. Using these has saved a lot of hassle in assembly for me as opposed to smaller footprint M3 nuts of only 6mm.

And placement of main connector - I really only have one location for it due to other components in the way.

Screenshot 2025-02-19 at 2.26.51 PM.jpg

Screenshot 2025-02-19 at 2.27.12 PM.jpg


Also, JLPCB charges a lot for assembling both sides of a PCB, so it's not cost effective to do both sides. In your example, I think you are assuming I would just populate the top of the PCB, which would work of course.

I see you're using Dupont connectors - 0.100"/2.54mm connectors. I have not had good luck with those. They seem to get loose and after awhile if you plug them in/out too much they don't provide a reliable connection. At least that's been my experience. Perhaps you are using a different connector here?

Also, I like locking connectors, to prevent anything coming out, and just pin headers don't provide that. Since this is going into a product I want to have last for a long time, I like to use either PH2.0 connectors, or the 1.0mm versions. If you have a better suggestion of course I'm open to it.

Yes you are right about the PCB bending when inserting the connector. I originally had an additional third screw on the right, but took it out due to constraints of an additional component, a MIDI connector, that was in the way.

Since I would be the only one inserting/removing the connector, and only on assembly, once, I cannot see shear forces being an issue over time, since the connector will not be going in and out a lot at all. And I'm using a horizontal version, which puts force laterally instead of vertically, which would prevent bending of the PCB. That's my take on it anyway. Connector will never be pulled on or subject to any kind of mechanical strain at all.

Regarding component sizes, excellent suggestion. I'll look into smaller components. I try to use the highest quality parts possible, so for example the capacitors are all C0G or X7R. I'll see if I can get them in smaller footprints.

I am no EE but I had read that putting power/ground on top/bottom layers and signal in internal layers was smartest. I see you managed to route on 2 layers only with the smaller components, so I'll have a rethink about it.

Thank you for catching a couple issues with the traces/vias. I put two vias on the power connector just for extra safety to make sure the power was getting through. Maybe that's overkill however.

Anyway, I'll see if I can make the project editable, although please don't feel you need to do anything further of course. But I do need to keep the PCB size the same so it fits into the current design. I could maybe make it a little bit longer:

Screenshot 2025-02-19 at 2.54.48 PM.jpg


Many, many thanks again for the sheer number of hours you have dropped on this. Honestly, you should be very proud of what you've done. And I'm so grateful to you for all your time and expertise.

I'll post back more later after I've taken in your suggestions further.

Thank you again!

Mike

PS: If you share your EasyEDA login name I can add you as a member of the project so you can edit it if you wish. Up to you. If there's another way to do it, I haven't found it yet. Thanks.
 
There is no reason why the enclosure cannot be modified to support the underside of the PCB (I assume you are 3d printing). You would have to leave a grove for clearance where the pins come through the underside of the PCB.
That's what I do on all my enclosures. The PCB sits onto a flat surface of the enclosure with relief for the pins sticking through. Obviously the relief does not have to look pretty it's covered up most of the time.
 
Thank you BriComp.

But it's not 3D printing. This is a sheet metal enclosure, aluminum 1.5mm.

It can still be done but I'm balancing a lot of factors. If I make the metal enclosure flange longer on the bottom to accommodate a larger PCB, then the base piece (not shown) becomes shorter due to the design, and I don't want to make the base piece too much shorter than it is. It's all interconnected.

I'm considering yours and @Pio's suggestions though.

I really appreciate it, thank you.
 
Thank you BriComp.

But it's not 3D printing. This is a sheet metal enclosure, aluminum 1.5mm.

It can still be done but I'm balancing a lot of factors. If I make the metal enclosure flange longer on the bottom to accommodate a larger PCB, then the base piece (not shown) becomes shorter due to the design, and I don't want to make the base piece too much shorter than it is. It's all interconnected.

I'm considering yours and @Pio's suggestions though.

I really appreciate it, thank you.
Ok, consider adding a 3d printed or other support. Such a support would be simple to design/print.
 
Excellent suggestion @BriComp. Thank you.

I'm just going to make the metal enclosure lower flange larger to accommodate more room and get closer to @Pio's design, which I think is terrific. That way there will be no need for additional support. It will involve redesigning the metal enclosure, which I was loathe to do, but I think it's probably a good idea.

I'll post back again with an updated design, but @Pio's design is already perfect for the generic case. I'll still post my updated one as a thank-you and also to get any additional feedback from anyone.

Many kind thanks to both of you.

Mike
 
I don't understand the use of D1 which seems to protect C6 rather than U1. Also why is there protection on the tip but not the ring of the jack?
 
Hi @MarkT , I'll let @Pio respond to your questions...I'm uncertain.

This is for @Pio: I think the NMJ6HCD2 connections are reversed on your PCB layout. From Neutrik website drawings:
Screenshot 2025-02-19 at 10.55.29 PM.jpg

From your excellent PCB:
Screenshot 2025-02-19 at 10.57.06 PM.jpg



Happy to be wrong, but I think they are reversed.

Thanks all,

Mike
 
Based on the good suggestions I have reworked the metal shell to allow for a better PCB. It's close in size to @Pio's PCB, although routing is different as I believe the component needs rotating 180° in his PCB.

Screenshot 2025-02-20 at 3.21.34 AM.jpg

Screenshot 2025-02-20 at 3.21.12 AM.jpg


Changed connector routings to match Pio's. I'm sure for the better to eliminate potential shorts if plug is plugged in backwards (however it is a keyed plug so should never happen).

Also found a small error in my schematic and fixed it. Placement of R7/8 was incorrect.

Corrected version:

Screenshot 2025-02-20 at 3.23.47 AM.jpg


Screenshot 2025-02-20 at 3.30.17 AM.jpg


Also have updated the shared design, now at V1.1: https://oshwlab.com/phillmj/universal-pedal-board.

Have moved main connector behind Neutrik jack and will be very stable for plugging in/out - issue of a bendy PCB solved.

Not certain about MarkT's concerns though; will await further feedback.

Thank you all!

Mike
 
I don't understand the use of D1 which seems to protect C6 rather than U1. Also why is there protection on the tip but not the ring of the jack?
D1 clamps the voltage coming into the opamp. For the ring, you are right, RC filter does provide some protection for the Teensy GPIO, combining R9 + Teensy's internal clamping diodes. I think, since there are two signals, i could throw an USB ESD protection chip there. The built it Zeners are usually 5V (USB VBUS) and won't do much in 3.3V, but it's a compact solution for two pairs of clamping diodes.

@Thundercat
No seeing the bigger pitcture i understand your design decisions. I don't think my version with components placed on the bottom side with work here. I'm afraid there is not enough space between the bottom pcb surface and the metal enclosure. 1206 caps might too high if you are plannig to use them.

2nd problem is the connector. Now it has to be on the top layer which either means a hand assembly or top/bottom load for the in house assembly - expensive.

I won't be able to edit your project, even clone it - don't have a PRO account unfortunately.

Regarding the capactor quality etc. For this applcitaction X7R are more than enough.

I am no EE but I had read that putting power/ground on top/bottom layers and signal in internal layers was smartest. I see you managed to route on 2 layers only with the smaller components, so I'll have a rethink about it.
Imagine troubleshooting such a board, a prototype, and a need to cut some traces to isolate a part of circuit. Or change something, add a series resistor, etc. I have seen that once (apart from multi layer PCBs where signals are often sandwitched between ground planes) where the designer was concerned about the IP of the circuit and wanted to hide the traces. Which would't stop someone trying to reverse engineer it anyway, maybe slow down only.
This circuit is a slow analog voltage, not even audio range, few buttons and ocassionally I2C. Would work perfectly fine on single a layer board and jumpers. Still, looking at your latest version, i wouldn't use the whole plane for 3.3V, preferably for GND, using traces for power and providing as much ground reference surface for all tracks as possible.

In fact if whole component NMJ6HCD2 is rotated 180° it will be correct...
Yes, my mistake. I took the default KiCad footprint whid does not have a clear mark where the jack input is and mixed them up. Good catch! Normally i use my own footprint with a clear arrow sign.

I'll try to post a new vesion soon. Meanwhile - new schematic / work in progress:
i have switched the single SPST for quad HC4066, using 3 of them to:
1. short the T+R in expression pedal mode
2. enable stronger pull up for the footswiches in dual footswitch mode

and the last one as transistor to invert the control signal.
expin_v3.png
 
Back
Top