How to measure AC current in watts.
After a couple of failed attempts to make a reliable power-meter to measure the electricity that is consumed by the infrared heaters I backtracked and went back to a earlier design. With an Olimexino_stm32 Maple clone board and an ACS712 the last piece of the computer-control is operational.
The ACS712 chip 20A has a linear curve of 100 Mv per ampere between -20 till 20 ampere from 0,5 volt till 4,5 volt by a supply-voltage of 5 volt
The Olimexino_stm32 works only with 3.3 volts. With a resistor divider (potentiometer between 5V and ground trim the output till 3.3V and you have the correct divider)
on the output of the ACS712 is fed into the ADC of the Olimexino-stm32, as long there is no current flowing the division is nearly linear so take at least 4,7K as value.
The Olimexino stm32 has a 12 bit DAC digital analog converter. 2^12 is 4096 the zero-crossing is at 2048
If the measured value is less than 2048 the relevant voltage = 2048 min the measured value (example 2048 – 490 = 1558)
If the measured value is more than 2048 the relevant voltage = the measured value min 2048 ( example 3567 – 2048 = 1519)
The result is only positive values. 3.3 Volts divided by 4096 = 0.00080566 volt per bit step. Multiplication of the measured value with 0.00080566 gives the voltage of the output from the ACS712 every 1 mV = 0.001V = 0.01 amp. So if we measure as value of 1346.5 Millivolt = 1.3465 Volt it’s 13,465 ampere (volts times 10 or millivolts divided by 100)
According to the Law of Ohm P=I*V The voltage of the net in Europe is 230Volt when we combine the previous step volts times 10 with this one we get 23 as multiplication factor
By preforming many measurements in rapid succession(1000)and store every measurement we get a clear picture of the real power that is being used.
after 1000 measurements we calculate the mean value and look is there is any interest in the value. If not we start a new cycle.
Here is the complete working sketch powermeter olimexino stm32 maple sketch