ADC input works with potentiometer but not with AC signal from sensor!!?

ericgibbs

Joined Jan 29, 2010
18,849
hi,
The LM324 when working with a 5V supply is unable to swing to 0Vout or to 5Vout
Check this d/s, the Vout will limit at Vs-1.5v, with a 2K load.

E
AA1 14-Sep-18 19.15.gif
 

Attachments

Thread Starter

ashokraj

Joined Feb 1, 2018
137
Gentleman, Thanks for all the inputs after reading your feedback I realized i will have to select the right kind of operational amplifier, proper load to op amp, also I will have to drive the input( output from op amp) to STM32 ADC terminal properly. For few days I will concentrate on how to select the right op amp, and then signal driving to ADC input terminal. If by any chance if you have done/ seen any circuit diagram involving opamp and stm32 adc terminal feel free to post. Thanks !!!
@ericgibbs , @OBW0549 , @ebp ,@Walter Literowich , @bertus
 

KeithWalker

Joined Jul 10, 2017
3,093
Can I use LM324 in place of MCP6001/02?
The problem is that you are trying to read the AC output signal from the transducer with a DAC which measures DC. You will have to sample the input to the DAC at at least twice the frequency of the highest frequency signals from the accelerometer to get an accurate digital representation of the signal.
 

Reloadron

Joined Jan 15, 2015
7,517
Way back in the beginning you mentioned:

he source driving is output from signal conditioner which provide a constant power to industrial accelerometer. http://www.pcb.com/products.aspx?m=482c05
So you have a Four-channel, ICP® Sensor Signal Conditioner which is designed for use with your accelerometer. You have a single axis accelerometer which looks like this:

Accel2.jpg

Your amplifier designed for use with your accelerometer has gain settings which you set based on your sensors sensitivity.
  • Sensitivity: (±20%) 500 mV/g (51 mV/(m/s²))
Most accelerometers like this ship with a data sheet (Calibration Data) giving you the actual data for your specific accelerometer by serial number. You can use the manufacturers amplifier of you can roll your own as you have been doing using an LM324. The output of your accelerometer is an AC signal proportional to the force (bang) applied to your accelerometer used to measure vibration or shock. Frequently this signal is what is called "Random Vibration" of mixed frequencies and amplitudes. Now as was pointed out since the signal from the accelerometer is an AC signal you need to amplify an AC signal. Using a single supply LM324 you need to offset the output which has been pointed out and explained. With a 5.0 volt supply if you offset with 2.5 Volts I believe you will still have problems. Here is why. Your sensor is a +/- 10.0 G sensor with a sensitivity of 500 mV/G. With only 5.0 G applied your signal out will be 2.5 Volts and that is an AC peak.Your operational amplifier circuit with a 2.5 VDC offset will be clipping

Your signal should look a little like the below image:
Fan Off To High Speed.png

The above vibration signal is an example measuring vibration with a signal axis accelerometer placed on a simple floor fan.

Vibe Fan 1.png

So you need to consider the sensor's sensitivity when amplifying the output and since you have 500 mV/G you may want to setup something similar to the above and just look at the accelerometer output on an oscilloscope. Use the X1 gain setting of your signal conditioner or just connect your accelerometer out directly to you scope and tap your accelerometer.

Ron
 

Thread Starter

ashokraj

Joined Feb 1, 2018
137
Way back in the beginning you mentioned:



So you have a Four-channel, ICP® Sensor Signal Conditioner which is designed for use with your accelerometer. You have a single axis accelerometer which looks like this:

View attachment 159941

Your amplifier designed for use with your accelerometer has gain settings which you set based on your sensors sensitivity.
  • Sensitivity: (±20%) 500 mV/g (51 mV/(m/s²))
Most accelerometers like this ship with a data sheet (Calibration Data) giving you the actual data for your specific accelerometer by serial number. You can use the manufacturers amplifier of you can roll your own as you have been doing using an LM324. The output of your accelerometer is an AC signal proportional to the force (bang) applied to your accelerometer used to measure vibration or shock. Frequently this signal is what is called "Random Vibration" of mixed frequencies and amplitudes. Now as was pointed out since the signal from the accelerometer is an AC signal you need to amplify an AC signal. Using a single supply LM324 you need to offset the output which has been pointed out and explained. With a 5.0 volt supply if you offset with 2.5 Volts I believe you will still have problems. Here is why. Your sensor is a +/- 10.0 G sensor with a sensitivity of 500 mV/G. With only 5.0 G applied your signal out will be 2.5 Volts and that is an AC peak.Your operational amplifier circuit with a 2.5 VDC offset will be clipping

Your signal should look a little like the below image:
View attachment 159942

The above vibration signal is an example measuring vibration with a signal axis accelerometer placed on a simple floor fan.

