I have work around ACS712 with ESP32
This pic is showing value of power load current but i still doesn't turn on anything
and this pic is showing value of power load current on Arduino UNO
I would like to know why esp32 isn't show correct value? and how to get data ACS712 with ESP32
Thank you
ESP32 with ACS712
Re: ESP32 with ACS712
You read 2900 which is near 2.5v. You should use voltage divider to halve output of acs712, keep in linear region of ADC, then calibrate and convert.
Re: ESP32 with ACS712
Thys may give you a direction
Code: Select all
//Programa: Medidor de corrente com sensor ACS712
//Autor: Arduino e Cia
#include <Wire.h>
#include <U8glib.h>
//Definicoes do display Oled
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
//int valor = 0;
String str;
int tamanho;
const int analogIn = A0;
int mVperAmp = 66;
int RawValue = 0;
int ACSoffset = 2500;
double Voltage = 0;
double Amps = 0;
void draw()
{
//Comandos graficos para o display devem ser colocados aqui
u8g.drawRFrame(0, 16, 128, 48, 4);
u8g.drawRFrame(0, 0, 128, 16, 4);
u8g.setFont(u8g_font_8x13B);
u8g.setColorIndex(0);
u8g.setColorIndex(1);
u8g.drawStr( 20, 13, "Corrente (A)");
u8g.setFont(u8g_font_fur25);
str = String(Amps);
tamanho = str.length();
u8g.setPrintPos(64 - (tamanho * 10), 53);
u8g.print(Amps,3);
}
void setup(void)
{
Serial.begin(9600);
Serial.println("Sensor de Corrente ACS712"); Serial.println("");
Serial.println("");
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255, 255, 255);
}
}
void loop(void)
{
Calcula_corrente();
//Chama a rotina de desenho na tela
u8g.firstPage();
do
{
draw();
}
while ( u8g.nextPage() );
delay(150);
}
void Calcula_corrente()
{
RawValue = analogRead(analogIn);
Voltage = (RawValue / 1024.0) * 5000; // Gets you mV
Amps = ((Voltage - ACSoffset) / mVperAmp);
delay(2000);
}
-
- Posts: 4
- Joined: Fri Jan 12, 2018 1:48 pm
Re: ESP32 with ACS712
Can you post it in details as well as its video I am facing the problem and not able to get its proper reading using esp32.
- jgustavoam
- Posts: 165
- Joined: Thu Feb 01, 2018 2:43 pm
- Location: Belo Horizonte , Brazil
- Contact:
Re: ESP32 with ACS712
Hi ,
I suposed yhat you are using ACS712-30A for measurement of low currents ( 66mV / A) . It´s not recommended !
This sensor don't has good linearity . Other types of ACS712 has not good linearity, too.
ESP32 support only 1,0V at ADC Input. Then you must do a voltage divider.
I suposed yhat you are using ACS712-30A for measurement of low currents ( 66mV / A) . It´s not recommended !
This sensor don't has good linearity . Other types of ACS712 has not good linearity, too.
ESP32 support only 1,0V at ADC Input. Then you must do a voltage divider.
Retired IBM Brasil
Electronic hobbyist since 1976.
Electronic hobbyist since 1976.
Re: ESP32 with ACS712
https://www.ebay.com/itm/ESP8266-ESP828 ... :rk:1:pf:0
I bumping this up because I need to measure current up to 10Amps and voltage from 13-19V with an ESP32.
The ACS series were intended to be for 5V arduinos.
Will the proposed solution of the ebay seller work, just to use a simple voltage divider? What is the adjustment required in the code for this?
I bumping this up because I need to measure current up to 10Amps and voltage from 13-19V with an ESP32.
The ACS series were intended to be for 5V arduinos.
Will the proposed solution of the ebay seller work, just to use a simple voltage divider? What is the adjustment required in the code for this?
Who is online
Users browsing this forum: No registered users and 43 guests