void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
analogReadResolution(10);
// put your main code here, to run repeatedly:
int adc = analogRead(32);
float voltage = adc * 3.3 / 0.805;
float current = (voltage - 1.60) / 1096;
if (current < 0.16) {
current = 0;
}
Serial.print("Current : ");
Serial.println(current);
delay(300);
}
// Include the required libraries
#include <ACS712.h>
// Define the pin number for the ACS712 sensor
#define ACS712_PIN 35
// Define the sensitivity of the ACS712 sensor
#define ACS712_SENSITIVITY 185 // 185mV/A for ACS712-05A module
// Declare the ACS712 object
ACS712 acs712(ACS712_PIN, ACS712_SENSITIVITY);
void setup() {
// Initialize the serial communication
Serial.begin(9600);
}
void loop() {
// Read the current value from the ACS712 sensor
float current = acs712.getCurrentDC();
// Print the current value to the serial monitor
Serial.print("Current: ");
Serial.print(current);
Serial.println("A");
// Wait for a short period before taking another reading
delay(100);
}
why ist showing Compilation error: 'class ACS712' has no member named 'getCurrentDC'
take Li-Ion cell and resistor, or other constant current source. measure current with MM, it should be about 1A, then connect to load pins and measure signal output voltage