Page 1 of 1
ESP32 with ACS712
Posted: Fri Mar 31, 2017 4:49 pm
by sitita_c
I have work around ACS712 with ESP32
- ACS712 on ESP32
- Screen Shot 2560-03-31 at 23.43.48.png (34.76 KiB) Viewed 28183 times
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
- ACS712 on UNO
- Screen Shot 2560-03-31 at 23.44.07.png (9.79 KiB) Viewed 28183 times
I would like to know why esp32 isn't show correct value? and how to get data ACS712 with ESP32
Thank you
Re: ESP32 with ACS712
Posted: Sat Apr 01, 2017 8:33 pm
by WiFive
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
Posted: Sun Apr 09, 2017 5:31 am
by EBCLR2017
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);
}
Re: ESP32 with ACS712
Posted: Fri Jan 12, 2018 1:50 pm
by bhavikbhansali
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.
Re: ESP32 with ACS712
Posted: Sat Feb 03, 2018 3:18 pm
by jgustavoam
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.
Re: ESP32 with ACS712
Posted: Fri Nov 09, 2018 7:33 am
by freebsdx
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?