Midi controller for el-guitar pedal board; arduino, pi, or something else?

I am making a midi controller for a electric guitar pedal board.

The idea is that the midi controller will have a library of banks, as well as a set list. I'm trying to implement the library as just an array holding C++ objects of the type Bank. The set list will point to specific banks I need when playing whatever set of songs I'm playing. This is so that I can quickly toggle between the relevant banks when playing or whatever.

A bank has a name, stored in a string, and the possibility to store midi commands. You can store the midi commands in 4 locations in a bank, the A, B, C, and D location. Each location can hold multiple midi commands. A midi command is a class of its own as well, but I can't detail it yet. Each location will have a name as well, e.g. verse, chorus, bridge etc.

I have 4 switches that enables me to toggle the banks, and will enable me to send the midi commands stored at either the A, B, C, or D location of the current bank.

I will also have a display showing the current bank, with the bank name, the bank locations, and the number of the bank in the library. The number of the bank is probably it's index in the library + 1, just to account for the array index starting at 0.

The idea for loading the library is just to read it of an SD-CARD at startup. It will be stored in some format that I'll parse. When or after reading the data, I will use it to initialize the banks in the library, the midi commands in them etc.

I was wondering if using all these strings, as well as reading all the data of an SD-CARD would make this project more fit for a raspberry pi? That would give me the option to make it do more things at once as well. I was also thinking about adding the option to add and delete banks runtime, which I think isn't optimal for the arduino. But, the Pi is a computer, and I will pulling the plug on the pedal board, and this is not optimal for the pi, I've understood you should shut it down via a command, not just pull the plug.

Would the arduino be a better fit after all?
Can anyone potentially recommend another board for this?

I think that a Pi would be overkill. This is some pretty basic stuff, so an Arduino should be able to handle that. Parsing long strings could be a problem indeed, but with some clever programming and library layout, it should be alright. If you need more memory, you could always use a more powerful board, like an Arduino Zero or a Teensy. Or maybe an ESP8266, this will let you change settings using your phone, or upload new presets from your laptop etc. It has only 11 I/O pins however.

Hope this helps!
Pieter

Thanks you, PieterP!

I guess for the library array I could figure out how much memory I can allow it to use, and allocate that at compile time.

By ESP8266, do you mean this?

That options sounds interesting. If I could use my phone to upload new presets, that would nice :slight_smile:

I was wondering if using all these strings, as well as reading all the data of an SD-CARD would make this project more fit for a raspberry pi?

The problem with the Pi is that the serial connector can't be run at the MIDI speed so at best you will need a USB to MIDI converter lead.

_ptf:
By ESP8266, do you mean this?
ESP8266 - Wikipedia

Yes, that's it.

It's a WiFi radio and a microcontroller combined, and you can program it using the Arduino IDE, just like a regular Arduino. It also has a lot more RAM available, and between 0.512 and 4MB of flash, which is plenty to save your presets and even a full web interface (HTML+CSS+JavaScript files) to change the settings. You could just set it up as a WiFi hotspot, connect your phone to it, open the page in a browser, and control your presets, or even send more advanced MIDI commands to your FX pedal, or whatever gear you're using.

Pieter

Grumpy_Mike: So I would have trouble sending MIDI signals with a pi anyway?

PieterP: That really neat. I know my way around creating web pages, so I'll give it a shot. Do you have a micro controller with this chip to recommend? There seem to be at least a couple around, like sparkfun and adafruit.

_ptf:
PieterP: That really neat. I know my way around creating web pages, so I'll give it a shot. Do you have a micro controller with this chip to recommend? There seem to be at least a couple around, like sparkfun and adafruit.

The chip ís the microcontroller. I've used the modules by AIthinker, since they're small and cheap. But they don't have USB communication, no on-board 3.3V regulator etc. so I wouldn't really recommend that. There's the WeMos D1, SparkFun ESP8266 Thing, Adafruit HUZZAH, NodeMCU ... Just pick one that you like, but check to see that all GPIO pins are broken out, and decide if you want an external antenna or a PCB type.

Pieter

Sorry to hijack this thread, but I'm going to be following with keen interest as I'm trying to make one of these myself :slight_smile: Best of luck to the OP, maybe we could help each other over time.

ChrisFrost: Please do :slight_smile:
PieterP:
I can get both of these from stores in my country.

I'm tempted to go with the NodeMCU, because it seems like it has more pins (hmm, or maybe it just has 9), and it is USB powered. The pins aren't broken out, though. Think that'll be a problem?

I could get the wemos d1 as well, but I might have to order that from another country. But 11 pins would be nice.

I might be able to get by with 9 pins. I need 4 pins for the buttons, and 2 (I have a i2c / SPI character LCD backpack) for the screen. Not sure if I need an SD-CARD if I have 4MB of storage, so maybe I can skip connecting the SD-CARD reader.

Broken out just means that a certain pin of the chip is accessible on the headers of the board. For example, the ESP-01 module has the same exact ESP8266 chip with the exact same GPIO pins, but only three of these pins can be used, since there are only three GPIO header pins.

The Adafruit board is not ideal, because you need a USB to Serial adapter to program it.

The NodeMCU has 11 GPIO pins (D0-D10). Pins GPIO3 and GPIO1 are used for communication with the computer and for programming. Pins GPIO4-5 can be used for I2C.

