/* Basic Wattmeter Reads AC voltage generated by a current clamp on an analog input pin, then prints the results to the serial monitor. The circuit: * Current clamp connected to analog pin 5 and GND. created by Didier Donsez */ const long CLAMP_COEF=55; // dependent of the clamp (mine is a Chacon Ecowatt 850) const int CLAMP_PIN=5; void setup() { Serial.begin(9600); } void loop() { // loop in order to read the AC voltage signal generated by the clamp int analogValue; long value=0; for(int i=0;i<1024;i++){ analogValue = analogRead(CLAMP_PIN); value+=analogValue; delay(1); // 2*10*50Hz } value=value/CLAMP_COEF; // print the result: Serial.print(value); Serial.println(" Wh"); // wait 1000 milliseconds before to compute the next value delay(1000); }