Basically the microcontrollers doesn’t have specific ports
for measuring “dc” current or “ac”
current, but they do have ADC (Analog to Digital Converter) and we can
take advantage from this point of view so we can measure analog voltages of a
certain range (usually 0-5vcc). The way of doing this is to place a resistance
in series with the current path and measure the voltage drop across it. For
this trick we need to use a resistor with a very low value just to not affect
the original current of the load.
Resistors with a value less than 1 ohm are necessary and can
be found in electronic stores. For a proper resistor placed into the circuit we
have to pay attention for maximum current used. So, let’s say that you pick
0,47Ohm and the maximum current in the circuit is about 5 A, then the resistor
should have the capacity of dissipation equal with: I²xR =>
25 x 0,47 = 12 Watts of heat.
The appropriate design for the resistor is to create by
yourself a coil from an Cu wire. For
this test I have create one from 1,5 meter Ø 1,3 mm with enameled insulation on outer side, as
shown below.
Coil
Now let’s measure its resistance, for example directly with
an multimeter. My digital multimeter shows a value equal with 0,4 Ohm. Of
course this measurement can have uncertainty, because of very small value which
we measure and we don’t had to forget the fact that usually the digital
multimeters does not show values beyond 1 decimal digit. Our resistance can be
measured respecting the ohm’s law. We can connect in series with the coil
resistance (Rs), a known resistor for example 47 ohm and supply a 5vcc as shown
below. Next, measure the voltage across Rs and current through it separately
using the multimeter. In the current case, I foud the measured voltage and
current values to be 25.6mV and 88.6mA. This gives the resistance of the coil
equal with 0.289 Ohm. (Rs = V/I).
Now, suppose that the range of current to be measured using
this coil resistance is from 0-5A. Then the voltage drop across the coil
resistance will be somewhere from 0 – 1.44 V. Because of its low range, this
voltage signal may not be accurately measured with a microcontroller’s ADC
module. In this case we will use an operational amplifier circuit for a voltage
scaling mode. The entire schematic for this design is shown below.
As a description: in the above circuit Rs represent the low
value current sensing resistor (our coil resistor) which is connected in series
with the consumer (load resistor). Our purpose is to derive the load current
(I). The low voltage drop across Rs is amplified by the non-inverting amplifier
with 3.5. This is enough to linearly
scale Vs (0 – 1.44 V) to Vo (0-5vcc).
At this point we have 0-5vcc signal that corresponds to 0-5A
current through Rs. This voltage signal is now more appropriate for ADC
conversion with Vref = 5vcc.
Vo= 3.5 x I x RS = 1I (Rs=0,289) => I = Vo/1.
For
10-bit ADC with Vref = 5vcc:
·
Our
resolution will be equal with: resolution
= 5/1024 = 0.0049 (5mA).
·
For
input signal Vo, the ADC O/P will be Vo
x 0,0049,
·
Then I = ADC O/P x
0,0049/1 = ADC O/P x 0.0049.
Practical pictures with the experiments.
No comments:
Post a Comment
If you do not understand something, or if you make some aplication helped by this blog, let me know.