Linkit One Battery Tester

by ThisIsSteve in Circuits > Microcontrollers

1311 Views, 20 Favorites, 0 Comments

Linkit One Battery Tester

IMG_20151218_150311.jpg
IMG_20151218_150409.jpg
FURVXQLIDZSJ8Y5.jpeg

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.

Tools and Components

IMG_20151218_150449.jpg

All the components you require for this instructable are -

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

Circuit

Screenshot from 2015-09-01 04:30:44.png

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

Code

IMG_20151218_150328.jpg

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

Finishing

IMG_20151218_150317.jpg

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.