measuring, charging and monitoring the battery …

53
MEASURING, CHARGING AND MONITORING THE BATTERY USING EMBEDDED PROGRAMMING WAN NUR AMIRAH BINTI WAN MOHD ZUKI BACHELOR OF COMPUTER SCIENCE (COMPUTER NETWORK SECURITY) WITH HONOURS UNIVERSITI SULTAN ZAINAL ABIDIN 2018

Upload: others

Post on 19-May-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MEASURING, CHARGING AND MONITORING THE BATTERY …

MEASURING, CHARGING AND MONITORING THE

BATTERY USING EMBEDDED PROGRAMMING

WAN NUR AMIRAH BINTI WAN MOHD ZUKI

BACHELOR OF COMPUTER SCIENCE

(COMPUTER NETWORK SECURITY)

WITH HONOURS

UNIVERSITI SULTAN ZAINAL ABIDIN

2018

Page 2: MEASURING, CHARGING AND MONITORING THE BATTERY …

WA

N N

UR

AM

IRA

H

B

AC

HE

LO

R O

F C

OM

PU

TE

R S

CIE

NC

E

2018

BIN

TI W

AN

MO

HD

ZU

KI

Page 3: MEASURING, CHARGING AND MONITORING THE BATTERY …

MEASURING, CHARGING AND MONITORING THE BATTERY USING

EMBEDDED PROGRAMMING

WAN NUR AMIRAH BINTI WAN MOHD ZUKI

Bachelor of Computer Science

(Computer Network Security) With Honours

Faculty of Informatics and Computing

Universiti Sultan Zainal Abidin, Terengganu, Malaysia

MAY 2018

Page 4: MEASURING, CHARGING AND MONITORING THE BATTERY …

i

DECLARATION

I hereby declare that this report is based on my original work except for quotations

and citations, which have been duly acknowledged. I also declare that it has not been

previously or concurrently submitted for any other degree at Universiti Sultan Zainal

Abidin or other institutions.

________________________________

Name : ..................................................

Date : ..................................................

Page 5: MEASURING, CHARGING AND MONITORING THE BATTERY …

ii

CONFIRMATION

This is to confirm that:

The research conducted and the writing of this report was under my supervision.

________________________________

Name : ..................................................

Date : ..................................................

Page 6: MEASURING, CHARGING AND MONITORING THE BATTERY …

iii

DEDICATION

In the name of Allah, the Most Gracious and the Most Merciful.

First and foremost, this final year project, Measuring, Charging and Monitoring

the Battery using Embedded Programming could not be conducted and completed

without the blessings, supports, and encouragements from many people. I would like to

express my deepest gratitude to my supervisor, Dr Aznida Hayati binti Zakaria @

Mohamad for always putting her trust on me to complete this project successfully.

Besides, her teachings, advices, patience and ideas towards this project has been the

most memorable experiences, and I was so proud to be her supervisee. Not to forget,

my heartiest gratitude to my family members as they have given me full support

throughout this project. I also want to take this opportunity to thank my fellow friends,

as I am finishing this project, they also gave me help, guidance, advices as well as

suggestions to make my project a better one.

Finally, a special thanks from me to all lecturers of Faculty of Informatics and

Computing and the whole team of the faculty either directly involved or not for giving

me a great support in order to complete this final year project (FYP). May Allah S.W.T

bless all the efforts.

Page 7: MEASURING, CHARGING AND MONITORING THE BATTERY …

iv

ABSTRACT

Batteries are one of the convenient in electricity technology where they give us

power to operate anywhere, anytime only in a handy and portable form. While all

batteries have their own specifications to describe their behaviour, most of them run

flat very quickly. Plus, they are not an ideal voltage resources. Therefore, this paper

outlines the process in creating a battery tester which the battery performance can be

observed easily. This tester is actually to indicate the capacity of a battery, and

provide the information about how much power is left in the battery. From the test,

we can evaluate the performance of the battery itself and help in making decision

according to the battery lifespan. Arduino is being used in this project, and directly

connected to the computer which will make the framework simple. Besides, the

reading will be displayed on the Serial Monitor, with the guidance from LED. The

objective of this project is to provide a low-cost solution with low maintenance

required in order to give convenience to user who want to monitor the battery.

Page 8: MEASURING, CHARGING AND MONITORING THE BATTERY …

v

ABSTRAK

Bateri adalah salah satu teknologi elektrik yang mudah di mana mereka memberi kita

kuasa untuk beroperasi di mana-mana, bila-bila masa sahaja dalam bentuk yang

mudah dan mudah alih. Walaupun semua bateri mempunyai spesifikasi mereka sendiri

untuk menggambarkan tingkah laku mereka, kebanyakannya kuasa mereka menurun

dengan cepat. Tambahan itu, mereka bukan merupakan sumber voltan yang ideal. Oleh

itu, kertas kerja ini menggariskan proses dalam membuat penguji bateri yang prestasi

bateri dapat dilihat dengan mudah. Penguji ini sebenarnya menunjukkan kapasiti

bateri, dan memberi maklumat tentang berapa banyak kuasa yang tersisa dalam bateri.

Dari ujian, kita boleh menilai prestasi bateri itu sendiri dan membantu dalam membuat

keputusan mengikut jangka hayat bateri. Arduino digunakan dalam projek ini, dan

dihubungkan secara langsung dengan komputer yang mana akan membuat rangka

