This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LM358 problem reading analog values using microcontroller

Hi,

My application involves measuring battery parameters and inverter parameters. Terminals of both inverter and battery goes to the ADC of microcontroller as shown in attached figure. microcontroller ADC has been tested and working correctly. My problem is whenever the battery is conneced with charger or inverter, the ADC is not measuring the voltage accross battery terminal correctly. It is measuring only a constant voltage.

circuit explanation:

Ac current Measurement

CT output connected to a 100E burden resitor.
voltage acros the burden resistor is passed through a germanium diode. which causes the output will have positve half cycle and around 0.47 Voltage drop.Which will compensated by adding 0.5V.then which will amplified by an opamp
c33 is provided to suppress higher frequencies
R39 & R40 act as a voltage divider to limit the OPamp Output voltage to 3.3V
for measurement of current we program it continuous reading of ADC for the posive half cycle, and take the rms vlaue of one half cycle and Doubled it for the actual value.

AC voltage Measurement

By using a PT(230/6V) the voltage is step down and passes through a 1K(R56) resistor.Voltage acroos R56 is added by an offset voltage of 2.5V.
The differential voltage is added by Opamp Gain and the output is limited to 3.3v by a voltage divider. which is used for the reading of adc to calculate the RMS voltage.
For zero crossing detection the ZCIN1 is compared with 2.5v refferance voltage and the High and Low pulses which drives the transistor the ouput of the transistor goes to the controller for the zero crossing detection.
C38,R68,R69 are used for the hysterisis band creation(~10mV).

DC voltage measurement

The battery terminal (24V DC) is passed through a ferrite bead and the voltage is step down by a voltage divider, which will pass through a low pass filter cut of frequency 500Hz. and its output is passed to the ADC terminal through a voltage divider to limit the output voltage to 3.3V.
Also the Dc current is measured by a hall effect sensor(wcs1600),the analog output voltage is passed to a LPF to avoid the ripples and taken the ADC reading.

The analog ground and digital ground is shorted with a ferrite bead and the reference voltage creation is simply a voltage divider which is connected across the controller vcc and ground and passed through a voltage follower.

Is this correct? Do I need to consider anything more? I need to measure the exact voltage across the battery if it is charging or it is discharging. I could read the voltage increment using a general purpose multimeter. I need to get the battery voltage like I could read using a multimeter. Any suggestions??