Coder Social home page Coder Social logo

arduino-battery-checker's Introduction

Simple Arduino battery voltage checker

A simple Arduino project to check voltage status of a battery between 0 and 10V including standard AA,AAA types and LiPo.

Sketch

The connection is pretty simple, check it out on the sketch bellow. To check your battery you just need to connect your own where the AAA is setup.

Arduino battery voltage checker configuration

Code

int analogPin = A0; // potentiometer wiper (middle terminal) connected 
                    // to analog pin 3 outside leads to ground and +5V
int val = 0;        // variable to store the value read
float vbat = 0.0;

void setup() {
  Serial.begin(9600);           //  setup serial
}

void loop() {
  val = analogRead(analogPin);  // Read analog value from input pin (0 to 1023)
  vbat = float(val);
  vbat = 10.0*vbat/1024.0;      // Convert to voltage note that vcc (5V) is divided by 2
  Serial.println(vbat);
  delay(1000);
}

More information

For more information you can check the projects listed bellow:

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.