I am using msp430f5438A. I need to sample current consumption across a line. Please tell me how to do this ...
How can i use my mcu like a Multimeter ??
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.
I am using msp430f5438A. I need to sample current consumption across a line. Please tell me how to do this ...
How can i use my mcu like a Multimeter ??
There are different ways and depend on what line you need to measure and how it is (electrically) related to the MCU.Ankit Agarwal said:I need to sample current consumption across a line. Please tell me how to do this ...
In case of an AC power line, the 5438A isn't suited for that. There are several MSPs specifically designed for metering AC values. While not impossible, the ADC12 is rather designed for positive DC values.
For DC metering, you'll need a defined resistance across which you can measure the voltage drop caused by the current. Any ADC can only meter voltages, not currents. So a resistor is needed to convert a current into a voltage. (U=I*R or V=A*Ohm). 1mA through a 1 Ohm resistor gives 1mV that can be measured.
Now the resolution. The ADC12, with 1.5V reference, has a resolution of 1.5V/4095 = 0.3663mV. So 1mA through a 1Ohm resistor give roughly a reading of 3 (out of 4095). Pretty much in the range of conversion noise. If you need more precise or finer readings, you'll need to add a OpAmp stage to amplify the voltage across the resistor. Also, 1Ohm might be too much of influence for your line. So pick a smaller one and amplify the voltage further. (the MSPs for AC power line metering have an internal amplification stage that can do a *32 amplification internally, the ADC12 doesn't).
Now the tricky part: if one side of the line you're metering is on GND level, all is fine. Just convert the top voltage of the resistor and you're done. But if the line you're metering is 'floating' (there is an unknown offset voltage, or it is connected to VCC on one side) things get complicated. You'll have to either convert the voltages on both ends of the resistor, so you can get the difference rather than the absolute voltage. In this case both voltages must not exceed the reference.This is perhaps forcing you to use VCC as reference then (with the loss on precision as VCC isn't as precise ands a regulated internal reference, and with a loss of resolution, since VCC is roughly twice as much as the 1.5V reference, so the resolution drops by a factor of two). The other way is to use a differential amplifier ( e.g. instrumentation amplifier) across the resistor rather than a simple amplifying OpAmp.
It's amazing how complex an ostensibly simple task may prove.
**Attention** This is a public forum