kerja menjadi lebih mudah. Selain itu, bacaan akan dipaparkan pada Serial Monitor,

dibantu oleh lampu LED. Objektif projek ini adalah untuk menyediakan penyelesaian

kos rendah dengan penyelenggaraan yang rendah yang diperlukan untuk memberikan

kemudahan kepada pengguna yang ingin memantau bateri.

Page 9: MEASURING, CHARGING AND MONITORING THE BATTERY …

vi

CONTENTS

PAGE

DECLARATION i

CONFIRMATION ii

DEDICATION iii

ABSTRACT iv

ABSTRAK v

CONTENTS vi

LIST OF TABLES viii

LIST OF FIGURES ix

LIST OF ABBREVIATIONS x

CHAPTER I INTRODUCTION 1

1.1 Introduction 1

1.2 Problem statement 3

1.3 Objectives 4

1.4 Scopes 4

1.5 Limitation of Works 5

1.6 Activities and Milestones 5

CHAPTER II LITERATURE REVIEW 7

2.1 Introduction 7

2.2 Battery Charger and Tester 7

2.3 Types of Battery Charger and Tester 8

2.4 Analysis Gap 10

2.5 Technology Used 12

2.5.1 Embedded Programming 12

2.6 Summary 13

CHAPTER III

METHODOLOGY 14

3.1 Introduction 14

3.2 Framework 15

Page 10: MEASURING, CHARGING AND MONITORING THE BATTERY …

vii

3.3 System Requirement 17

3.3.1 Software Requirement 17

3.3.2 Hardware Requirement 17

3.4 Summary 18

CHAPTER IV IMPLEMENTATION AND RESULT 19

4.1 Introduction 19

4.2 Software 19

4.2.1 Arduino IDE 1.8.5 20

4.2.2 Fritzing 0.9.3b 20

4.3 Hardware 21

4.3.1 Arduino Setup 21

4.3.2 Arduino Circuit 23

4.4 Result Testing 30

4.4.1 Condition 1 : Low Battery (30% and

Below)

30

4.4.2 Condition 2 : Average Battery (31% to

70%)

31

