hey everyone. so I'm a noob with this stuff but was trying to take on what is (to me) a pretty daunting and indepth project. I'm trying to make a usb-midi controller that will have 30 potentiometers and 15 buttons, along with (although this is less important) some small led strips inside the controller. so far I know I'm going to need more inputs than what the board (Leonardo, chosen for it's USBHID support out of the box) natively provides. in researching a workaround for that, so far I've discovered shift registers to expand digital inputs, and analog multiplexers to expand analog inputs. I guess what I'm initially wondering is, is there a way to mix these both together (expanding one set of inputs and then using those new expanded ports to expand the other set ) and is there any specific documentation anyone could point me towards that explains this specific process or something similar? my mental guesswork is that I would somehow do 4 x daisy chained 74HC165s together to get 32 digital outputs, and then use 10 of those digital inputs to expand to 32 analog inputs using 2 analog multiplexer breakout boards. leaving me with 22 free digital inputs and 32 analog. I haven't dug into the LED implementation aspect of this yet to know if that would leave me with enough inputs to control any of those, but that's just an afterthought for now until I can get everything else working.
I'm open to implementing these things in a different ways if need be/anyone has any better ideas or advice for me, but that's where I am as of now. any help is appreciated. thank you!
The HC165 allows to expand inputs, not outputs; so can't be used to control analogue muxes. But you can use the HC595 shift register to expand the number of outputs.
Alternatives to shift registers are I2C or SPI port expanders.
If you use addressable LEDs, it will only cost you one pin.
Be aware that a single led takes in principle 20mA. A USB port can only provide a max. of 500mA; you still need to subtract the current required by all other electronics to get to the current available for the LEDs. So you probably can control a maximum of 20 LEDs; note that a pixel in an addressable LED (strip) equals 3 (or 4) LEDs so you're limited to 6 pixels.
If you use an external 5V power supply, the sky is the limit ![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.