I have an input signal which is about 0,21v at max. I want to use the arduino to read it, right now I have it set to internal reference so it can but not accurate.
My tough was to use a opAmp so i bought a LM1458N. The problem is using it. I guess i want non inverting, but how can i limit it to 0-5v?
The signal comes from a ultrasonic transducer btw.
I have an input signal which is about 0,21v at max. I want to use the arduino to read it, right now I have it set to internal reference so it can but not accurate.
My tough was to use a opAmp so i bought a LM1458N. The problem is using it. I guess i want non inverting, but how can i limit it to 0-5v?
The signal comes from a ultrasonic transducer btw.
5V / 0.21V ~ 23.8
So use a gain of less than or equal to 23.8 and your output will not exceed 5V. Of course that will not work with the 1458 which can not approach its supply rails, so you would need to power the 1458 with greater than 5V (progrably at least 6-7V) to get 5V out and if you want 0V (or less than about 1V?) you would need a bipolar supply as well.
Inverting, non-inverting, it makes no difference. At the end of the day you just end up with a number.
The simplest circuit for a non-inverting amplifier is:
Your signal comes in to the non-inverting input. Between the output and the inverting input is resistor - R2. The inverting input is connected to ground via resistor R1.
The amplification ratio (gain) is given by 1+(R2/R1), so the output voltage is the input voltage multiplied by that ratio: Vo = Vin*(1+(R2/R1)).
You can use simple high-school maths to rearrange that to get some sensible values for R2 and R1. Here's a clue: pick a common value for one of the resistors and calculate what the other should be - see if you have something close in your box. If not, try another common value. You don't have to get all the way up to 5V - you just want to get it higher than you have at the moment.
You want a signal which at maximum is 0.21V to be at maximum 5v. So that means you need a gain of 5/0.21 = 23.8, which is easily achieveable with an op-amp.
This can be made using standard resistor values of:
R1 = 10k
R2 = 220k
which would give a gain of 23.
As long as the op-amp is capable of reaching its supply rails, that would work. However, generally they are not - so a 5v supply would not yeild a maximum output of 5v.
You could combat this by using amplifying the signal to say 3.3V and then setting AREF to 3.3V.
That would need a gain of 15.7 which can be achieved with:
R1 = 10k
R2 = 150k
O one more thing. There is two OpAmps on the IC, would it be a good idea to run it trough both of them. I mean with lower gain, to get higher bandwidth?
Do you need more bandwidth? Is the Arduino even capable of keeping up anyway?
That chip has a 1MHz unity gain bandwidth product.
That means, at a 1:1 gain (no amplification) it has 1MHz of bandwidth. The bandwidth falls (roughly) in proportion with the gain.
So, a 10x gain would give 100KHz of bandwidth.
15x gain would be around 66KHz of bandwidth. That's still plenty for a lowly Arduino to keep up with. Now, if I were using a dsPIC sampling at 1.1Msps, then yes, I'd be thinking about more bandwidth (and a low noise, high speed op-amp).
In op amps without rail-to-rail capability there is a problem with signals near ground as well as near Vcc (ie 5V) as well. In general for work with microcontrollers, it is best to select op amps with both single supply capability as well as rail-to-rail capability. They don't cost much (if any) more than the older style of op amps, like the 1458.
An LMC622 is a dual pin plugin rail to rail part that will include both the supply and ground rails in it's input circuit, that is you can operate the inputs right to ground or to within millivolts of the positive rail, it can even be used to the positive supply rail without drawing unusual input currents or latchup... I used them for years... Great old part.