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

Step 1: Requirements

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

  • LinkIt One
  • LED
  • Breadboard
  • 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);

}

Comments

author
Saiyam (author)2015-10-23

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

author
Mtaram (author)Saiyam2016-02-03

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

author
LightBug (author)Saiyam2015-10-23

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.

author

#include <LBattery.h>

You are really doing a good job on these LinkIt One tutorials Lightbug.