I’ve attached my circuit diagram below. I’m trying to build an energy logger which measures both voltage and current, but I’ve been experiencing some difficulties with measuring both of them.
Both the voltage and current keeps changing. I tried to get an average of the samples but it still doesn’t remain constant. Maybe my program is wrong, I’m not sure what’s wrong anymore.
I’ve placed the code below, Please check it out & help me find the main problem with it & the circuit diagram.
Thanks,
Here’s my code:
/*
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins