# LinkIt One - Battery Level Indicator

971

6

4

## Introduction: LinkIt One - Battery Level Indicator

As most of you know the LinkIt One is a IoT device that can connect to the internet over WiFi. This makes it easy to set up anywhere and control any appliance, but the only draw back is the battery. In most of my IoT project I use a wall adapter to power the device so I don't have to worry about the battery, but when designing wearable electronics we need to account for the battery level too.

The LinkIt One comes with a 1000mAH battery in the box and this battery plugs right into the board. But when it comes to using a battery, it needs to be recharged and we need to get notified when the battery is Low.

So In this instructable I'm going to show you just that how to program an LED to glow every time the battery goes below a threshold value.

So lets get started....

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Requirements

The list of components required is quite simple all you need is -

• LED
• Jumper wires

No soldering skills are required for this tutorial as we will be using a breadboard, but in the future tutorials there will be a lot of soldering. And there are a lot of tutorials on YouTube that shows you how to solder. You can also use an Arduino and you can PM me for additional details on how to get started.

## Step 2: Circuit

The circuit is very simple all you need to do is connect a LED to the LinkIt One digital pin 2. The LED I'm using is red in color as a indicator that the battery is below 33%, and you know it is charging time.

You could also use a RGB led to indicate the battery levels by color codes, but make sure to note that the LED also drags current and will account for the discharging of the battery.

## Step 3: Code

The code is quite simple and can be found below you need an arduino IDE with a LinkIt One plug in to upload the code to the board. You can read through my first instructable on how to do that.

```#include char buff[256];void setup() {
pinMode(2,OUTPUT);
Serial.begin(9600);
}void loop() {
sprintf(buff,"battery level = %d", LBattery.level() );
Serial.println(buff);
sprintf(buff,"is charging = %d",LBattery.isCharging() );
Serial.println(buff);
if(LBattery.level()<=33){
digitalWrite(2,HIGH);
}
else{
digitalWrite(2,LOW);
}
delay(1000);}```

43 4.2K
28 3.3K
165 10K

## 4 Discussions

Very useful! Any idea on how to recharge a battery?

Move usb bat switch to bat when battery connected. This has been tested and confirmed. http://www.seeedstudio.com/wiki/LinkIt_ONE

I guess if you plug in the USB Cable and the battery at the same time and keep the selector switch over USB the battery charges.