Core Electronics Forum

MIDI Marimba Controller

Hi there, I’m just looking into options for making a digital marimba, so I need a device that can take a number of inputs from piezo transducer discs (ideally 24) and convert them to separate midi notes, with the signals being velocity sensitive - so that it can control a midi marimba with 24 keys.

Haven’t worked with any electronics before and only basic coding, so couldn’t be anything crazily complicated.

Cheers!

Sam

1 Like

Hi @Sam126345

Welcome to the community.

A couple of things to consider. To get velocity information, you need to read analogue values, and convert them to digital. I don’t know of any microcontrollers with that many ADC circuits. Most max out at 3. You can buy ADC chips, so that can be overcome, but then you need analogue ports. Still too many for any microcontrollers I am aware of.

Next is the signal out of the piezoelectric device. This is usually a very low level, and would need amplification before going into the ADCs.

My suggestion is to search the www for someone who has already done this. That would give you a better starting point. Don’t limit your search to marimba, but use any of the related instruments such as vibraphone, xylophone, glockenspiel etc.

Hope this helps.

Also, what do commercial mallet controllers retail for?

3 Likes

Hi Robin,

Cheers for all this information. To answer your last question first, commercial mallet controllers retail for thousands of dollars.

I finally found some other projects like what I’m trying to do, looks like it is possible but slightly complicated with that number of keys - using a larger board can work like the arduino mega which has 16 analogue inputs, but others are suggesting using a multiplexer to get more inputs.

Here’s the best one I’ve found so far:

Thanks for your help!

Hi Sam,

You might be interested in this blog post I came across yesterday while looking at something else:

It’s awesome! We also had a really neat Midi Project (just an early draft) submitted yesterday which we’ll hopefully get up within a few weeks.

Regards,
Oliver
Support | Core Electronics

1 Like

Wow, thanks! That is next level!

This project example I found above is all based on an arduino mega, would it still work and interface with the same code to use the generic brand mega board?

Hi Sam,

Yes, the generic Mega2560 will work fine.

The hardware schematics for all Arduino products are open source, so anyone can make them. The only differences buying an official board are: you’re supporting the designers, Arduino only guarantee their boards will work with their software, and Arduino’s quality control is really good.

Regards,
Oliver
Support | Core Electronics

Great - thanks for clarifying that Oliver! I’ve read over all the arduino codes used in these projects and I understand that and I think I understand how to modify it for my needs - my real question is about the hardware now.

I see that using the mega board I could get 16 analogue inputs. Are all of those inputs usable for connecting an input such as a piezo pickup with a resistor in parallel? Otherwise I see that you can use multiplexers to get more analogue inputs - would there be any disadvantage to doing it this way?

What’s the difference between a multiplexer like this one:

and one like this:

I’ve also seen posts about using something called a ‘keyboard matrix’, but I don’t understand how it works very well.

Thanks!

Hi Sam,

Yes you could use all 16 inputs, but note that the Mega only has a single 16 channel 10bit ADC so it actually multiplexes the inputs. You probably don’t need to push the limits of sampling for what you’re doing, but if you find you do, it can be a bit of a learning curve.

The first product is just an IC, and it’s SMD so you’ll need to be fairly handy with your soldering skills and have a PCB to be mount it on to be able to use it. The second is an ADC already mounted on a PCB to make it much easier to use in a project.

The only difference between using the onboard ADC and an external ADC is how difficult it will be to implement in your code. Most external ADCs will have an Arduino library already though.

Keyboard matrices work the same way as the old telephone number dialing (except with voltages instead of dial tones). Have a watch of this, particularly the second half:

Regards,
Oliver
Support | Core Electronics

Thanks for that info on the multiplexers and keyboard matrices, I’ll check this out!

I’ve done more research and I’m keen to start trying out some things on a breadboard.

Starting off I want to try out one or two of the different elements including

  • A piezo pickup
  • A momentary push button
  • A linear rotary potentiometer
  • A 1/4" jack for input from a pedal

