While I'm waiting for my orders of new components to arrive I made some tests with a lm358 powered from a 12V single supply.
I have never used op-amps before just read about them.
I wanted to turn a sine wave signal of approximately 3-8V to 0-5V.
I used 5V as input to the "-" terminal and the 3-8V signal as input to the "+" terminal (all resistors was 10K).
The output I got was a sinewave of approximately 0,5V to 3V. I wanted a 0-3V signal but understand that the lm358 is not a "rail to rail" op-amp.
So the result was what I expected.
Then I used the output of the fist op-amp as input to another op-amp.
Put the output to the "-" terminal and the 3-8V signal as intput to the "+" terminal.
I expected a output of a sine wave with a voltage of 0,5-5,5V but got a ugly "half sine wave" (voltage 1,68V -> 5,5V).
Am i thinking wrong?
I want a way to transform a signal with a variably voltage and offset to a 0-5V signal.
E.g 3-8V signal and 5V -> "differential amplifier" -> output and 3-8V signal -> differential amplifier -> 0-5V signal output
olof_n:
I attach a drawing I made in Powerpoint
Hope I got everthing right. All resistors are 10K.
Edit: IN- on the first op-amp is 5V.
No, that's a wiring diagram, I meant a circuit diagram with opamp symbols
Anyway looking at it there's at least two problems. The LHS opamp is a voltage
divider followed by a voltage follower (not a differential amp).
The second (RHS) opamp is a differential amp, taking the difference between your
sine wave input and the output of the LHS opamp (which itself is a reduced version
of the sine wave input).
Thanks for you'r answers.
To me the LHS and RHS looks the same, only the IN- differs
Do you have any idé how it should be wired to work? (if it is possible with a dual op-amp)
" difference between your sine wave input and the output of the LHS opamp" - If that worked the output of the RHS should be a sine wave of 0,5V and 5,5V ( If I'm thinking right).
The output of the LHS opamp is a nice sine wave of 0,5V to 3V.
Yes that is a bit of an odd circuit for what you want, basically you have two differential amplifiers with one input connected to ground. In your case the ground is going to be 5V.
Read this:-
Remember the ground symbol here will represent your 5V.
Am i thinking wrong?
I want a way to transform a signal with a variably voltage and offset to a 0-5V signal.
E.g 3-8V signal and 5V -> "differential amplifier" -> output and 3-8V signal -> differential amplifier -> 0-5V signal output
Yes you are thinking wrong.
When you connect the input to 5V that is actually becomes your signal ground and your -8V is lower than the op amp's power supply (always a bad thing).
I need to know more about the nature of this input sin wave, like what it is referenced to with respect to you 12V supply and your arduino. You need to reduce the amplitude as well as supply a shift but if your signal is -ve with respect to the ground on your supply and arduino you can not do it like this.
It's for my function generator that I am building.
I have a XR2206 chip that outputs all common wave types (sine, tri, saw, sqaure).
The problem is that the sine wave and triangel wave have different voltage levels.
I would like to find a way to dynamically convert the signals to 0-5V.
The Arduino is only measuring the frequency of the square wave output which I convert to 0-5V with a transistor.
The Arduino is only measuring the frequency of the square wave output which I convert to 0-5V with a transistor.
So is this translation simply for the arduino?
If so then there is no need to preserve the waveform, simply put it in the base of a transistor ( through a resistor ) and have the emitter to ground and the collector to a digital input. Enable the internal pull up resistors.
That will allow you to measure the frequency of much faster waveforms than reading the analogue port. measure the time between successive rising edges an take the reciprocal to get the frequency.
No, the translation is not just for frequency measurement. I just wanted to describe the "Arduino part" of my project.
The measuring part works perfectly, it is done.
I want the output of all wave types to have a voltage level of 0-5.
So is it possible to convert the sine wave/triangle wave output to 0-5V with a op-amp?
I'm also interested in if it is possible to convert a variable voltage signal (sine/tri have different voltage level) to 0-5V with just a dual op-amp.
If you want a differential amp you must connect both inputs to voltage sources (low
impedance). The circuit output difference (opamp output - ground) is then equal to
the difference in input voltages. But you must drive it from low impedance.
If you leave one input unconnected you have an entirely different circuit.
If you have a high impedance source you'd better use a non-inverting stage first,
this is the only opamp configuration with high input impedance..
Perhaps your circuit needs a mid-rail virtual ground? Most opamp circuits do.