Giter VIP home page Giter VIP logo

acs712's Introduction

ACS712

Current Sensor - 5A, 20A, 30A

Description

The ACS712 is a chip to measure current, both AC or DC. The chip has an analog output that provides a voltage that is lineair with the current. The ACS712 library supports only a built in ADC by means of analogRead(). There are 2 core functions:

  • int mA_DC()
  • int mA_AC()

To measure DC current a single analogRead() with some conversion math is sufficient to get a value. To stabilize the signal analogRead() is called twice.

To measure AC current a blocking loop for 20 millis is run to determine the peak to peak value which is converted to the RMS value. To convert the peak2peak value to RMS one need the so called crest or form factor. This factor depends heavily on the signal form. For a perfect sinus the value is sqrt(2)/2.

Test

The library is tested with the RobotDyn ACS712 20A breakout and an Arduino UNO.

Operation

With the constructor the parameters volts and maxADC (steps) of the ADC are set together with the milliVolt per Ampere value. The last parameter can be adjusted afterwards, e.g. to callibrate this value runtime. Note this parameter affects both AC and DC measurements.

To callibrate the zero level for DC measurements, 5 functions are available to adjust the midPoint.

To callibrate the RMS value for AC measurements, 2 functions are available to get and set the formFactor.

To callibrate the noise level (used for AC measurements), 2 functions are available to get and set the noise in mV.

The examples show the basic working of the functions.

acs712's People

Contributors

robtillaart 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.