And then

  • A multiplexer board with multiple piezos

Most of the other projects I’ve seen have included resistors, and some have included diodes.

I’m having trouble establishing what a diode is doing in this scenario and if it’s necessary, and calculating the values needed for these and the resistors, since I can’t find any information about the voltage / current ratings of the piezos.

I’ve also seen other references to using a resistor with a button, but can’t find many examples in the projects I’m looking at, or information with the buttons about what kind of resistor would be needed etc.

Hey guys,

I’ve been doing a lot of prototyping and research for this project, and have solved lots of my questions - however I’m still having trouble with a couple of them - the main one at the moment being:

Using Diodes

It was trying to understand why people were using zener diodes in their piezo projects, I got the answer that it was about ‘over-voltage’ but no information on why some people use it and others don’t, how to calculate the values etc and how it actually works.

I’ve since found some great information about why people might use it:

Pins configured as inputs with either INPUT or INPUT_PULLUP can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V).

So that’s a great start, the I found some information that the Arduino boards have internal pin diodes that already protect them somewhat like this.

So now I’m guessing that why I’ve seen people use them with multiplexer setups, but often not when connecting piezos directly into the arduino, is because the multiplexer has no internal protection. Is that correct?

I’ve seen some people using schottky diodes and some using Zener diodes, from what I’ve read, I can see why a Zener is used for this exact purpose.

Voltage clamps: Limiting signals with Zener diodes

A varying analog signal can be constrained to a fairly narrow range of voltages with a single Zener diode. If you have a voltage that swings between + 7 V and – 7 V, you could use a single 4 V Zener, connected to ground, to ensure that the signal does not exceed 4 V or go below -0.7 V (where the diode conducts forward to ground).

If you wanted to constrain the signal to never go negative– e.g., for input to an analog-to-digital converter that accepts signals in the 0 – 5 V range, you could connect the anode of the Zener diode to a power rail at 1 V, instead of ground. Then, the output signal range would be constrained to the range of 0.3 V – 5 V.

https://www.evilmadscientist.com/2012/basics-introduction-to-zener-diodes/

So that sounds good. Since there’s only a 4.7 V Zener and a 5.1V Zener, I’m guessing that the 4.7 is better to use? However I don’t understand how you would connect the diode to a power rail at 1V to constrain the values to never go negative.

Additionally there’s this:

Zener diodes are manufactured with a wide range of voltages and can be used to give different voltage references on each half cycle, the same as above. Zener diodes are available with zener breakdown voltages, VZ ranging from 2.4 to 33 volts, with a typical tolerance of 1 or 5%. Note that once conducting in the reverse breakdown region, full current will flow through the zener diode so a suitable current limiting resistor, R1 must be chosen.
https://www.electronics-tutorials.ws/diode/diode-clipping-circuits.html

This is suggesting needing a current limiting resistor in series. The piezo circuits I’m building already feature a pull down resistor in parallel, do I then need both resistors in the circuit or will the parallel resistor achieve the same function?

I’ve seen some people just using 5.1 V Zener Diodes in parallel with a 1 mOhm parallel resistor as well, but I don’t understand why that would work in terms of the question above.

Would love some help if possible!

Cheers,

Sam

Hi Sam,

No worries, when working with passive components such as the Zeners and resistors you’re describing and combining them with microcontrollers I find it’s always easier to understand when you look at the exact functions of the components individually, with the Zener limiting the voltage in this case based on direction, and the resistor limiting the maximum current that can be passed through the circuit that they’re on. Basically, you just need to ensure that no matter the power supply that’s being used the ‘actual’ voltage and current that is being passed through the Pi doesn’t fall outside the tolerances of the microcontroller, that’s what’s being described in the diode clipping article that you’ve linked (however, more generally ofcourse).

https://www.electronics-tutorials.ws/diode/diode-clipping-circuits.html

Please let us know if you require any further assistance!

Bryce
Core Electronics | Support

1 Like