In the field of Electronics, sometimes it is becomes essential to know how much current an appliance consumes. We need something that can accurately tell what the current is. There are many ways to do this but one of the most handy and cost efficient way to do this is the Hall-effect sensing technique. In this project, we make use of the ACS712 sensor that operates at 5V to measure the current consumed by a load, in this case a bulb.
Current Sensing is one important aspect of electronics field. It has huge industrial importance like detecting voltage drops in appliances, detecting the response time and accuracy of appliances etc.
In this project, we will use a micro-controller, a bulb of any power rating(I have used a 200W bulb), the ACS712 sensor, some connecting wires, 4.7 Kohm resistor and 0.1uF capacitor.
Fig. 1: Image showing components used in designing Current Sensor Circuit – Arduino, Hall Sensor, Wires, Bulb and Line Tester
The ACS712 sensor uses hall effect sensing technique to give readings of the current that an appliance is consuming. Hall effect sensing is a technique in which a transducer varies its output voltage in response to a varying magnetic field. This output voltage suppose ‘V’ is now known. The sensor has an inbuilt resistance which in the case of ACS712 is 0.185 V/Amps. This divided by the voltage gives the Current.
While taking readings of the output voltage there could be spikes, which can change the final reading drastically. So we take mean voltage. In a cycle there is a maximum reading and a minimum reading. The average of these is the mean.
-> (Mean – Max) *0.0049 is the RMS voltage V ( 5/1023 = 0.0049)
-> V / 0.185 is the RMS Current.
Pin connections are easy as you can see in the circuit diagram. The circuit Diagram has the Output of the ACS712 sensor put into the Analog Pin A0 of the micro-controller through a low pass filter. A 4.7K resistor and a 0.1 uF capacitor are put in the configuration shown in the diagram to make a low pass filter which stabilizes the output. This reading is then fed into the micro-controller on pin A0. The Vcc and the ground of the sensor are connected to the 5V supply and the Gnd pins available on the micro-controller respectively.
In the code I have declared a variable mVperAmp = 185 which is the resistance of the sensor in millis. All variable have been declared as doubles as these will involve complex calculations in decimals. The temp variable stores the temporary value of the voltage reading at the analog pin. Maxi and Mini are initially set to 0 and 1023 in each iteration. These are then compared to the temp variable and set accordingly. At the end the final values are displayed upto 3 decimal places.
Why use a low pass filter?
This is because when I performed the experiment without any filter, the readings were very fluctuating and not according to what is expected at 240V source voltage. By using a 4.7K resistor and 0.1uF capacitor as a filter, the readings got stabilized as is expected. The low pass filter filters out all the unwanted readings and thus making the results optimal.
I performed this experiment for loads of different power ratings with 240V as the source voltage.
Power Rating Observed Current Expected Current
25W 0.106 A 0.104 A
40W 0.15 A 0.166 A
80W 0.35 A 0.33A
200W 0.81 A 0.83 A
Images of the implemented Circuit :
Image of the PCB I finally made
Fig. 2: Typical Image of Hall Sensor Module
Fig. 3: Prototype of Arduino Circuit used for sensing current
Fig. 4: Prototype of Arduino Circuit operating as Current Sensor
Fig. 5: Image showing Arduino Circuit operating as Current Sensor in Dark
Fig. 6: Screenshot of Arduino Serial Port displaying logged value of current