Introduction: Laptop Automatic Start/Stop Charging (using Arduino, Yun Shield and ESP8266)

About: In my free time I used to write software in c# language and my long time application is for JARVIS a computer assistant like in Iron Man film, I'm designing my own home automation. I'm also learning to develop…

I'm working outside my country and laptop is a great help for me to connect to my family and friends and do all my computing stuffs as well, but I always came across of running low battery and even worst onto critical level or reserved mode when I forgot to plug in the charger, but the problem is when I keep my charger plug in the battery suffer and left me with no choice to replace and buy a new one because it became weak and drain very fast and not only that I got my system hot when I do multi-tasking while charging.

I never tried removing battery pack and keep the laptop plugged in because it's useless and unreasonable way, laptop is made with a battery so user can use it anywhere and anytime unless the battery is completely dead or missing.

A year ago, I got my Arduino Mega and this is my first project to automate charging of my laptop battery and avoid the risk in keeping the charger plugged in, save money, preserve my battery and save my life to worst scenario.

Thanks to Autodesk's Instructables I find a way to share it to others, let's get started.

Step 1: Parts for Arduino

Mega 2560 or any board - 1

Dragino Yun Shield - 1

Relay Module - 1

Jumper Wires - 3

At first, I used only Arduino mega alone to automate laptop battery charging system by sending serial data via usb com port, followed by using Bluetooth serial connection and finally using the Dragino Yun Shield for Wi-Fi communication.

The Yun Shield is one of the most powerful shields for Arduino Boards. The Yun Shield is designed to solve the Internet connectivity and storage issue for Arduino Board.

The Yun Shield runs the Open Source OpenWrt system (Same system as runs in Arduino Yun) and it is fully compatible with the Arduino IDE v1.5.4 or later. The Yun Shield is the ideal choice for Arduino Projects which require various internet connections and more storage.


Below are the links for Dragino Yun Shield How-to

YouTube Tutorial Part 1

YouTube Tutorial Part 2

Helpful Instructable

Step 2: Arduino Schematic

Jumper wires are connected to yun shield headers since it's on the top of the Arduino

Relay IN1 is connected to yun shield Pin 13

Relay GND is connected to yun shield GND

Relay VCC is connected to yun shield 5V

Step 3: Arduino and Yun Shield Code

Updated Arduino file

Step 4: Parts for ESP8266

Esp8266 - 1

Relay Module - 1
Jumper Wires - 5

LM2596 DC TO DC converter from 5v to 3.3v

End of year 2015, I got my ESP8266 Wi-Fi module and perfectly fit it's small size to use only for this auto charging system alone because I wanted to use Arduino Mega for bigger project.

Helpful Instructable

Step 5: ESP8266 PinOut & Connection Guide

Connect Esp8266 VCC & CH_PD (short) to LM2596 OUT 3.3V

Connect Esp8266 GND to LM2596 OUT GND

Connect Esp8266 GPIO0 to RELAY IN1

Connect RELAY VCC to LM2596 IN 5V

Connect RELAY GND to LM2596 IN GND

Step 6: ESP8266 Code


Step 7: Laptop Software

Power Notification programs is not need to install just paste it anywhere then run and change the URL path of your Yun shield/ESP8266 web address.

You can select and change the battery level you want the charging start and stop.

You can select communication interfaces between WiFi, USB and Bluetooth port in the latest version of windows app.

The program will timely monitoring the battery level of laptop. It has voice enabled for notifications but I think some laptop don't have louder speakers so I added features of popup in the lower corner of desktop screen at the top of clock and date it will remain there until the laptop charger is connected to power outlet and start charging, if it is not, you can check either the web address [example:] is correct or the charger is not plugin to your laptop.

This was adopted to my JARVIS software back in 2010 i wrote a c# applications for computer that requires speech recognition like in IRON MAN film, i need JARVIS to check and remind about my laptop battery percentage but that time i haven't created this automation for charging.

Software update as of Nov.22 2016. I'll be keep updating this article every now then whenever I personally encountered errors or something come to my mind for improvements.

The software requires NET framework installed in your machine here's the link

Step 8: Finished

No more worries to low battery and over charging. This project is very helpful for me it never let my laptop out of power even I leave my laptop open 24/7 or waiting for my downloads. It's proven effective, the computer software is last thing that will this project works perfectly for battery level monitoring. I hope you enjoy, Thanks for your time and appreciation. Cheers!

Helpful tips on how to take care the laptop battery

Next Instructable is for Smartphone Auto Charging very soon!

Full Spectrum Laser Contest 2016

Participated in the
Full Spectrum Laser Contest 2016

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest