MIDI controller power need

Status
Not open for further replies.

ozlow.own

Member
Hi everyone!

A question which has never done before (I know, forum is full of threads like this. However, I need some advices before working on the PCB).

I want to build a MIDI controller with a Teensy LC. It has 4 fader, 16 knobs, 16 buttons, 16 Neopixels (under the buttons). The only limitation I have is that everything should be only USB powered - no external supplies.
To lower pin count, i will use 74HCT4067 powered from 5V(VIN) pin.

16 pots (10k, connected between 3.3V and GND) ---> middle pin connected to a 74HCT4067 ---> 4 address pins (DIGITAL) to Teensy + analog pin for mux output (ENABLE pin of the MUX shorted to GND);
4 faders (10k, connected between 3.3V and GND) ---> middle pin connected directly to Teensy analog pins ---> 4 Teensy pins (ANALOG);
16 buttons (will use the Sparkfun silicone button pad, one side to ground) ---> other side connected to a 74HCT4067 ---> same 4 address pins (DIGITAL) to Teensy + digital pin for MUX output;

Estimated power consuption of pots and faders = (3.3v/10kohm) * 20 = 6.6mA.
Total pin count = 5 analog pins + 5 digital pins (YAY).

No problems whatsoever. Teensy LC should be fast enough to scan all every cycle and read the status of faders, pots and buttons and send/recive MIDI messages.

The problems comes with the LEDs. I'd like to use some WS2812b because they will fit nicely under the buttons silicone pad. Also, they use one digital pin for control (not running out of pins on the Teensy actually, but I like to have spare room for future improvements) and if i use pin 17 i don't even need a level shifter.

The LEDs should be connected like this : LED 5V to VIN pin, LED GND to GND pin, DATAIN to pin 17.
EtEtp.jpg
The 16 LEDs will not be on all at the same time (a max of 12 LED at the same time), but for a worse case scenario, let's assume 16 LEDs on.
They will not be on at max brightness and i will only use primary or secondary color (1 or 2 led on at the time, so 1/3 or 2/3 of estimated current).

The LEDs with full brightess, white (all 3 colors on), consume about 60mA. But, in my case, they will not consume 60 mA. Let's assume 20mA per LED (which seems to be a real world standard estimate), so a total of 320mA.

The specific question is: is USB power enough for powering all without a problem?

I am a newbie, so if anyone finds any error (not only about LEDs) please let me know!

I will attach later a detalied schematics but it's a pretty standard wiring.
 
First: Be careful, the Teensy LC pins are not 5V tolerant!
This is especially relevant if you power the analog multiplexers from 5V. They can then deliver 5V pullup voltage and 5V overshoot signals to the Teensy LC, which will instantly fry it.
Better power everything from 3.3V, except the Neopixels from their special port.

The project can draw up to 500mA from the USB port. That would be totally within specs. Due to the inefficiency of voltage regulation, I'd suggest to draw not more of 80% from this and calculate 3.3V as 5V to be on the safe side. It looks like the project will work reliably, if you do not light up the LED at full power. They will be way too bright anyway to serve as panel LEDs, if you drive them more than 20%, well actually depending on how you mount them. But energy is best saved, before it is wasted by bad design. :cool:
 
I forgot: If possible, add 6.8k and 1k resistors to both ends of your 10k pots and faders, so to get a full readout over all positions of the pot or fader.
3.3V->6.8k->pot->1k->GND
That is, because the multiplexers are not really rail-to-rail and so is the ADC not really rail-to-rail, but 2.56V to 0V with some non-linearity at the edges.

Edit: With the 6.8k you get up to 2,05v signals. You could also use 4.7k or even 3.3k to get the most out of the ADC resolution, depending on how exact the 10k rating is. Usually pots and faders have high tolerances there, so I prefer the 6.8k to be on the safe side. Also, it could add even more floor lift to use 2.2 resistors instead of the 1k, if the pot is way longer than 10k. Just check what works best for your design.
 
Last edited:
First of all, thank you for your reply!

I can't power the HCT from 3.3V because it's not in spec. Checking the datasheet, it says: "4.5V to 5.5V operation". So 3.3V it's not suitable.
I also found on Teensy page about MIDI library:

