Vasanta Tanna

Sampling of Analog values

Discussion created by Vasanta Tanna on Oct 15, 2009
Latest reply on Oct 19, 2009 by Vasanta Tanna

I am doing 24 plug port power strip with 3 input plugs (each input plug controls one group of 8 receptacles of 24 plugs)


Basically I am doing power strip with 50Hz/120V input and I have 24 receptcles (each group is 8), like that 3 groups of eight receptacles in each strip, I am reading currents back from 24 receptacle relays, also I am reading 3 voltages, one from each group of eight receptacles. I am using 5 GPIO pins to select one of the receptacle (24 currents + 3 volatges + few for temperature), basically I have to read 24 currents, 3 voltage. 24 Instaneous currents, 3 Instaneous voltages, then I have to VI (voltage * current), also I have to calculate average voltage and current: total readings are:


Three Vrms from Three groups

8 * 3 = 24 rms currents + 3 boards + 1 total

28 Powers

28 VA (V rms * I rms)

28 PF (P / VA)


I have to do 840 samples per second to measure Instantaneous current and Instantaneous voltage. using them I have to calculate RMS Current and RMS voltage, then actual power (instantaneous current * instantaneous voltage), apparent power (RMS Current * RMS voltage), then Power factor ( actual power / apparent power).



I am using 5 GPIO pins (AN0 - AN4) select one at a time and AN7 to read the value. Please throw some ideas about real-time sampling (how can I do exactly real-time 840 samples per second).