ESP32 with ACS712

sitita_c
Posts: 1
Joined: Fri Mar 31, 2017 4:42 pm

ESP32 with ACS712

Postby sitita_c » Fri Mar 31, 2017 4:49 pm

I have work around ACS712 with ESP32
Screen Shot 2560-03-31 at 23.43.48.png
ACS712 on ESP32
Screen Shot 2560-03-31 at 23.43.48.png (34.76 KiB) Viewed 28151 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
Screen Shot 2560-03-31 at 23.44.07.png
ACS712 on UNO
Screen Shot 2560-03-31 at 23.44.07.png (9.79 KiB) Viewed 28151 times
I would like to know why esp32 isn't show correct value? and how to get data ACS712 with ESP32

Thank you

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 with ACS712

Postby WiFive » Sat Apr 01, 2017 8:33 pm

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.

EBCLR2017
Posts: 3
Joined: Sun Apr 09, 2017 5:08 am

Re: ESP32 with ACS712

Postby EBCLR2017 » Sun Apr 09, 2017 5:31 am

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);
}

bhavikbhansali
Posts: 4
Joined: Fri Jan 12, 2018 1:48 pm

Re: ESP32 with ACS712

Postby bhavikbhansali » Fri Jan 12, 2018 1:50 pm

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.

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: ESP32 with ACS712

Postby jgustavoam » Sat Feb 03, 2018 3:18 pm

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.
Retired IBM Brasil
Electronic hobbyist since 1976.

freebsdx
Posts: 2
Joined: Sun Oct 21, 2018 6:38 am

Re: ESP32 with ACS712

Postby freebsdx » Fri Nov 09, 2018 7:33 am

https://www.ebay.com/itm/ESP8266-ESP828 ... :rk:1:pf:0

Image


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