"For newer Teensy boards with 3.3V signals, 74HCT4051 chips are best. Power the 74HCT4051 from 5V.", so I guess 5V is the way to go. Also because i suppose MUX works wiring the selected port to the common in/out so, as long as you don't have 5V coming from the pots or the buttons (that's why i'm powering them with 3.3V) you shouldn't have problems. That's my guess tho.

Good news on the power side, yay!

About resistor on pots: it seems reasonable. Just one thing: to decrease the number of components, it is doable adding just one 6.8k and 1.1k resistor for all the pots (as long as i power all of them from the same trace, sure)?
 
HCT, oh yes, use HC instead. Forgot to mention that, sorry.
If still hanging on HCT, at least use 330R resistors on all signal lines connecting to the teensy to limit currents in case of failure.

Regarding the pots and faders:

If you use just one set of resistors for all, you risk crosstalk between the channels, extra noise from the sampling distributed over all channels. Also, the values of those resistors would have to be recalculated. All the pots and faders in parallel would form a new resistor that changes, as soon as you add or remove a pot or fader. See this:
https://www.kitronik.co.uk/blog/how-to-calculate-resistors-in-series-and-parallel/

If you use individual pairs of resitors for each pot, all line crosstalk is dampened by the power supply, rendering precise and stable readings.

One might consider to add capacitors across the network to dampen crosstalk, but that would involve even more components and complexer routing (must keep two additional rails going), still delivering poorer signal quality than with just using idividual resitors.
 
Last edited:
What's wrong with powering a mux at 5v for a voltage divided signal. Where is the overvoltage risk coming from?

I've had very little experience with mux but I didn't find a need to pad the dividers to get full readings and you can fix problems like that in software.
 
Every IC can leak voltage and current, especially in case of failure. So the overvoltage risk is at the digital control pins. Also, a MUX is a switch, wich acts on FET. A failure there can leak Vcc to the output. Switching can produce transients. There could be overvoltage on the input, which would not be clamped to 3.3V but instead to 5V, and handed over to the output.

If a pot as a voltage devider selects between 3.3V and GND, but the ADC has a range of 2.56V to GND, then there is a sector in the pot that does just deliver overflow readout, because it is above the range of the ADC.
So to extend the voltage devider at the upper end makes sense, so that all position of the pot deliver output voltage within the range of the ADC. As the ADC and MUX have non-linearities at the lower end as well, it makes sense to lift the lower end of output voltages above that.
 
I realized 'fixing in software' is was wrong right after posting - if it's clipped it's gone and you have a dead zone on your pot you cannot map to anything.

That said I'm still a bit sceptical.

I've just not seen anyone suggest MUX can't operate accurately near supply rails AND that at 5v MUX could fry an input despite the input signal never going out of range.

I'm certainly not qualified by either experience or training to disagree but I'm puzzled why you're the first person I've heard suggest this was necessary.
 
Read the f*ing datasheet!

Do not take the risk of failure, even if the shareholder demands for it.
 
I'm certainly not qualified by either experience or training to disagree but I'm puzzled why you're the first person I've heard suggest this was necessary.

I second this. Never heard about it. Anyway, that seems reasonable. Probably it's not necessary but I guess it's a good thing try to protect the most expensive component in the circuit, right? And it's not a huge part increase, I will give it a go.
I'm trying to find some numbers on the ADC part. The 2.56V you mentioned it's about the Teensy 2.0 and it's mentioned here. I can't find anything about the Teensy LC.
 
All my usual 'not an EE' caveats; but as I understand it the internal reference is optional way to measure when you are interested in the absolute voltage of a signal ...when you use it the range is reduced.

On the T3.x the internal reference is only 1.2v but it's not relevant.

For a voltage divider you want the relative position of the pot which is better represented by the relative reading if the supply varies.

The mux sheet doesn't report on resistance stats below 4.5v supply which does suggest poor performance is likely at 3.3v but I really doubt running it at 5v is actually at problem.

But then I'm not an electronical engineer and make no guarantees.

Over not out ;)
 
Status
Not open for further replies.
Back
Top