For MIDI, I think you could either use GPIO1 or GPIO2 (Serial and Serial1 resp.)

You could use pins GPIO12-15 for your 4 buttons.

Pieter

Grumpy_Mike: So I would have trouble sending MIDI signals with a pi anyway?

Yes.

The other thing you have to consider with the ESP8266 chip is that it only a 3V3 system so you can't use the normal MIDI interface circuits for the MIDI send because basically MIDI is a 5V system. You need an extra transistor or two to make a serial output into a MIDI one.

PieterP: Ah, ok. Thought broken meant that they weren't in the board. Thanks for the tips in the pins, that will come in very handy! I'm not experienced with electronic, so I'm happy for all the help I get :slight_smile: I didn't know that i2c had to be at certain pins, and neither Midi.

Grumpy_Mike: Thanks! I hadn't thought about that. I checked the LCD screen as well, and it is 5v too. As I said above, I am not experienced with electronics, so this is very helpful! :slight_smile:
Could I power the LCD of the Vin pin?

I found this level converter: https://www.sparkfun.com/products/12009
Something like that might work.
Or maybe this: 74AHCT125 - Quad Level-Shifter (3V to 5V) [74AHCT125] : ID 1787 : $1.50 : Adafruit Industries, Unique & fun DIY electronics and kits, but it is 3v to 5v. Does it matter?

Note that a level converter is for logic signals only, not thee power supply.

Could I power the LCD of the Vin pin?

Probably not unless the Vin pin has 5V on it.

Maybe the easiest is to get a microcontroller with 5v and more memory than the arduino. I'll have to convert the i2c signals to 3.3v as well.

Would I be able to use a 5v USB power source, use the Vin pin for 5v power, and convert the logic signals to the midi and i2c?

_ptf:
Maybe the easiest is to get a microcontroller with 5v and more memory than the arduino. I'll have to convert the i2c signals to 3.3v as well.

I2C uses open-drain outputs and pullup resistors, meaning they only pull pins low. A 5V I2C device will never put 5V on its I2C lines.
This means that it won't damage the ESP.
On the other hand, you'll have to check the datasheet of your display to make sure that the voltage of a digital high is lower than 3.3V.

If that's the case, you won't need level shifting.
Otherwise use level shifting: I2C level shifting.

3.3V may work for MIDI too. According to a 2014 update to the official MIDI specification:

When the MIDI 1.0 Specification was written, 5-volt signaling was the industry standard for electronic circuits.
The standard MIDI transmitter circuit in the Specification requires the use of 5 volts. However, today’s
industry standard is 3.3 volts, so there is a significant advantage in cost and complexity of newly-developed
devices to adapt the MIDI transmitter circuit for 3.3-volt signaling.

Even if that doesn't work, a level shifter is really easy to add.

_ptf:
Would I be able to use a 5v USB power source, use the Vin pin for 5v power

Yes, you can do that.

Pieter

You can't put 5V on Vin, that feeds the 5V regulator, the resulting output makes things marginal.
Apply 5V to the 5V header for 5V power.

PieterP:
I2C uses open-drain outputs and pullup resistors, meaning they only pull pins low. A 5V I2C device will never put 5V on its I2C lines.
This means that it won't damage the ESP.
On the other hand, you'll have to check the datasheet of your display to make sure that the voltage of a digital high is lower than 3.3V.

If that's the case, you won't need level shifting.
Otherwise use level shifting: I2C level shifting.

I've looked in the datasheet, and the only thing I see is that its operating voltage is 5v.
This is the sheet (if you're interested): https://www.kjell.com/no/.mvc/Document/File?id=9cb9ac6f-7c6a-495a-beac-a651007f182a
It's only one page. I haven't really learned to read datasheets, though.

PieterP:
3.3V may work for MIDI too. According to a 2014 update to the official MIDI specification:
Even if that doesn't work, a level shifter is really easy to add.

I guess I'll have to check what kind of voltage the midi in my pedals run on.

I did some quick reading on i2c and spi (very quick reading haha). I also found this, https://www.sparkfun.com/products/12009, which I can use to level shift the voltage. Seemed simple enough, yeah.

Would it be ok to use the same ground for 5v and 3.3v? If the voltage is measured with the ground as a reference, shouldn't they have the same reference?

CrossRoads:
You can't put 5V on Vin, that feeds the 5V regulator, the resulting output makes things marginal.
Apply 5V to the 5V header for 5V power.

I was looking at this, and I could't see any 5v pin.
Then I looked at this, that one seems to have a 5v pin. Maybe I could use the last one then, if the Vin is out of the picture.

CrossRoads:
You can't put 5V on Vin, that feeds the 5V regulator, the resulting output makes things marginal.
Apply 5V to the 5V header for 5V power.

There's no 5V regulator on a NodeMCU, Vin goes straight to the 3.3V regulator.

I found this article that says:

Connect the VCC pin on the LCD display to the VIN pin on the NodeMCU. The VIN pin on the NodeMCU is tied directly to the 5V pin on the incoming USB port. If you plan on powering the NodeMCU with something other than USB, you'll have to find another way to provide 5V to the display.

So, it should be alright? I think I'm starting to get the picture of how I need to do this. The help from all of you is very appreciated.