GithubHelp home page GithubHelp logo

peff74 / acs712_esp8266 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 772 KB

ESP8266 arduino script for ACS712 to measure AC current

C++ 100.00%
ac acs712 arduino beginner-friendly current esp8266 sensor

acs712_esp8266's Introduction

AC Current with ACS712 and ESP8266 D1 mini!

There are a few pitfalls, but if you know them, it works well. You have to adjust the voltage divider, pay attention to the read speed of the ACD and adjust the noise suppression. ACS712 logo

Why ACS712

ACS712 logo

  • cheap
  • small
  • available everywhere
  • safe, due to galvanic separation

Using the AD converter of the ESP8266 for the ACs712

It's not difficult at all, especially if you use the WeMos D1 mini. The D1 mini already has an integrated voltage divider. So you are not limited to the 1.0V of the ESP8266 ADC.

The voltage divider of the D1 mini is designed for 3.3V. Now we just have to extend it so that it works with the 5V of the ACS712. We do this by simply connecting a 180k resistor in series with the A0 input

The WiFi pitfall

Many measurements in a short time can lead to problems with the WiFi!!

Because:

The ADC is used on the 8266 by WiFi to test the signal level, too. Hard use of analogRead(A0) influences the readings of the WiFi RD level. This can be set with the "Delay_Time" The value 2 works when WiFi is simply connected. If you want to work with the WiFiEventHandler, e.g. to detect a disconnect, the value should better be 4, because the WiFiEventHandler is no longer triggered incorrectly. "do_measurements" should then be reduced to 25. Of course, this reduces the accuracy

#define Delay_Time 2

Correct scaling value for the different models

ACS712 5A module --> scaling: 185 mV/Amp

ACS712 20A module --> scaling: 100 mV/Amp

ACS712 30A module --> scaling: 66 mV/Amp

#define Scaling 185.0

filter out the noise

Because we record all the values around the measuring point in every series of measurements we can filter out the values that are most off the mark.

Interference is mainly caused by current-carrying cables next to the line to A0. However, bad power supply units can also play their part

#define  Noise_Filter  4

acs712_esp8266's People

Contributors

peff74 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.