Hey, I am trying to use a SparkFun Current Sensor Breakout - ACS723 with an Arduino Giga. Because the Giga uses 3.3V logic, I am also using the SparkFun Logic Level Converter - Bi-Directional to convert the 5V signal from the current sensor to 3.3V for the Giga. I am using channel one on the converter connected to an annalog pin. The HV is connected to 5V pin, LV is connected to 3.3V pin, and GND is connected to ground.
Here is my code:
const int sensorPin = A0;
const float referenceVoltage = 3.3;
const int adcResolution = 4095;
// For ACS723 5A version
const float sensitivity = 0.4; // V/A
// Adjusted center voltage due to voltage divider (2.5V * 3.3/5 = 1.65V)
const float sensorZero = 1.65;
void setup() {
Serial.begin(115200);
analogReadResolution(12);
}
void loop() {
int raw = analogRead(sensorPin);
float voltage = (raw / (float)adcResolution) * referenceVoltage;
float current = (voltage - sensorZero) / sensitivity;
Serial.print(“Raw ADC: “); Serial.print(raw);
Serial.print(” | Voltage: “); Serial.print(voltage, 3); Serial.print(” V”);
Serial.print(" | Current: “); Serial.print(current, 3); Serial.println(” A");
delay(500);
}
With a correspontding serial output: Raw ADC: 3232 | Voltage: 2.605 V | Current: 2.386 A
When the there should be zero current.
Do you see any potential issues with this setup, and why I wouldn’t be getting zero amps when the current sesor has no load on it?