View attachment 159943

So you need to consider the sensor's sensitivity when amplifying the output and since you have 500 mV/G you may want to setup something similar to the above and just look at the accelerometer output on an oscilloscope. Use the X1 gain setting of your signal conditioner or just connect your accelerometer out directly to you scope and tap your accelerometer.

Ron
Thanks for the detailed explaination. I will try what ever is recommended by you. I would like to add one point that, I am getting a similar signal from the oscilliscope of what ever is shown in the above picture. My only problem is the signal is not getting driven to STM32 analog input pin the same way. i.e., if i do not connect to the analog input pin and measure the output across the capacitor and ground it works!! below schematic.
https://drive.google.com/open?id=10FeMGhZmuvYHY8jgEu6LIBO_OmTPIElD

but once I connect the output from capacitor to PA1 and measure the signal across PA1 to ground then it gives an incorrect measurements i.e., for example if before connecting to PA1 and when I measure the voltage accross capacitor and ground, voltage would be fluctuating around supply voltages(5 Volts) of Opamp ( AN AC signal while vibrating) but once i connect the output from capacitor to PA1 and measure the voltage across PA1 to ground it differs. All the experts, your feedback helps me to understand why it didnt work. I willl rework, rewire, and will keep some load at the output of opamp and will keep on retrying.
 
Last edited:

Thread Starter

ashokraj

Joined Feb 1, 2018
137
The problem is that you are trying to read the AC output signal from the transducer with a DAC which measures DC. You will have to sample the input to the DAC at at least twice the frequency of the highest frequency signals from the accelerometer to get an accurate digital representation of the signal.
Hi Keith, I ensured the sampling rate is 4KHz because the maximum frequency component in my signal is around 2KHz.
 

Reloadron

Joined Jan 15, 2015
7,517
Thanks for the detailed explaination. I will try what ever is recommended by you. I would like to add one point that, I am getting a similar signal from the oscilliscope of what ever is shown in the above picture. My only problem is the signal is not getting driven to STM32 analog input pin the same way. i.e., if i do not connect to the analog input pin and measure the output across the capacitor and ground it works!! below schematic.
https://drive.google.com/open?id=10FeMGhZmuvYHY8jgEu6LIBO_OmTPIElD

but once I connect the output from capacitor to PA1 and measure the signal across PA1 to ground then it gives an incorrect measurements i.e., for example if before connecting to PA1 and when I measure the voltage accross capacitor and ground, voltage would be fluctuating around supply voltages(5 Volts) of Opamp ( AN AC signal while vibrating) but once i connect the output from capacitor to PA1 and measure the voltage across PA1 to ground it differs. All the experts, your feedback helps me to understand why it didnt work. I willl rework, rewire, and will keep some load at the output of opamp and will keep on retrying.
Long ago I did a few circuits using an accelerometer like those I pictured to sense a bang or shock. I finally started using an IA (Instrumentation Amplifier) with a dual supply. Following that I simply placed a diode at my IA output. I used the Analog Devices AD524 in many applications mostly for its low noise and programmable output. Unfortunately it is a pretty expensive IC but there are many less expensive IC IA chips available. The INA12x Precision, Low-Power Instrumentation Amplifiers is another less expensive alternative.The old LM324 in my opinion is really not a good choice for your application, I would be looking at an IA and using a dual supply. I would not capacitively couple the output.

Ron
 

Thread Starter

ashokraj

Joined Feb 1, 2018
137
Hello,

How is the sensor itself connected?
Is there a blocking capacitor at the output of the sensor as given in the datasheet?

As for the amplifier, try this circuit:

View attachment 159823

https://www.radio-electronics.com/info/circuits/opamp_non_inverting/op_amp_non-inverting.php



Bertus
Hello,

How is the sensor itself connected?
Is there a blocking capacitor at the output of the sensor as given in the datasheet?

As for the amplifier, try this circuit:

View attachment 159823

https://www.radio-electronics.com/info/circuits/opamp_non_inverting/op_amp_non-inverting.php

Bertus
Hello Bertus,
I tried this circuit by the schematic posted by you. it has the same issue i.e., everything works perfectly well in oscilliscope I can see the signal wavefrom everytime the motor moves but the moment i connect the PA1 terminal to output of op amp, again the signal drops to mv and I cannot be able to detect in microcontroller, any other solutions? I tried with LM324,. this time i ensured there are no capacitors at the output of op amp.I supplied a voltage of 4V to opamp, in Oscilliscope i have got 4-1.5, I am okay with this voltage range as long as that is detected by analog input.