4.4.3 Condition 3 : High Battery ( 32

4.4.4 Condition 4 : Dangerous Level (101% and

Above)

33

4.5 Summary 35

CHAPTER V CONCLUSION 36

5.1 Introduction 36

5.2 Project Contribution 36

5.3 Project Constraints and Limitations 37

6.4 Future Works 38

6.5 Conclusion 39

REFERENCES 40

Page 11: MEASURING, CHARGING AND MONITORING THE BATTERY …

viii

LIST OF TABLES

TABLE TITLE PAGE

1.1 Gantt Chart of Final Year Project I 6

1.2 Gantt Chart of Final Year Project II 6

2.1 Table of Analysis Gap 10

Page 12: MEASURING, CHARGING AND MONITORING THE BATTERY …

ix

LIST OF FIGURES

FIGURE TITLE PAGE

1.1 Statistics on Estimated Consumer Battery Sales in 1992 2

2.1 Arduino UNO 13

3.1 Framework for Measuring, Charging and Monitoring the

Battery Using Embedded Programming

15

4.1 Installing Arduino IDE 1.8.5 20

4.2 Installing Fritzing 0.9.3b 20

4.3 Arduino UNO 21

4.4 Arduino Connected with Temperature Sensor 22

4.5 Coding for Blinking Any Relevant LED According To

The Battery Percentage

24

4.6 Schematic Drawing of Arduino Circuit 25

4.7 Arduino Circuit of the Project 25

4.8 Full Setup of the Project 26

4.9 The Console of the Arduino 26

4.10 The Console of the Arduino (Calculation) 27

4.11 The Console of the Arduino (Calculation) 28

4.12 The Console of the Arduino (Warning Message) 29

4.13 Relevant LED Blink at Low Battery 30

4.14 Serial Monitor Display The Output 31

4.15 Relevant LED Blink at Average Battery 31

4.16 Serial Monitor Display The Output 32

4.17 Relevant LED Blink at High Battery 32

4.18 Serial Monitor Display The Output 33

4.19 Relevant LED Blink at Dangerous Level of Battery 33

4.20 Serial Monitor Display The Output 34

Page 13: MEASURING, CHARGING AND MONITORING THE BATTERY …

x

LIST OF ABBREVIATIONS / TERMS / SYMBOLS

EHSO Environment, Health and Safety Online

EHS Environment, Health and Safety

AC Alternating Current

DC Direct Current

NiMH Nickel-Metal Hydride

LED Light-Emitting Diode

SoC State of Charge

SoH State of Health

PV Photovoltaic

BMS Battery Monitoring System

MATLAB Matrix Laboratory

PMU Power Management Unit

IoT Internet of Things

IDE Integrated Development Environment

MOSFET Metal Oxide Semiconductor Field Effect Transistor

FYP Final Year Project

USB Universal Serial Bus

Page 14: MEASURING, CHARGING AND MONITORING THE BATTERY …

1

CHAPTER 1

INTRODUCTION

1.1 Introduction

Batteries were the providers for the main source of electricity. Nearly

every sector of the electronics industry, use batteries. However, everything that

runs on a battery, is limited by the power output and energy life of the batteries

that runs on it. Once the batteries cannot be used, then they will be disposed

eventually into the trash.

When you need a portable, convenient power source, you can rely on

batteries. Batteries of all shapes and sizes supply power to everyday

electronics like toys and power tools, but batteries also work where we do not

see them too. During a power outage, phone lines still operate because they are

equipped with lead-acid batteries. The versatility of batteries is reflected in the

different sizes and shapes, but all batteries have two common elements that

combine to make power: an electrolyte and a heavy metal.

Page 15: MEASURING, CHARGING AND MONITORING THE BATTERY …

2

Batteries contain heavy metals such as mercury, lead, cadmium, and

nickel, which can contaminate the environment when batteries are improperly

disposed of. When incinerated, certain metals might be released into the air or

can concentrate in the ash produced by the combustion process.

Based on the research on battery from Environment, Health and Safety

Online (EHSO) they discuss about the disposal and recycling the alkaline

batteries safely through a survey of EHS Professionals. Figure 1.1 shows the

estimated consumer battery sales (1992) in Boro Bronx, New York. Result

from their investigation on 1992, the alkaline battery such as AAA, AA, C, D

and 9 Volts batteries have the highest number of sales compared to other types

of batteries, leaving 1.52 billion of zinc-carbon batteries far behind.

Figure 1.1: Statistics on Estimated Consumer Battery Sales in 1992

.

Page 16: MEASURING, CHARGING AND MONITORING THE BATTERY …

3

This project is developed to reduce the number of batteries in the waste

stream. This is done by recycling the rechargeable batteries. In this project,

Arduino UNO or microcontroller will be used in measuring the current battery

capacity, so that over-charged will not happen as it may damage the battery.

Besides, it will be combined with a temperature sensor as an extra precaution

step in monitoring the temperature of the battery.

In this project, a Nickel-Metal Hydride (NiMH) battery is chosen as it

is the most common type of AA rechargeable battery. In addition, it is much

easier to handle compared to others. A regulated voltage source, AC Adapter

will transmit the power to battery adapter as to charge the battery. This project

will save the earth from those heavy metals by recycling the battery using this

battery charger and make use of it to charge them.

1.2 Problem Statement

While using the batteries, there are several problems that may arise. It

cannot be denied that the batteries are main source of power providers in our

lives. Almost everything used batteries to power up electronics or any portable

power tools. However, batteries do not have long life span and must being

recharged.

The idea behind this project is that if a user wants to use a battery

continuously to power his devices, then he needs a charger to charge the

Page 17: MEASURING, CHARGING AND MONITORING THE BATTERY …

4

battery. Besides, charging a battery might be risky as he did not know the

current capacity; either it is already has fully charged or not.

Based on the problem statements that have been stated, it is important

to develop a battery charger and tester that help users to recharge their

batteries without spending a lot of money on commercial charger.

1.3 Objectives

We have identified objectives of the project. It can be identified as the

following :

To design a circuit that measure the battery capacity and display

it on Serial Monitor with the guidance from Light Emitting

Diode (LED)

To develop a circuit which charges the batteries while being

monitored by a temperature sensor

To test the circuit and provide an environmental friendly battery

charger

1.4 Project Scope

For this project, the scope is going to be developed only for the

rechargeable batteries, and in this project will be focusing on Nickel-Metal

Hydride batteries only. A regulated power supply through AC Adapter is used

for powering up the microcontroller and pass to the battery adapter to start

Page 18: MEASURING, CHARGING AND MONITORING THE BATTERY …

5

charging. Users may also know the current battery capacity in order to avoid

over-charging the devices.

1.5 Limitation of Works

Limitation of works are the constraints that may affect a project to be

accomplished. There are a few limitation of works that has been identified in

this project.

This battery tester and charger only being applied to rechargeable

batteries

The circuit applied for lower charge rate as to avoid overcharge

The circuit design for this charger is a basic Arduino power supply

1.6 Activities and Milestones

Activities and Milestones is a tool that is used to mark specific points

along a project timeline (Wikipedia, 2008). It is the checkpoint throughout the

life of a project. Whenever one or multiple group of activities have been

completed, thus it is implying that a notable point has been reached in the

project.

Page 19: MEASURING, CHARGING AND MONITORING THE BATTERY …

6

Table 1.1 Gantt Chart of Final Year Project I

Table 1.2 Gantt Chart of Final Year Project II

Month

Task

February March April May

1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4

Final Year Project I

Final Year Project Workshop

Topic Discussion and Determination

Registration of proposed project title

Submission of title and brief description of the

proposed project

Proposal Writing of Introduction

Proposal Writing of Literature Review

Preparation of Proposal and Presentation Slides

Proposal Progress Presentation and Evaluation

Amendment of Proposal & Proposed Solution

Methodology

Proof of Concept

Designing and implementing the framework

Drafting Report of The Proposal

Submission of Report’s Draft to Supervisor

Preparation for Seminar Presentation

Seminar Presentation I

Submission of Proposal Report

Month

Task

June July August

1 2 3 4 1 2 3 4 1 2 3 4

Final Year Project II

Project Progress Presentation and Evaluation

Project Implementation and Development

Project Testing

Project Documentation

Seminar Presentation II

Submission of Proposal Report

Amendment of Proposal Report

Final Submission of Project Report

Page 20: MEASURING, CHARGING AND MONITORING THE BATTERY …

7

CHAPTER 2

LITERATURE REVIEW

2.1 Introduction

In this chapter, we survey issues, theories and ideas from scholarly

articles or from the previous research, and any other sources that related to the

battery charger and tester. Through this review, we can jump into a conclusion

either the proposed project is suitable to implement or not. In addition, we can

even know either the technique or methodology that we used is acceptable or

not.

2.2 Battery Charger and Tester

In emerging with the current technology, people are using more and

more household batteries. This usage leads to the increasing rate of batteries

sales. Meanwhile, the environment get more harmful due to the incorrect way

of the disposal of the batteries. In order to save the environment, rechargeable

batteries are used as an initiative. A battery charger is developed. Rechargeable

batteries result in a longer life span and use fewer batteries. However

Page 21: MEASURING, CHARGING AND MONITORING THE BATTERY …

8

rechargeable batteries still contain heavy metals such as nickel-cadmium.

When disposing of rechargeable batteries, recycle if possible. (Environment,

Health and Safety Online Professionals, 2018)

2.3 Types of Battery Charger and Tester

Battery testing is designed to tell us things we want to know about

individual cells and batteries. While the answers are not always

straightforward, a few simple tests or measurements are being done to gain the

batteries’ State of Charge (SoC) and State of Health (SoH). Based on previous

research by (Muhammad Saqif bin Talib, 2015) the Battery Monitoring

System is interesting and a popular form of which the battery performance can

be observed easily. In the paper also stated that the technique lying under

battery charger and tester is solar battery charger. Photovoltaic (PV) is used to

convert the sunlight in the form of solar energy to electrical energy.

Referring to a previous research paper written by (Ignatius Nakhoywa

Barasa et al., 2017), the Battery Monitoring System (BMS) is the hardware

and technique used in this project. The State of Charge (SoC) of a car’s battery

are the parameters that were being monitored as to gain the real-time health

status of the car’s battery. It was done by providing reliable information and

notification of its working condition and the appropriate action to be taken

when need arises. Another previous research on car’s battery, (Ryan Savage,

May 2014) did his research on electric vehicles’ batteries. Using scalable

method of determining the remaining energy stored in a battery, the data

Page 22: MEASURING, CHARGING AND MONITORING THE BATTERY …

9

obtained using Arduino microcontroller then imported into Matrix Laboratory

(MATLAB) to study battery usage patterns and monitored the battery’s State

of Health (SoH).

In the higher technology, many kind of innovation and additional to the

previous system. For example, research paper written by (Selimcan Deda,

April 2013) was discuss about Smart Battery Power Management Unit (PMU).

This system is based on Battery Management System (BMS) which used

voltage loss associated with each engine cranking event to compute the State

of Health (SoH) of the car starter battery. Deda wrote that PMU system

monitors the voltages and the State of Charge (SoC) of whole battery module

and individual cells while ensuring reliability and safe battery operations.

Prefer to (Meng Di Yin et al., March 2016) is another type or method

of battery charger. Based on Internet of Things (IoT), this pulse-based fast

battery charger used two techniques to control the charging; which are

dynamic frequency technique and duty control technique. The optimal

dynamic frequency control is to minimize the impedance while achieving the

highest charging current. While the duty cycle is to keep the concentration on

polarization at a relatively low level. From these two techniques, the charging

process comply with the polarization curve, ensuring the maximum charge

speed without damaging the batteries.

Page 23: MEASURING, CHARGING AND MONITORING THE BATTERY …

10

2.4 Analysis Gap

Table 2.1 : Table of Analysis Gap

Authors /

Year Title Method Advantages Disadvantages

Ignatius

Nakhoywa

Barasa,

Justus

Simiyu,

Sebastian

Waita,

Denis

Wekesa

Automobile

Battery

Monitoring

System using

Arduino UNO

R3

Microcontroller

Board

Battery

Monitoring

System

(BMS)

Motorists no

need to wait

for battery

completely

failed before

replacing

Help optimize

the battery

utilization

Eliminate

failures from

unintended

discharge

Keep track of

the ability of

battery to store

and supply

charge

Can monitor

battery

performance

Conserve

energy

Save

expensive

battery repairs

Avoid being

inconvenience

by

breakdowns

from battery

failures

Page 24: MEASURING, CHARGING AND MONITORING THE BATTERY …

11

Meng Di

Yin,

Jeonghun

Cho,

Daejin Park

Pulse-Based

Fast Battery IoT

Charger Using

Dynamic

Frequency and

Duty Control

Techniques

Based on Multi-

Sensing of

Polarization

Curve

Dynamic

Frequency,

Duty Control

Techniques

Ensuring

maximum

charge speed

without

damaging the

battery

Can cause

difficulties in

implementing

Impact of

charger on

power grid

cannot be

ignored

Selimcan

Deda

Smart Battery

Power

Management

Unit

Power

Management

Unit

Provide

optimum use

of battery

powered

devices

PMU can alter

the effective

power-supply

source from

batteries

Prolongs the

battery life

Monitor of

PMU cannot

directly impede

the current

Ryan

Savage

Design and

Implementation

of A Battery

Monitoring

System for The

TCU

Engineering

Scalable

Method

Accurately

measure and

record the

voltage on

each

individual

battery used

Page 25: MEASURING, CHARGING AND MONITORING THE BATTERY …

12

Department

Electric Vehicle

Improve

maintenance

efforts

Muhammad

Saqif bin

Talib

Battery

Monitoring

System using

Arduino in Solar

Battery Charger

Solar Battery

Charger

Prevent

unplanned

outages on

critical power

backup system

Provides

permanent and

continuous

monitoring for

stand-by

battery

Analysis only

takes place on

DC Load

2.5 Technology Used

2.5.1 Embedded Programming

Embedded programming is a type of programming that does not

support the traditional operating system. It is well known for

microcomputer and microcontroller programming. Embedded

programming comes in C or C++ language, and only need to define

two functions; which are setup() {} and loop() {} in order to make a

program runnable. Setup() {} is a function that is going to run once at

the start of the program and can initialize settings itself. Meanwhile,

loop() {} is used to call continuously, until the board is powered off.

Page 26: MEASURING, CHARGING AND MONITORING THE BATTERY …

13

Through embedded programming and embedded hardware,

Arduino for instance, will act as the microcontroller in this project so

that the current battery capacity can be measured and the circuit will

supply the power source to charge the battery, and monitor the

temperature by a temperature sensor.

Figure 2.1 : Arduino UNO

2.6 Summary

This chapter discussed about the previous research of battery charger

circuit and the involved types. From the study, it shows that this chapter is

important as it helps in determining and generating the ideas. Besides, all those

articles and journals will be compared and the best architecture or technique is

chosen to be used for this project.

Page 27: MEASURING, CHARGING AND MONITORING THE BATTERY …

14

CHAPTER 3

METHODOLOGY

3.1 Introduction

According to Wikipedia, methodology is defined as the systematic,

theoretical analysis of the methods applied to a field of study. It comprises

the theoretical analysis of the body of methods and principles associated

with a branch of knowledge. In this chapter, we will look into the detailed

explanation of methodology that is used to define and analyse the

requirement needed in order to complete this project. The methodology is

being used as to ensure that the project can fulfil the objectives and the

device can be accomplished successfully in the end of this project.

Page 28: MEASURING, CHARGING AND MONITORING THE BATTERY …

15

3.2 Framework

Figure 3.1: Framework for Measuring, Charging and Monitoring the Battery

Using Embedded Programming

Based on Figure 3.1 that shows the framework of the circuit, a

regulated voltage source with 5 volt powered up the circuit. The 5V source

charges the battery through 10 ohm power resistor. The 10 ohm resistor is used

to control the flow of the current coming from the battery so the Arduino will

be able to take in. A power Metal Oxide Semiconductor Field Effect Transistor

(MOSFET) is also used in this circuit to set how much current is allowed to

flow into the battery. The 1 Mohm resistor is included as an easy way to

monitor the current. The 1 Mohm resistor is combined with a capacitor as to

allow the Arduino to monitor and control the current flowing into the battery.

Page 29: MEASURING, CHARGING AND MONITORING THE BATTERY …

16

As an extra precaution, a temperature sensor was included to monitor

the temperature of a battery. This sensor outputs a signal voltage that directly

corresponds to the temperature. The sensor is mounted in place by putting it

besides the battery itself so that it sits against the side of the battery when

installed. All these data gained such as the temperature and the battery’s

capacity will be displayed on Serial Monitor and the LED respectively.

In order to get specific reading of the temperature and voltage flowed,

a few calculation should be made. First of all, the readings of the voltage and

the temperature are taken. These data are obtained in analog reading, but then

the Arduino will convert the analog into digital reading. The reading is

converted through the connection between the breadboard and the Arduino.

Next, these data are then being calculated to obtain the results in correct form.

Therefore, the final information that is being displayed is the final results. In

addition, the LED will light after a few seconds, showing the battery level. It

involves three (3) colours of LED which are Green, Yellow and Red. If the

battery in is low or high capacity will cause the red or green LED to blink, thus

leaving the yellow one to blink if the battery’s capacity is in average condition.

For the user to observe the taken data in specific time; saying that each

reading is taken after 10 minutes, hence the user may observe the data in

Serial Monitor of his sketch, a “tether” between the computer and the

Arduino. In a simpler terms, serial monitor is a platform between a computer

and the Arduino to communicate between each other. It is the place for the

Page 30: MEASURING, CHARGING AND MONITORING THE BATTERY …

17

user to control the Arduino only from the keyboard, and let user sends,

receives and even print messages. However, the temperature and the battery

level both can be monitored on the Serial Monitor.

3.3 System Requirement

This section will show the list of all software and hardware that

involved in the project. It is the most important part for every project as it is

the guidance of a successful project; without them the project cannot be

accomplish.

3.3.1 Software Requirement

Software requirements of this project is :

i. Arduino 1.8.5

ii. Fritzing 0.9.3b

3.3.2 Hardware Requirement

Hardware requirements of this project are :

i. HP 14 Notebook PC

ii. Arduino UNO microcontroller

iii. Nickel-Metal Hydride AA Battery

iv. 220 ohm Resistor

v. 10 Kohm Resistor

vi. 1 µF Capacitor

Page 31: MEASURING, CHARGING AND MONITORING THE BATTERY …

18

vii. IRF510 MOSFET

viii. TMP36 Temperature Sensor

ix. 9V Regulated Power Supply

x. Prototyping Breadboard

xi. Jumper Wires

xii. LED

3.4 Summary

This chapter fully describe the methodology used to complete this

project together with software and hardware specification used are also listed.

The framework is explained as the expected output in the end of this project.

Page 32: MEASURING, CHARGING AND MONITORING THE BATTERY …

19

CHAPTER 4

IMPLEMENTATION AND RESULT

4.1 Introduction

Implementation as being defined by TechTarget.com is the process of

constructing a method, any idea or for doing something. Meanwhile, result is

the outcome that we achieved after the testing process.

In this chapter, implementation and testing are being conducted as to

ensure that our circuit has been successfully completed without any problems

before being fully utilized. In addition, this phase is also intended to ensure

that this project is fully meet the user requirement. Implementation and testing

are done based on real devices and the results gained from this phase shows

the achievement to complete this project.

4.2 Software

There are two (2) software that were installed while carrying out this

project.

Page 33: MEASURING, CHARGING AND MONITORING THE BATTERY …

20

4.2.1 Arduino IDE 1.8.5

In order to ensure that the microcontroller or the Arduino UNO

and the laptop communicated between each other, thus Arduino IDE

1.8.5 was installed. This IDE is the place where the process of sending

and receiving information occurs between the laptop and the Arduino

UNO.

Figure 4.1 Installing Arduino IDE 1.8.5

4.2.2 Fritzing 0.9.3b

This software is a tutorial software allows to design our own

circuit, including editing the coding to be uploaded into the Arduino

UNO. Besides, this software allows to do experiment with a circuit

prototype before building a permanent circuit.

Figure 4.2 : Installing Fritzing 0.9.3b

Page 34: MEASURING, CHARGING AND MONITORING THE BATTERY …

21

4.3 Hardware

The main hardware that has been used in this project is Arduino UNO.

A generic sensor which is temperature sensor is connected to the Arduino

UNO as to receive the data in analog reading. The Arduino UNO is connected

to the laptop using a Universal Serial Bus (USB) cable. Figure 4.3 shows the

Arduino UNO being used for this project.

Figure 4.3 : Arduino UNO

4.3.1 Arduino Setup

Arduino is an open-source platform based on easy-to-use

hardware and software. It consists of both a microcontroller (a

hardware) and a piece of software which is Integrated Development

Environment (IDE) that runs on the computer, where we can write and

Page 35: MEASURING, CHARGING AND MONITORING THE BATTERY …

22

upload the computer code to the physical board. In this project,

Arduino UNO is used which the board is a microcontroller based on

ATmega328P. The board is completed with all needed features, and

can be simply connected or powered by USB cable or by an external 9

volt battery.

In this project, a generic sensor is connected to the Arduino

UNO which is a temperature sensor TMP36 which functions to send

analog reading of the battery’s temperature within the time allocated.

Arduino works as microcontrollers which becomes the third party

between the sensor and user as it gives instruction to the generic

sensors.

Figure 4.4 : Arduino Connected with Temperature Sensor

Page 36: MEASURING, CHARGING AND MONITORING THE BATTERY …

23

4.3.2 Arduino Circuit

For this project, an electrical circuit is made. In this circuit, it

shows the functionality of the temperature sensor and the battery

indicator which can be seen through the Serial Monitor.

The working principle of the circuit is very simple. As we do

have a 9V regulated power supply, it will provide power to the circuit

to function. A double A (AA) battery will be charged through the

power supply and the current flow is controlled by the capacitor,

resistor and the MOSFET.

Besides, a temperature sensor is added to the circuit as the

safety precautions for the user to monitor the current battery’s

temperature. The sensor then gives the result to Arduino as analog

input. The Arduino is then programmed to display the result in digital

output in the Serial Monitor.

In the same time, three LEDs are included on the circuit which

are Red, Yellow and Green in colour as a guideline of the battery level

for the user to monitor. If the battery percentage is equal to 0% until

29&, then the Red LED will blink, showing that the battery is in low

level state. Meanwhile, the Yellow LED will blink if the battery

percentage is in range between 30% until 70%. The remaining

Page 37: MEASURING, CHARGING AND MONITORING THE BATTERY …

24

percentage will blink the Green LED. The coding of this LED can be

seen in Figure 4.5 below.

Figure 4.5 : Coding For Blinking Any Relevant LED According to the

Battery Percentage

List of Required Hardware :

i. Arduino UNO microcontroller

ii. Nickel-Metal Hydride AA Battery

iii. 220 ohm Resistor

iv. 10 Kohm Resistor

v. 1 µF Capacitor

vi. IRF510 MOSFET

vii. TMP36 Temperature Sensor

Page 38: MEASURING, CHARGING AND MONITORING THE BATTERY …

25

viii. 9V Regulated Power Supply

ix. Prototyping Breadboard

x. Jumper Wires

xi. LED

Figure 4.6 : Schematic Drawing of Arduino Circuit

Figure 4.7 : Arduino Circuit of the Project

Page 39: MEASURING, CHARGING AND MONITORING THE BATTERY …

26

Figure 4.8 : Full Setup of the Project

Figure 4.8 shows the complete setup of the project. The

Arduino UNO is connected to the laptop, acting as the microcontroller

to receive and sends data.

Figure 4.9 : The Console of Arduino

Page 40: MEASURING, CHARGING AND MONITORING THE BATTERY …

27

Figure 4.9 shows the coding of getting the reading input from the

MOSFET, battery and the temperature sensor. All those three hardware are

connected to Analog Pin A0, A1 and A2 respectively as the data are received

in analog. The Arduino UNO will then convert the analog input to digital

input, and displaying the data in the Serial Monitor through coding

Serial.println() in digital input after some calculation has been made. This

calculation can be seen as being showed in Figure 4.10 and Figure 4.11.

Figure 4.10 : The Console of Arduino (Calculation)

Page 41: MEASURING, CHARGING AND MONITORING THE BATTERY …

28

Figure 4.11 : The Console of Arduino (Calculation)

From the Figure 4.10 and Figure 4.11, both console are

showing the calculation of getting the correct output. In Figure 4.10

shows the Arduino UNO is connected to all outputPin as to write out all

the outputValue that are gained. Next, calculations are made starting

from reading the input value from all the connections and then

performing some calculations of converting the voltage into intended

output. The output are then being displayed on the Serial Monitor

through the code Serial.println();. As for the LED, the LED will blink if

the battery’s percentage are relevant with the average that has been

fixed.

Page 42: MEASURING, CHARGING AND MONITORING THE BATTERY …

29

There are some cases if the battery’s percentage is increasing

and over 100%, or maybe the current or voltage flowing in while

charging the battery is not even reach the minimum voltage or

exceeded the maximum voltage, then the Red LED will emit. This is

because the expected results are not reaching or exceeded from the

values that has been fixed. Besides, it is a sign that the incoming flow

of current of voltage is either higher or lower from the expected, thus

triggering warning message to be printed out. These are another safety

precautions that have been added into this project as to be more careful

while handling with the project.

Figure 4.12 : The Console of Arduino (Warning Message)

Page 43: MEASURING, CHARGING AND MONITORING THE BATTERY …

30

4.4 Result Testing

In this section, the screenshot of the results from the Serial

Monitor will be displayed here. This is to show the main prove as the

project has been carried out. While the battery is being charged, there are

four (4) conditions that will be displayed and two results from each

condition are showed; the printed output displayed in the Serial Monitor and

the blinked relevant LED according to the battery’s percentage.

4.4.1 Condition 1 : Low Battery (30% and Below)

Figure 4.13 : Relevant LED Blink at Low Battery

Page 44: MEASURING, CHARGING AND MONITORING THE BATTERY …

31

Figure 4.14 : Serial Monitor Display the Output

As being shown before, if the battery’s percentage is

below 30%, therefore the Red LED will emit. In Figure 4.14,

the current battery percentage is 27%, thus triggering the Red

LED to blink as shown in Figure 4.13.

4.4.2 Condition 2 : Average Battery (31% to 70%)

Figure 4.15 : Relevant LED Blink at Average Battery

Page 45: MEASURING, CHARGING AND MONITORING THE BATTERY …

32

Figure 4.16 : Serial Monitor Display the Output

As being shown before, if the battery’s percentage is

between the range 31% to 70%, therefore the Yellow LED will

emit. In Figure 4.16, the current battery percentage is 52%, thus

triggering the Yellow LED to blink as shown in Figure 4.15.

4.4.3 Condition 3 : High Battery (71% to 100%)

Figure 4.17 : Relevant LED Blink at High Battery

Page 46: MEASURING, CHARGING AND MONITORING THE BATTERY …

33

Figure 4.18 : Serial Monitor Display the Output

As being shown before, if the battery’s percentage is

reaching 100% from 71%, therefore the Green LED will emit.

In Figure 4.18, the current battery percentage is 83%, thus

triggering the Green LED to blink as shown in Figure 4.17.

4.4.4 Condition 4 : Dangerous Level (101% and Above)

Figure 4.19 : Relevant LED Blink at Dangerous Level of Battery

Page 47: MEASURING, CHARGING AND MONITORING THE BATTERY …

34

Figure 4.20 : Serial Monitor Display the Output

In this condition, as shown in Figure 4.20 where the

battery percentage reached 254%, which is exceeded the normal

percentage that has been fixed; 100%. Hence, the Red LED will

emit, and a warning message has been printed out on the Serial

Monitor, giving warning to the user that the charging process is

dangerous. As the voltage is exceeded the safety threshold,

therefore the charging process will be stopped immediately, to

prevent from the circuit burnt out.

Page 48: MEASURING, CHARGING AND MONITORING THE BATTERY …

35

4.5 Summary

In this chapter, the implementation, testing and results of the project

were explained. The implementation phase involving two parts; which are the

Hardware Part and the Software Part. This phase allowed us to see whether our

circuit had operate or functioned well without any problems. The screenshot of

the circuit were shown for the guidance. The four conditions of the battery

percentage were presented to show the result, and were explained in the end of

the figures.

Page 49: MEASURING, CHARGING AND MONITORING THE BATTERY …

36

CHAPTER 5

CONCLUSION

5.1 Introduction

In this chapter on the conclusion, it discuss on the contribution of

Measuring, Charging and Monitoring the Battery Using Embedded

Programming. Moreover, project constraints and limitations that will state all

the difficulties that have been throughout the development of the circuit, and

future works of this project will also be discussed in this chapter.

5.2 Project Contribution

Measuring, Charging and Monitoring the Battery Using Embedded

Programming was developed based on the objectives that have been proposed

and discussed throughout the earlier chapter. Other than the battery charger

monitors and maintains the battery performance, it is also being developed to

help maximize a battery’s lifespan.

Rechargeable batteries use less energy because recharging batteries

with a battery charger is more energy efficient than the cost and energy of

making new batteries. They do give a peak performance at all times, even

Page 50: MEASURING, CHARGING AND MONITORING THE BATTERY …

37

when the "low battery" signal comes on. Moreover, they also produce less

waste because they can be recharged with a simple battery charger and reused

hundreds of times. Lastly, the project is successfully developed and has met

the objective.

5.3 Project Constraints and Limitation

Generally, as being defined above project constraints is about the

restrictions that defines the project’s limitation; while limitation is the limit of

what the project is expected to accomplish. In this project, there are a few

problems and limitations that occurred throughout the development of the

circuit.

High cost to apply for higher charge rate as the need to design

different circuit for compatibility. Furthermore, more tools and

equipment are needed to measure and charge other types of

batteries.

Difficulties in getting the constant, and accurate reading of the

battery’s capacity and temperature due to the noise from the USB,

making the incoming voltage from both external charger and the

USB 14V altogether.

Low performance of the battery charger as this circuit was designed

for low-cost solution towards the users; thus a good and high

demand charger is not expected.

Page 51: MEASURING, CHARGING AND MONITORING THE BATTERY …

38

High in risk while developing the coding into the microcontroller or

Arduino. If there is one slight mistake, then either the battery or the

Arduino itself might damage; in serious case might explode.

5.4 Future Works

In the future, there are still a lot of features that can be added or made

to upgrade the circuit. Every developer must have aims to improve their

project to become more efficient and environmentally friendly. Some

suggestions that are need to be considered are :

The circuit may generate results and presented the report in graph

and other charts as we may know the performance of the battery

while charging.

More specific data regarding the battery’s temperature, and the

battery’s capacity, so that a very detail result and report can be used

efficiently.

Use a high quality of temperature sensor as to measure and monitor

battery’s temperature more accurately.

Enhance the circuit design to apply for all types of rechargeable

batteries.

Improvise the basic Arduino circuit to higher charging rate as the

charger can be used for all types of batteries.

Page 52: MEASURING, CHARGING AND MONITORING THE BATTERY …

39

5.5 Conclusion

Measuring, Charging, and Monitoring the Battery Using Embedded

Programming is a circuit that to help user to recharge their rechargeable

batteries as to save time and cost to go and buy for another same battery.

Furthermore, it is to educate people to apply the concept of 3R; Reduce,

Reuse, and Recycle the hazardous batteries that might harm and contaminate

our environment with the hazardous chemical substances in the batteries.

Another option is that this circuit is to save time and save cost of the users as

they do not have to run to buy and pay for the same battery for ensuring the

power source is still on the track; thus this charger was developed as to cut all

the efforts.

Page 53: MEASURING, CHARGING AND MONITORING THE BATTERY …

40

REFERENCES

Ignatius Nakhoywa Barasa, Justus Simiyu, Sebastian Waita, and Denis Wekesa. (July,

2017). Automobile Battery Monitoring System using Arduino UNO R3

Microcontroller Board. The International Journal of Science and Technology (IJST),

5(6), 24-35.

Meng Di Yin, Jeonghun Cho, and Daejin Park. (17 March, 2016). Pulse-Based Fast

Battery IoT Charger Using Dynamic Frequency and Duty Control Techniques Based

on Multi-Sensing of Polarization Curve. 2-19. DOI:10.3390/en9030209

Selimcan Deda. (February, 2017). Smart Battery Power Management Unit (PMU).

Retrieved from

https://dspace.cc.tut.fi/dpub/bitstream/handle/123456789/22152/Deda.pdf?sequence=

1

Ryan Savage. (2 May, 2014). Design and Implementation of A Battery Monitoring

System for The TCU Engineering Department Electric Vehicle. Retrieved from

https://repository.tcu.edu/bitstream/handle/116099117/7334/Savage__Ryan_--

_Senior_Honors_Thesis.pdf?sequence=1&isAllowed=y

Muhammad Saqif bin Talib. (2015). Battery Monitoring System using Arduino in

Solar Battery Charger. Retrieved from

http://eprints.utem.edu.my/17464/1/Battery%20Monitoring%20System%20Using%20

Arduino%20In%20Solar%20Battery%20Charger%2024%20Pages.pdf

Brian W. Evans. (2007). Arduino Programming Notebook. Retrieved from

http://playground.arduino.cc/uploads/Main/arduino_notebook_v1-1.pdf

Seth Gyebi. (25 March, 2017). Smart Battery Charger. Retrieved from

https://web.wpi.edu/Pubs/E-project/Available/E-project-042417-

125329/unrestricted/Major_Qualifying_Project_4.pdf

Chester Simpson. (2011). LM2576, LM3420, LP2951, LP2952; Battery Charging.

Retrieved from http://www.ti.com/lit/an/snva557/snva557.pdf

Chester Simpson. (2011). Characteristics of Rechargeable Batteries. Retrieved from

http://www.ti.com/lit/an/snva533/snva533.pdf

Scott Dearborn. (April 2005). Charging Li-ion Batteries for Maximum Run Times.

Power Electronics Technology, 40-49. Retrieved from

https://pdfs.semanticscholar.org/e46c/5f4c635e1ae98dacc76bfca3e8aa71a2800d.pdf

Masaru Mizuta, Kamakura (JP). (Jan. 6, 2004). United States Patent No. US 6,674,185

B2. Tokyo