Author Topic: Some doubts about reading voltage and current with and ADC  (Read 1391 times)

0 Members and 1 Guest are viewing this topic.

Offline senso

  • Frequent Contributor
  • **
  • Posts: 867
  • Country: pt
    • My AVR tutorials
Some doubts about reading voltage and current with and ADC
« on: August 29, 2012, 04:37:48 pm »
Good afternoon, when dave started his PSU series, I grabed is rev B schematic, made some modifications and got some pcb's, after months I finally got some time for this project, and the voltage measurements are a bit off, like, the adc says its 1.00v, and the scope(Rigol DS1052E) measures 1.20v, usually its always a 200mV diference, in some values its a bit smaller.
The current, well, it was suposed to be 1mA/bit, but for a 220ohm resistor at 1.00v(measured by the ADC), the current is about 9 counts, or as the expected 1mA/bit 9mA, but ohms law says it should measure 4.5mA.

The schematic is in this pdf:

The code to convert from the ADC readings to voltage is this:
Code: [Select]
power.vinf = (double)((power.vinRaw*2.048f*10.98)/4095.0f);
power.voutf = (double)((power.voutRaw*2.048f*5.0f)/4095.0f);

And the voltage reference measures 2.04v on the scope.
Any thoughs on how to correct the measures, and whats is the correct calcs to get the current values?

Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo