I'm building a midi controller and was told that an OP-amp acting as a unity gain buffer could save my multiplexer from ESD and would also give a better signal since it buffer the current like and capacitor. The thing now is that I don't know how to make it work. When adding the LM324N I'm getting a constant value of 94-105 of 255, and no changes appear when I'm moving the 10k pot. I've also added a 10k resistor as feedback between the output and the negative input but no difference.
OP-amps are quite complicated as I understand it, but they do balance the + against the - input and makes an output somewhere in the middle right? It sounds wrong to me for this application, and it feels like my setup doesn't work as expected either. Shouldn't the value change as I change the pot?
Is there any better solution or am I just making it wrong?
And as well, is there any risk of over current with an OP-amp? I was searching and didn't find any answer on how much it accually amp the signal.
I can't see the circuit you are talking about - please post this.
Opamps are very simple - they change their output to make the two inputs have the same voltage (in
a valid circuit). There's no "somewhere in the middle", the output does whatever it needs to to bring
the inputs to the same voltage via the feedback network. If the feedback network divides the voltage
by 10, then the output will have to be 10 times larger than the other input - ie you have a gain of 10
If the feedback connection is direct to the inverting input, then the output has to follow the other
input exactly.
Yes, the opamp has a low output impedance (its voltage doesn't change when loaded, within limits).
Each opamp has a maximum output current it can drive, exceed this and it will stop working. Most are
tolerant of short circuits on the output (ie its not damaged). But each is different and the datasheet
is always where you go to to check these details.
This means that you lose 30% of your range (@5V).
I'm not sure why you need to buffer your multiplexers. Why are you so afraid of ESD damage?
Once you understand the basic rules of an op-amp, they are really not that complicated. The video I used for learning the basics: https://www.youtube.com/watch?v=7FYHt5XviKc
Imbecillen:
would also give a better signal since it buffer the current like and capacitor.
What is that supposed to mean?
As MarkT said, pleas post a schematic of your circuit.
I was told that instead of a capacitor before the mux I could use the LM324N to buffer the voltage, this would lead to a better signal without crosstalk between the channels in the mux and protect against ESD as well. So I thought it could be something..
But if it doesn't do any good for my design I could just skip it and use a cap instead. What do you think?
I don't have a schematic yet, but I'm gonna write one for you as soon as possible.
I think the best solution is a 100n cap to ground on each of the 16 inputs of each muxer, but not on the Arduino inputs.
A rail2rail opamp (not an LM324) between each muxer output an the Arduino analogue input could work.
But it will have problems of it's own, and I doubt if it's needed.
Shielded (audio) wiring might be wise if the build is not ending up in a metal enclosure.
Leo..
In that case I doubt anything is needed unless the pots are at the end of a long cable, 10k
pots are typically used so the impedance seen by the mux is at most 5k, which is plenty low enough.
It seems Imbecillen wants to use eight 16-channel muxers to select up to 128 pots.
That's a lot of area and a lot of wiring.
It might be wise to use some caps in strategic places.
Leo..
The answers seem to be as many as the people giving them..
I'm building the controller as a semi pro modell, so it will be dedicated PCB's designed for 16 pots and one mux each, giving it very short "cable" length and without traces going too much over each other. The controller will be designed pretty modular, so one PCB with 16 potentiometers will be two channels on the mixer. Then it's easy to do everything between 2-32 channels depending on what's needed in the enclosure, that btw will be metal.
It's supposed to be a solid piece made for live gigs and such, so it must be reliable!
With very short traces, is it still wise to use some caps? But maybe not one on each mux instead of each mux channel? The area will be around 25x40cm I guess..
If the op-amp isn't necessary I will go without, the less the better!
MarkT:
Yes caps are useful - when the pots get worn and scratchy the caps will clean up the scratchiness a lot.
Great, good to know!
Is it possible to mix buttons and potentiometers on the same MUX? It would be really great for my PCB design. But I'm not sure if the code is possible to solve if potentiometers VS buttons need a lot of different processing?
One thing that's a must is the ability to push multiple buttons at the same time, which should work as long as I make the design with a multiplexer right?
Yes, you can use buttons with an analog MUX, just do a digitalRead on the input pin instead of analogRead. It's just not a really efficient way of doing it, and I'm not sure if you can use the internal pull-up resistors through the MUX.
Another approach would be to use a button matrix (with diodes if you want to press multiple buttons at once). With N+M pins, you can read N*M buttons.
Or you could use parallel in, serial out shift registers and use SPI to read all button states at once, using only 3 pins, you can use a huge amount of buttons.
PieterP:
Yes, you can use buttons with an analog MUX, just do a digitalRead on the input pin instead of analogRead. It's just not a really efficient way of doing it, and I'm not sure if you can use the internal pull-up resistors through the MUX.
Another approach would be to use a button matrix (with diodes if you want to press multiple buttons at once). With N+M pins, you can read N*M buttons.
Or you could use parallel in, serial out shift registers and use SPI to read all button states at once, using only 3 pins, you can use a huge amount of buttons.
Pieter
Okey, thanks! My previous thought was to make PCB's like this, kind of modular. And connect every board with AVR cables to an extra PCB with the microcontroller, one 4067 for the buttons and two 595's for the leds on it. Is it the most efficient way to handle 16 buttons and 16 leds, or is there any other way? It's pretty annoying that the buttons and leds doesn't match the module concept.
My thought about combining the mux for buttons and pots may be good for the PCB design but it seems pretty hard to write the code. Sometimes potentiometers or buttons need different processing I guess. It can't be a good idea to merge the signal, and later in the code split it. It must be better to do it like I was thinking from the beginning.
I got a tip a while back about using a microcontroller on each module, it may be a solution for everything..
Wawa:
Did you miss that.
I also told you that an LM324 won't work.
Leo..
Oh, I forgot to be more clear about that the images are old and was my previous ideas. It was more to show the over all concept of modular thinking. I won't use the LM324.. I'm currently working on a new one that's more correct!
The 100n caps go from wiper to ground, not from pot supply to ground.
A decoupling cap from VCC to ground is also needed.
If you want more than one of these "modules", then you should also bring out the enable pin.
Leo..
Okey! Sounds pretty logic..
I thought the small caps replaced the decoupling cap, but it's simple to add it again.
What's up with the enable pin? I thought they all where supposed to go for ground, but you want it do connect to something else or each other? My previous prototypes with 2 muxes worked fine with E to ground. I haven't read too much about the E pin tho.
Imbecillen:
I thought the small caps replaced the decoupling cap, but it's simple to add it again.
What's up with the enable pin? I thought they all where supposed to go for ground, but you want it do connect to something else or each other? My previous prototypes with 2 muxes worked fine with E to ground. I haven't read too much about the E pin tho.
One supply decoupling cap for VCC of the chip, and as many wiper smooting caps as needed for the pots.
You don't need the enable pin (chip select) if you are connecting each board output to a separate analogue input.
That means that you can't use e.g an Uno (6 analogue inputs) for eight boards (128 pots).
By using the enable pin, and grouping four boards to one digital output, it is possible to use eight boards on four analogue inputs.
Leo..
I see! And that's also why I've been connecting the enable pin to ground, since I'm working with the Teensy LC which got 12 analog inputs. I should be able to make this project without using any E pin then hopefully.