Linkit One Battery Tester

880

20

1

Posted in TechnologyMicrocontrollers

Introduction: Linkit One Battery Tester

About: Hi, I just launched an Indigogo campaign support my projects by backing it. https://www.indiegogo.com/projects/tinker-usb-a-wifi-based-badusb#/

A few months ago I created an instructable in which I should how to create a battery tester using the Linkit One board, in this instuctable I'm going to show you how to make a battery tester using the Linit one. A battery tester works by checking the voltage of 1.5V cells or even 3V button cells and tells you how much of the charge is left. Like red indicates that the battery is dead and white indicates that the battery is full.

Step 1: Tools and Components

All the components you require for this instructable are -

  • Linkit One
  • Different colored LEDs
  • Jumper wires
  • Breadboard
  • 2.2k resistor

Step 2: Circuit

Follow the circuit above it is quite simple and can be easily assembled on a breadboard. Also add a suitable resistor for the LEDs (I did not do that because I'm using 5V tolerant LEDs). For the colors of the LED I used

  • Red to indicate that the battery is Low
  • Green to indicate that the battery is running
  • White to indicate that the battery is Full

Step 3: Code

Copy the below code and paste the below code in the Arduino IDE and then select a suitable COM port and upload the code to the Linkit One. If you are going to measure a 3V button cell then you need to edit the code to read for a voltage value of 3v.

#define newLED 2 // green LED 'new'
#define okLED 4 // green LED 'ok' #define oldLED 6 // red LED 'old' int analogValue = 0; u float voltage = 0; int ledDelay = 2000; void setup() { pinMode(newLED, OUTPUT); pinMode(okLED, OUTPUT); pinMode(oldLED, OUTPUT); } void loop() { v analogValue = analogRead(0); w voltage = 0.0048*analogValue; x if ( voltage >= 1.6 ) { digitalWrite(newLED, HIGH); delay(ledDelay); digitalWrite(newLED, LOW); }  else if ( voltage < 1.6 && voltage > 1.4 ) { digitalWrite(okLED, HIGH); delay(ledDelay); digitalWrite(okLED, LOW); }  else if ( voltage <= 1.4 ) { digitalWrite(oldLED, HIGH); delay(ledDelay); digitalWrite(oldLED, LOW); }

Step 4: Finishing

After uploading the code power on the Linkit One and you should see the red LED light up, and connect a battery accross the ground terminal and the analog pin 0, and you should see the LED light with respect to the voltage of the battery. This project can be used to check the voltage off the cells used by toys as some times there is still a lot of charge left in it.

Share

    Recommendations

    • Spotless Contest

      Spotless Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Science of Cooking

      Science of Cooking
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments

    It's a useful circuit - thanks.

    - It would be even more accurate if you added a resistor across the battery - something like 10 Ohms (https://electronics.stackexchange.com/questions/12...).

    Or maybe even measure the battery while its lighting an old torch bulb.

    A bad battery doing nothing will give you a false impression its ok when its doing nothing. Voltage measurements are best taken when the battery is actually doing something.