Note: I have assumed that, i will have to keep a very low output impedance while driving a signal to analog input this time even though signal is in mv some how oscilliscope and the results from the debugging window of keil are slightly matching, but the problem is I have assigned a 10 bit that is the total number of values should be from 0 to 1023 but here when the signal is not vibrating the value is 140!! when motor moves instead of increasing the values, the signal decreases from 140 to 0, this is observed in oscilliscope too. Any solutions for this problem ?? like I thought of inverting the signal but it didnt work with LM324 and single voltage supply.

,
 

Thread Starter

ashokraj

Joined Feb 1, 2018
137
You need to download the Product Manual for this accelerometer and study the General Operating Guide section CAREFULLY so you can learn how to use it properly.

In any case, you absolutely CANNOT capacitively couple a signal-- ANY signal-- into an ADC input without also providing a DC path for the ADC's input bias current-- either a resistor to circuit common, or a voltage divider between the ADC's Vref and circuit common so as to bias the ADC inputs to some DC level. The circuit diagram you posted has no such DC path, therefore the ADC will not work properly.
Could you please elaborate the bold sentences above,
https://www.radio-electronics.com/info/circuits/opamp_non_inverting/op_amp_non-inverting.php

you meant to say, in the above schematic related to non inverting amplifier using single power supply. I will have to remove my capacitor and take the direct input from the output of op amp and bias to some dc level? you meant to say a resistor has to be placed in series to the input of analog pin ? I tired to see the Vref's pin on the discovery board, it didnt exist, vref is an internal channel so how can i bias dc level ?
 

OBW0549

Joined Mar 2, 2015
3,566
Read the explanation in that document, in the section titled, "AC coupling the non-inverting op-amp circuit." I can't simplify it for you any more than that. This is really, REALLY basic stuff.

you meant to say, in the above schematic related to non inverting amplifier using single power supply. I will have to remove my capacitor and take the direct input from the output of op amp and bias to some dc level?
Yes.

you meant to say a resistor has to be placed in series to the input of analog pin ?
No.

I tired to see the Vref's pin on the discovery board, it didnt exist, vref is an internal channel so how can i bias dc level ?
I have no idea what's on the Discovery board, nor do I care. The point-- which really should be obvious-- is that if you wish to perform A/D conversions on an AC signal, you MUST offset the AC signal by some positive DC potential to keep the ADC from "running aground" on the negative peaks of the AC signal. You do understand that the ADC cannot measure a negative voltage, don't you? Its input voltage must be kept positive at all times.

EDIT: Also see the attached app note, Amplifier Circuit Pitfalls, and note what's on the first page. What applies to op amps, also applies to ADC's.
 

Attachments

Last edited:

bertus

Joined Apr 5, 2008
22,277
Hello,

Did you connect the ouput of the opamp directly to the input of the ADC?
The expected output voltage range of the LM324 with a 4 volts supply would be 0 to 2.5 Volts.

Bertus
 

Thread Starter

ashokraj

Joined Feb 1, 2018
137
Hello,

Did you connect the ouput of the opamp directly to the input of the ADC?
The expected output voltage range of the LM324 with a 4 volts supply would be 0 to 2.5 Volts.

Bertus
yes, I did !!!yes it is 2.5 volts when 4 volts when not connecting to analog input
 

ericgibbs

Joined Jan 29, 2010
18,849
hi ashok,
The circuit posted by @bertus works as well as it can do when using a LM324, a rail2rail OPA would give almost a full 0v thru +5Vout.
This is a LTS sim of the circuit using a LM324, which in my opinion is not the best choice when using a single 5V supply.

Note: Vso connects directly to the ADC input.
E
 

Attachments

Thread Starter

ashokraj

Joined Feb 1, 2018
137
hi ashok,
The circuit posted by @bertus works as well as it can do when using a LM324, a rail2rail OPA would give almost a full 0v thru +5Vout.
This is a LTS sim of the circuit using a LM324, which in my opinion is not the best choice when using a single 5V supply.

Note: Vso connects directly to the ADC input.
E
I will keep your point in consideration and will try again, thanks for the note that VSO connects directly to adc input.
 

ericgibbs

Joined Jan 29, 2010
18,849
hi,
Note also the Vso will be approx +1.6V when there is no input signal from the accelerometer.
Your program should be written so that negative and/or positive signals can be measured.

E
 

Thread Starter

ashokraj

Joined Feb 1, 2018
137
@bertus , @ericgibbs ,My problem has been solved, the problem doesnt lie in the opamp/ wiring. the problem is in discovery kit, internally pin PA1 in STM32f429 is connected to something else that is the reason for discrepency of value obtained whne connected to pin PA1 and before connecting to PA1. I tried connecting to PA5 and tried again, it worked. As you people said the output is coming as 1.6V from the accelerometer when the motor is not vibrating.
 
Top