I bought this sensor from DFRobot to measure DC current using my 5v Trinket Pro. I followed the wiring setup and code samples from their website. Seems to be working fine once everything is setup, but I'm wondering why is it that once I disconnect the lines from the IN and OUT connections, I still would get a reading? My understanding is that I should be getting a value of 0A once I disconnect them. Am I missing something?
Attached are the photos of my setup below:
Update: Here is the code from sketch
// include the library code:
#include <LiquidCrystal.h>
int RS = 3;
int EN = 4;
int D4 = 9;
int D5 = 10;
int D6 = 11;
int D7 = 12;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);
const int numReadings = 30;
float readings[numReadings]; // the readings from the analog input
int index = 0; // the index of the current reading
float total = 0; // the running total
float average = 0; // the average
float currentValue = 0;
// the setup function runs once when you press reset or power the board
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
for (int thisReading = 0; thisReading < numReadings; thisReading++)
readings[thisReading] = 0;
}
// the loop function runs over and over again forever
void loop() {
total= total - readings[index];
readings[index] = analogRead(0); //Raw data reading
lcd.setCursor(0, 1);
lcd.print("Orig: ");
lcd.print(readings[index]);
//Data processing:510-raw data from analogRead when the input is 0;
// 5-5v; the first 0.04-0.04V/A(sensitivity); the second 0.04-offset val;
readings[index] = (readings[index]-512)*5/1024/0.04-0.04;
total= total + readings[index];
index = index + 1;
if (index >= numReadings)
index = 0;
average = total/numReadings; //Smoothing algorithm (http://www.arduino.cc/en/Tutorial/Smoothing)
currentValue= average;
lcd.setCursor(0, 0);
lcd.print("A0: ");
lcd.print(currentValue);
delay(10);
}
Please bear with me as I am still new at electronics.