IoT-Enhanced EV Battery Management
IoT-Enhanced EV Battery Management
iii
ABSTARCT
This paper describes the application of Internet-of-things (IoT) in monitoring
the performance of electric vehicle battery. It is clear that an electric vehicle
totally depends on the source of energy from a battery. However, the amount
of energy supplied to the vehicle is decreasing gradually that leads to the
performance degradation. To develop a sophisticated Battery Management
System (BMS) for a hybrid renewable energy-based Electric Vehicle (EV)
charging station. The primary goal is to efficiently integrate and manage
energy derived from multiple renewable sources, such as solar and wind, to
power EV charging infrastructure. The BMS is designed to optimize battery
performance, enhance lifespan, and ensure safety while managing the storage
and discharge of electrical energy. This is a major concern for battery
manufacture. In this work, the idea of monitoring the performance of the
vehicle using IoT techniques is proposed, so that the monitoring can be done
directly. The proposed IoT-based battery monitoring system is consists of two
major parts i) monitoring device and ii) user interface. Based on experimental
results, the system is capable to detect degraded battery performance and
sends notification messages to the user for further action.
iii
TABLE OF CONTENTS
iii
4.1.10 LCD 34
4.1.11 ADC 38
4.2 SOFTWARE DESCRIPTION 39
4.2.1 ARDUINO IDE 39
4.2.2 EMBEDDED C 42
4.2.3 PROTEUS 45
4.3 TECHNOLOGY DESCRIPTION 47
4.3.1 IOT 47
5 RESULTS AND DISCUSSION 54
5.1 PROGRAM PART 54
5.2 CIRCUIT DESIGN 55
5.3 SIMULATION DESIGN 56
6 CONCLUSION AND FUTURE SCOPE 57
6.1 CONCLUSION 57
6.2 FUTURE SCOPE 57
REFERENCES 58
iv
LIST OF FIGURES
v
LIST OF ABBREVIATIONS
vi
CHAPTER 1
INTRODUCTION
The vehicle population is increasing day by day and is expected to exceed
the human population in the upcoming years. This would also result in the
consumption of fossil fuels and the extinction of nonrenewable resources. Hybrid
and electric vehicles are gaining popularity, improving charging station
infrastructure a necessity. Superchargers and mega-chargers have set a benchmark
for fast charging of high-capacity vehicle batteries. their dispersion into the
vehicle market has not been up to the mark because of the reason that it is less
cost effective and these vehicles need to recharge once in 60 to 70 km drive. The
hybrid vehicles play a major role in the present market and it obtains their energy
from the combustion engine.
However, in order to alleviate the utilization of gasoline, the plug-in
electric vehicles (PHEVs) entered into the market and it takes the energy from the
grid for driving. To increase the life of storage system, cost reduction, and the
flexible grid connectivity, the PHEVs are still under research. Nowadays, the park
stations, roadside units, and the standard home outlets are used to charge the
battery packs of EVs. The storage system present in the EV takes a prolonged
period for recharging the battery packs and it will vary depending upon the
capacity Commercial charging stations are available but only at places with high
EV expectancy regions. India’s mobility mantra of “Shared, connected and
Electric” with 100% EV by 2030 seems to be quite ambitious, but with increased
awareness amongst the consumers and aiding government policies, this goal can
be achieved.
Ministry of power and Dept. of Heavy Industry Ministry has invited
proposals with a target of 1000 EVCS and Tata power has proposed to build
around 500 EVCS by 2021. In mega- cities, multi-level parking stations, malls,
multiplexes are available with a large parking capacity for vehicles.
1
The system voltage and current oscillations will also be monitored
continuously in real-time. Charging will be based on the amount paid. The power
of the battery will never be dry because we use two major energy sources that are
solar energy and wind energy.
2
CHAPTER 2
LITERATURE SURVEY
LITERATURE REVIEW 1
TITLE
YEAR
2022
DESCRIPTION
This paper integrates CSMS through smart contracts, providing EV users that
ability to conduct power transactions and perform optimal charging and
discharging control in real-time. The distributed ledger is in charge of recording all
the EV charging and discharging data to maintain fairness of power transactions,
protects data from being maliciously tampered, and enables the EV user to monitor
status of the EV participating in power transactions and dispatching. The intelligent
CSMS consists of an artificial intelligence (AI) module, centralized optimal
scheduling module, and decentralized optimal control module. The AI module is
responsible for forecasting renewable energy generation and load consumption.
There is a two-layer architecture consisting of centralized and decentralized
optimal control modules
DISADVANTAGE
3
LITERATURE REVIEW 2
TITLE
System Design and Realization of a Solar-Powered Electric Vehicle Charging
Station
YEAR
2020
DESCRIPTION
The charging station is supplied from two sources used for recharging the vehicles
parked under a shed, viz., the conventional utility grid electricity and also solar
PV-based electricity. the charging station supplies the solar power to the vehicles
coming for charging by utilizing solar energy during the day time and the
conventional grid power in the night hours.
DISADVANTAGE
This system uses two energy to implement the vehicle charging station. Day time
for solar and night time for grid. In case of night time any shortages occur no steps
to protect that station.
4
LITERATURE REVIEW 3
TITLE
Multi objective Planning Strategy for the Placement of Electric-Vehicle Charging
Stations Using Hybrid Optimization Algorithm
YEAR
2022
DESCRIPTION
5
LITERATURE REVIEW 4
TITLE
ACN-Sim: An Open-Source Simulator for Data-Driven Electric Vehicle Charging
Research
YEAR
2021
DESCRIPTION
ACN-Sim provides a modular, extensible architecture, which models the
complexity of real charging systems, including battery charging behavior and
unbalanced three-phase infrastructure. It also integrates with a broader ecosystem
of research tools. These include ACN-Data, an open dataset of EV charging
sessions, which provides realistic simulation scenarios, and ACN-Live, a
framework for field-testing charging algorithms. It also integrates with grid
simulators like MATPOWER, Panda Power and Open DSS, and Open AI Gym
for training reinforcement learning agents.
DISADVANTAGE
Open source applications may be tricky to set up and use.
6
LITERATURE REVIEW 5
TITLE
On the Role of Renewable Energy Policies and Electric Vehicle Deployment
Incentives for a Greener Sector Coupling
YEAR
2022
DESCRIPTION
The Initial Cost of Renewable Energy Is High. And it is Not Available Round the
Clock
7
CHAPTER 3
SYSTEM IMPLEMENTATION
3.1 OBJECTIVE
To design and engineer a BMS that optimally manages the charging and discharging
processes of the battery storage system. This includes ensuring the health and
longevity of batteries, efficient energy storage, and retrieval, as well as safety and
reliability in operations.
To utilize advanced algorithms and control strategies to optimize the storage and
usage of harvested energy, ensuring that energy is available for EV charging as
needed, regardless of the variability in renewable energy generation.
To improve the overall efficiency of the charging station and make the operation
cost-effective. This involves minimizing energy losses, reducing operational costs,
and optimizing resource allocation.
To develop a BMS that can be scaled and adapted to different sizes and types of EV
charging stations and can be integrated with various types and capacities of
renewable energy systems and battery storage solutions.
3.1 EXISTING METHOD
The system of or project is shown, First step towards the progress is to measure
the voltage level of a battery available in the car then the SIM module we are
using SIM808V 3.2 reads the current location of a vehicle then they are will be
a heat sensor which will continuously working on detecting heat of a battery.
As the voltage sensor program with the arduino will display the current battery
charged percentage and we will set a certain limit beyond that if a battery
charge percentage go then it will notify a user and we will also a threshold heat
unit beyond that if battery temperature goes then both sensor which are
connected to arduino will send a signal to module which will eventually send
your the current location to a proper authority.
8
3.2.1 PROBLEM IDENTIFICATION
• The government will plan to introduce electric vehicles but our mindset will always
Also, some fuel stations are not giving proper quantity and quality fuels.
9
3.2.2 DISADVANTAGES
The system relies on Arduino and SIM808V modules, which may have limited
scalability.
As the number of vehicles equipped with this system increases, managing and
maintaining them could become challenging.
The system relies on SIM modules for communication, which means it's dependent
on cellular networks.
It protects the battery pack from being over charge (cell voltages goes high) or over
discharge (cell voltages goes low) in this way the battery’s life. It does by
constantly monitoring every cell in the battery pack and calculating exactly how
much current is safely going in (charge) and come out (discharge) of the battery
pack without damaging it.
It also calculates the state of charge by tracking how much energy goes in and out
by monitoring the cell voltage. It monitors the complete health of the battery pack
by continuously checking for loose connections, breakdowns in wire insulations and
defective cells that need to be replaced in the battery pack.
These parameters gives notifications to the user for safe operations of the battery
pack.
10
3.3.1 PROPOSED BLOCK DIAGRAM
12V VOLTAGE
Buck boost REGULATOR 7805 IC 7812 IC
converter BATTERY
SOLAR
PANEL
Voltage sensor 1 Relay module
LCD DISPLAY
TEMPERATURE SENSOR
SPI
IOT
11
3.3.3 ADVANTAGE
The system provides real-time monitoring of the battery's voltage level and
temperature.
This enables timely detection of any abnormalities or issues with the battery,
allowing for proactive maintenance and preventing potential failures.
By promptly alerting users and authorities, the system helps mitigate safety risks
associated with battery operation.
CHAPTER 4
12
PROJECT DESCRIPTION
4.1 HARDWARE DESCRIPTION
4.1.1 ESP32 MICROCONTROLLER
14
Cryptographic hardware acceleration: AES, SHA-2, RSA, elliptic
curve cryptography (ECC), random number generator (RNG)
Power management:
Internal low-dropout regulator
Solar modules use light energy (photons) from the sun to generate electricity
through the photovoltaic effect. The majority of modules use wafer-based crystalline
silicon cells or thin- film cells based on cadmium telluride or silicon. The structural
(load carrying) member of a module can either be the top layer or the back layer. Cells
must also be protected from mechanical damage and moisture. Most solar modules are
rigid, but semi-flexible ones are available, based on thin- film cells. These early solar
modules were first used in space in 1958.
Electrical connections are made in series to achieve a desired output voltage
15
and/or in parallel to provide a desired current capability. The conducting wires that
take the current off the modules may contain silver, copper or other non-magnetic
conductive transition metals. The cells must be connected electrically to one another
and to the rest of the system usage photovoltaic modules use MC3(older) or MC4
connectors to facilitate easy weatherproof connections to the rest of the system.
Bypass diodes may be incorporated or used externally, in case of partial module
shading, to maximize the output of module sections still illuminated.
Some recent solar module designs include concentrators in which light is focused by
lenses or mirrors onto an array of smaller cells. This enables the use of cells with a
high cost per unit area (such as gallium arsenide) in a cost-effective way.
Multiple solar cells in an integrated group, all oriented in one plane, constitute a solar
photovoltaic panel or solar photovoltaic module. Photovoltaic modules often have a
sheet of glass on the sun-facing side, allowing light to pass while protecting the
semiconductor wafers. Solar cells are usually connected in series in modules, creating
an additive voltage. Connecting cells in parallel yields a higher current; however,
problems such as shadow effects can shut down the weaker (less illuminated) parallel
string (a number of series connected cells) causing substantial power loss and possible
damage because of the reverse bias applied to the shadowed cells by their illuminated
partners. Strings of series cells are usually handled independently and not connected in
parallel, though individual power boxes are often supplied for each module, and are
connected in parallel. Although modules can be interconnected to create an array with
the desired peak DC voltage and loading current capacity, using independent MPPTs
(maximum power point trackers) is preferable. Otherwise, shunt diodes can reduce
shadowing power loss in arrays with series/parallel connected cells.
16
The substrate or superstrate is laminated with an encapsulant to a front or back
sheet, usually another sheet of glass. The main cell technologies in this category
are CdTe, or a-Si, or a-Si+uc-Si tandem, or CIGS (or variant). Amorphous
silicon has a sunlight conversion rate of 6-12%.
MODULE PERFORMANCE:
Module performance is generally rated under standard test conditions (STC):
irradiance of 1,000 W/m², solar spectrum of AM 1.5 and module temperature at 25
°C. Electrical characteristics include nominal power (PMAX, measured in W),
open circuit voltage (VOC), short circuit current (ISC, measured in amperes),
maximum power voltage(VMPP), maximum power current (IMPP), peak power,
Wp, and module efficiency (%).
Nominal voltage refers to the voltage of the battery that the module is best
suited to charge; this is a leftover term from the days when solar modules were
only used to charge batteries. The actual voltage output of the module changes as
lighting, temperature and load conditions change, so there is never one specific
voltage at which the module operates. Nominal voltage allows users, at a glance,
to make sure the module is compatible with a given system.
Open circuit voltage or VOC is the maximum voltage that the module can produce
when not connected to an electrical circuit or system. V OC can be measured with a
meter directly on an illuminated module's terminals or on its disconnected cable.
The peak power rating, Wp, is the maximum output under standard test
conditions (not the maximum possible output). Typical modules, which could measure
approximately 1x2 meters or 2x4 feet, will be rated from as low as 75 watts to as high
as 350 watts, depending on their efficiency. At the time of testing, the test modules are
binned according to their test results, and a typical manufacturer might rate their
modules in 5 watt increments, and either rate them at +/- 3%, +/-5%,
17
+3/-0% or +5/-0%.
4.1.3 IR SENSOR
Infrared sensors are the most often used sensor by amateur roboteers.
Understanding how they behave can help address many of your requirements
and would suffice to address most of the problem statements for various
robotics events in India. Be it a typical white/black line follower, a wall
follower, obstacle avoidance, micro mouse, an advanced flavor of line follower
like red line follower, etc, all of these problem statements can be easily
addressed and granular control can be exercised upon your robots performance
if you have a good operational understanding of Infrared sensors.
CONSTRUCTION OF IR MODULE
Infrared sensors are in the form of diodes with 2 terminals. You can buy a pair
of such diode (one transmitter and one receiver) at a very low cost of about 5 -
7 rupees only. Here onwards, we will use Tx to refer to a transmitter and Rx to
refer to a receiver diode.
18
Upon careful observation, you will notice that amongst the two ‘legs’, one has
a much wider base within the diode. That is normally the cathode (negative)
whereas the leg having a smaller base would be the anode (positive terminal).
When the Tx is forward biased, it begins emitting infra red. Since it’s not in
visible spectrum, you will not be able to see it through naked eyes but you will
be able to view it through an ordinary cell phone camera.
The resistance R1 in the above circuit can vary. It should not be a very high
value (~ 1Kohm) as then the current flowing through the diode would be very
less and hence the intensity of emitted IR would be lesser. By increasing the
current flowing in the circuit, you can increase the effective distance of your
IR sensor. However, there are drawbacks of reducing the resistance. Firstly, it
would increase the current consumption of your circuit and hence drain the
battery (one of the few ‘precious’ resources for any embedded system) faster.
Secondly, increasing the current might destroy the Tx. So, the final choice
should be a calculated tradeoff between these various factors.
You can also modulate the IR to achieve better distance and immunity.The
receiver diode has a very high resistance, typically of the order of mega Ohms
19
when IR is not incident upon it. However, when IR is incident upon it, the
resistance decreases sharply to the order of a few kilo Ohms or even lesser.
This feature forms the basis of using IR as a sensor. You will need to connect
a resistance of the order of a few mega Ohm in series with the Rx. Then tap
the output voltage at the point of connectivity of these two resistors. A
complete Tx-Rx circuit is given below.
4.1.4 BATTERY
20
There are two types of batteries: primary batteries (disposable batteries),
which are designed to be used once and discarded, and secondary
batteries (rechargeable batteries), which are designed to be recharged and used
multiple times. Batteries come in many sizes from miniature cells used to
power hearing aids and wristwatches to battery banks the size of rooms that
provide standby power for telephone exchanges and computer data centers.
Batteries are classified into two broad categories, each type with advantages and
disadvantages.
21
Secondary batteries can be recharged; that is, they can have their chemical
reactions reversed by supplying electrical energy to the cell, restoring their
original composition.
Some types of primary batteries used, for example, for telegraph circuits, were
restored to operation by replacing the components of the battery consumed by the
chemical reaction. Secondary batteries are not indefinitely rechargeable due to
dissipation of the active materials, loss of electrolyte and internal corrosion.
PRIMARY BATTERIES
SECONDARY BATTERIES
22
the chemical reactions that occur during its use. Devices to supply the appropriate
current are called chargers or rechargers.
DESCRIPTION :
23
This module is based on resistance points pressure principle, and it can
make the input voltage of red terminal reduce 5 times of original voltage.
The max Arduino analog input voltage is 5 V, so the input voltage of this
module should be not more than 5 V x 5 = 25 V ( if for 3.3 V system, the
input voltage should be not more than 3.3 V x 5 = 16.5 V ).
Because the Arduino AVR chip have 10 bit AD, so this module
simulation resolution is 0.00489 V (5 V / 1023), and the input voltage of
this module should be more than 0.00489 V x 5 = 0.02445 V.
SPECIAL PARAMETERS
Voltage input range : DC0-25 V
Voltage detection range : DC0.02445 V-25 V
Voltage analog resolution : 0.00489 V
DC input interface : red terminal positive with VCC, negative with GND
CONNECTING DIAGRAM
24
This sensor module come with 3 Pin Dual-female Jumper Wire length 300mm
as:
APPLICATION
Connect this vlotage sensor module with Arduino sensor shield through 3
Pin sensor cable, not only can easily realize to detect and control the
voltage, but also can display the voltage through the IIC LCD1602 LCD
module and make voltage monitor.
cable, not only can easily realize to detect and control the voltage, but also
can display the voltage through the IIC LCD1602 LCD module and make
voltage monitor.
4.1.6 LCD
INTRODUCTION:
Liquid crystal cell displays (LCDs) are used in similar applications where LEDs
are used. These applications are display of display of numeric and alphanumeric
characters in dot matrix and segmental displays.
LCDS ARE OF TWO TYPES:
25
I. Dynamic scattering type
II. Field effect type
26
melting point, they have a temperature range within which the molecules are
almost as mobile as they would be in a liquid, but are grouped together in an
ordered from similar to a crystal.
LCD consists of two glass panels, with the liquid crystal materials
sandwiched in between them. The inner surface of the glass plates is coated with
transparent electrodes which define in between the electrodes and the crystal,
which makes the liquid crystal molecules to maintain a defined orientation angle.
When a potential is applied across the cell, charge carriers flowing through the
liquid will disrupt the molecular alignment and produce turbulence.
When the liquid is not activated, it is transparent. When the liquid is
activated the molecular turbulence causes light to be scattered in all directions
and the cell appears to be bright. Thus the required message is displayed. When
the LCD is in the off state, the two polarizer’s and the liquid crystal rotate the
light rays, such that they come out of the LCD without any orientation, and hence
the LCD appears transparent.
WORKING:
29
6 EN Enable
16 LAMP+(L+) Enable
(E2)
The function of each pins of LCD is described below VCC, VSS and VEE while
v and v provide +5v and ground, respectively, v is used for controlling LCD
contrast.
30
R/W, read/write
R/W input allows the user to write information to the LCD or read
information from it. R/W=1 when reading; R/W=0 when writing.
E, enable
The enable pin is used by the LCD to latch information presented on its
data pins. When data is supplied to data pins, a high to low pulse must be applied
to this pin in order for the LCD to latch in the data present at the data pins.
D0 - D7
The 8-bit data pins, D0 – D7, are used to send information to the LCD or
read contents of the LCD’S internal registers. There are also instruction codes
that can be sent to the LCD to clear the display or force the cursor to the home
position or blink the cursor. RS=0 is used to check the busy flag bit to see if the
LCD is ready to receive information. The busy flag is D7 and can be read when
R/W=1 and RS=0, as follows: if R/W=1, RS=0.when D7=1, the LCD is busy
taking care of internal operation and will not accept any new information, when
D7=0, the LCD is ready to receive new information.
LCD INTERFACING WITH MICROCONTROLLER:
31
ADVANTAGES:
1. Consume much lesser energy (i.e. low power) when compared to LEDs.
2. Utilizes the light available outside and no generation of light.
3. Since very thin layer of liquid crystal is used, more suitable to act as
display elements (in digital watches, pocket calculators, ect.)
4. Since reflectivity is highly sensitive to temperature, used as temperature
measuring sensor.
5. Very cheap.
DISADVANTAGES:
FEATURES
■ Easy interface to all microprocessors
ADC TYPES
33
The Wilkinson ADC
An integrating ADC (also dual-slope or multi-slope ADC)
A delta-encoded ADC or counter-ramp
34
4.1.8 RELAY
35
Buck – boost converter is “a DC to DC converter which either steps up or steps
down the input voltage level”. The step up or step down of input voltage level
depends on the duty ratio. Duty ratio or duty cycle is the ratio of output voltage to
the input voltage in the circuit. Buck – bust converter provides regulated DC
output.
When it is in buck mode, the output voltage obtained is less than input applied
voltage. In this mode, the output current is more than input current. However, the
output power is equal to the input power.
When it is in boost mode, the output voltage obtained is more than the input
applied voltage. In this mode, the output current is less than input current.
However, the output power is equal to the input power.
To operate the buck – boost converter, the two switches will operate
simultaneously. When switches are closed, inductor stores energy in a magnetic
field. When switches are open, the inductors get discharged and give the supply
to the load. The inductors in the circuit do not allow sudden variations in the
current. The capacitor across the load provides a regulated DC output.
There are several formats that can be used for buck-boost converters:
36
positive input.
While this may be required or can be accommodated for a limited number of
applications, it is not normally the most convenient format.
FIGURE 6: SW 1 is Open
When the switch in closed, current builds up through the inductor. When the
switch is opened the inductor supplies current through the diode to the
load.
+Vin, +Vout: The second buck-boost converter circuit allows both input
and output to be the same polarity. However to achieve this, more
components are required. The circuit for this buck boost converter is shown
below.
37
FIGURE 7 :SW 1 &SW 2 both Open
In this circuit, both switches act together, i.e. both are closed or open. When the
switches are open, the inductor current builds. At a suitable point, the switches are
opened. The inductor then supplies current to the load through a path incorporating
both diodes, D1 and D2.
The LM35 does not require any external calibration or trimming to provide
38
typical accuracies of ±1⁄4°C at room temperature and ±3⁄4°C over a full −55 to
+150°C temperature range. The LM35’s low output impedance, linear output, and
precise inherent calibration make interfacing to readout or control circuitry especially
easy. It can be used with single power supplies, or with plus and minus supplies. As it
draws only 60 μA from its supply, it has very low self-heating, less than 0.1°C in still
air. The LM35 is rated to operate over a −55° to +150°C temperature range, while the
LM35C is rated for a −40° to +110°C range (−10° with improved accuracy).
FEATURES
1. Calibrated directly in ° Celsius (Centigrade)
2. Linear + 10.0 mV/°C scale factor
3. 0.5°C accuracy guaranteeable (at +25°C)
4. Rated for full −55° to +150°C range
5. Suitable for remote applications
6. Low cost due to wafer-level trimming
7. Operates from 4 to 30 volts
8. Less than 60 μA current drain
9. Low self-heating, 0.08°C in still air
10. Nonlinearity only ±1⁄4°C typical
11. Low impedance output, 0.1 W for 1 mA load
CAPACITIVE LOAD
39
Figure 4.6 LM35 With Decoupling From Capacitive Load
Like most micro power circuits, the LM35 has a limited ability to drive heavy
capacitive loads. The LM35 by itself is able to drive 50 pf without special
precautions. If heavier loads are anticipated, it is easy to isolate or decouple the load
with a resistor.
40
4.2 SOFTWARE DESCRIPTIONS
4.2.1 ARDUINO IDE
The Arduino Integrated Development Environment - or Arduino Software
(IDE) - contains a text editor for writing code, a message area, a text console, a
toolbar with buttons for common functions and a series of menus. It connects
to the Arduino and Genuino hardware to upload programs and communicate
with them.
WRITING SKETCHES
Programs written using Arduino Software (IDE) are called sketches.
These sketches are written in the text editor and are saved with the file
extension .ino. The editor has features for cutting/pasting and for
searching/replacing text. The message area gives feedback while saving and
exporting and also displays errors. The console displays text output by the
Arduino Software (IDE), including complete error messages and other
information. The bottom right hand corner of the window displays the
configured board and serial port. The toolbar buttons allow you to verify and
upload programs, create, open, and save sketches, and open the serial monitor.
SKETCHBOOK
The Arduino Software (IDE) uses the concept of a sketchbook: a
standard place to store your programs (or sketches). The sketches in your
sketchbook can be opened from the File > Sketchbook menu or from the Open
button on the toolbar. The first time you run the Arduino software, it will
automatically create a directory for your sketchbook. You can view or change
the location of the sketchbook location from with the Preferences dialog.
Beginning with version 1.0, files are saved with a .ino file extension.
Previous versions use the
.pde extension. You may still open .pde named files in version 1.0 and later,
the software will automatically rename the extension to .ino.
Tabs, Multiple Files, and Compilation
41
Allows you to manage sketches with more than one file (each of which appears
in its own tab). These can be normal Arduino code files (no visible extension),
C files (.c extension), C++ files (.cpp), or header files (.h)
UPLOADING
Before uploading your sketch, you need to select the correct items from
the Tools > Board and Tools > Port menus. Theboards are described below.
On the Mac, the serial port is probably something like /dev/tty.usbmodem241
(for an Uno or Mega2560or Leonardo) or/dev/tty.usbserial-
1B1(foraDuemilanoveorearlierUSBboard), or/dev/tty.USA19QW1b1P1.1 (for a
serial board connected with a Keyspan USB-to-Serial adapter). On
Windows, it's probably COM1 or COM2 (for a serial board) or COM4,
COM5, COM7, or higher (for a USB board) - to find out, you look for USB
serial device in the ports section of the Windows Device Manager. On Linux, it
should be /dev/ttyACMx ,/dev/ttyUSBx or similar. Once you've selected the
correct serial port and board, press the upload button in the toolbar or select the
Upload item from the File menu. Current Arduino boards will reset
automatically and begin the upload. With older boards (pre-Diecimila) that
lack auto-reset, you'll need to press the reset button on the board just before
starting the upload. On most boards, you'll see the RX and TX LEDs blink as
the sketch is uploaded. The Arduino Software (IDE) will display a message
when the upload is complete, or show an error.
When you upload a sketch, you're using the Arduino bootloader, a small
program that has been loaded on to the microcontroller on your board. It allows
you to upload code without using any additional hardware. The bootloader is
active for a few seconds when the board resets; then it starts whichever sketch
was most recently uploaded to the microcontroller. The bootloader will blink
the on-board (pin 13) LED when it starts (i.e. when the board resets).
42
LIBRARIES
Libraries provide extra functionality for use in sketches, e.g. working with
hardware or manipulating data. To use a library in a sketch, select it from the
Sketch > Import Library menu. This will insert one or more #include statements
at the top of the sketch and compile the library with your sketch. Because
libraries are uploaded to the board with your sketch, they increase the amount of
space it takes up. If a sketch no longer needs a library, simply
delete its #includestatements from the top of your code.
SERIAL MONITOR
Displays serial data being sent from the Arduino or Genuino board (USB or
serial board). To send data to the board, enter text and click on the "send" button or
press enter. Choose the baud rate from the drop-down that matches the rate passed
to Serial.begin in your sketch. Note that on Windows, Mac or Linux, the Arduino
or Genuino board will reset (rerun your sketch execution to the beginning) when
you connect with the serial monitor.
You can also talk to the board from Processing, Flash, MaxMSP, etc (see the
interfacing page for details).
LANGUAGE SUPPORT
43
Since version 1.0.1 , the Arduino Software (IDE) has been translated into 30+
different languages. By default, the IDE loads in the language selected by your
operating system. (Note: on Windows and possibly Linux, this is determined by
the locale setting which controls currency and date formats, not by the language
the operating system is displayed in.)
If you would like to change the language manually, start the Arduino Software
(IDE) and open the Preferences window. Next to the Editor Language there is a
dropdown menu of currently supported languages. Select your preferred language
from the menu, and restart the software to use the selected language. If your
operating system language is not supported, the Arduino Software (IDE) will
default to English.
4.2.2 EMBEDDED C
Embedded C is a set of language extensions for the C Programming
language by the C Standards committee to address commonality issues that exist
between C extensions for different embedded systems. Historically, embedded
C programming requires nonstandard extensions to the C language in order to
support exotic features such as fixed-point arithmetic, multiple distinct memory
banks, and basic I/O operations.
In 2008, the C Standards Committee extended the C language to address these
issues by providing a common standard for all implementations to adhere to. It
includes a number of features not available in normal C, such as, fixed-point
arithmetic, named address spaces, and basic I/O hardware addressing.
Embedded C uses most of the syntax and semantics of standard C, e.g., main()
function, variable definition, datatype declaration, conditional statements (if,
switch, case), loops (while, for), functions, arrays and strings, structures and
union, bit operations, macros, etc.
44
NECESSITY
During infancy years of microprocessor-based systems, programs were
developed using assemblers and fused into the EPROMs. There used to be no
mechanism to find what the program was doing. LEDs, switches, etc. were used
to check for correct execution of the program. Some ‘very fortunate’ developers
had In-circuit Simulators (ICEs), but they were too costly and were not quite
reliable as well. As time progressed, use of microprocessor-specific assembly-
only as the programming language reduced and embedded systems moved onto C
as the embedded programming language of choice. C is the most widely used
programming language for embedded processors/controllers. Assembly is also
used but mainly to implement those portions of the code where very high timing
accuracy, code size efficiency, etc. are prime requirements.
As assembly language programs are specific to a processor, assembly language
didn’t offer portability across systems. To overcome this disadvantage, several
high level languages, including C, came up. Some other languages like PLM,
Modula-2, Pascal, etc. also came but couldn’t find wide acceptance. Amongst
those, C got wide acceptance for not only embedded systems, but also for desktop
applications. Even though C might have lost its sheen as mainstream language for
general purpose applications, it still is having a strong-hold in embedded
programming.
ADVANTAGES
It is small and simpler to learn, understand, program and debug.
46
EMBEDDED SYSTEMS PROGRAMMING
Embedded systems programming is different from developing applications
on a desktop computer. Key characteristics of an embedded system, when
compared to PCs, are as follows: Embedded devices have resource constraints
(limited ROM, limited RAM, limited stack space, less processing
power)Components used in embedded system and PCs are different; embedded
systems typically use smaller, less power consuming components. · Embedded
systems are more tied to the hardware.
Two salient features of Embedded Programming are code speed and code
size. Code speed is governed by the processing power, timing constraints,
whereas code size is governed by available program memory and use of
programming language. Goal of embedded system programming is to get
maximum features in minimum space and minimum time. Embedded systems are
programmed using different type of languages:
Machine Code
Assembly language maps mnemonic words with the binary machine codes that
the processor uses to code the instructions. Assembly language seems to be an
obvious choice for programming embedded devices. However, use of assembly
language is restricted to developing efficient codes in terms of size and speed.
Also, assembly codes lead to higher software development costs and code
portability is not there. Developing small codes are not much of a problem, but
large programs/projects become increasingly difficult to manage in assembly
language. Finding good assembly programmers has also become difficult
nowadays. Hence high level languages are preferred for embedded systems
programming.
47
DIFFERENCE BETWEEN C AND EMBEDDED C
Though C and embedded C appear different and are used in different
contexts, they have more similarities than the differences. Most of the
constructs are same; the difference lies in their applications.
48
4.2.3 PROTEUS SOFTWARE
Proteus (Processor for Text Easy to Use) is a fully functional, procedural
programming language created in 1998 by Simone Zanella. Proteus incorporates
many functions derived from several other languages: C, BASIC, Assembly,
Clipper/dBase; it is especially versatile in dealing with strings, having hundreds of
dedicated functions; this makes it one of the richest languages for text
manipulation.
Proteus owes its name to a Greek god of the sea (Proteus), who took care of
Neptune's crowd and gave responses; he was renowned for being able to transform
himself, assuming different shapes. Transforming data from one form to another is
the main usage of this language.
INTRODUCTION
Proteus was initially created as a multiplatform (DOS, Windows, Unix)
system utility, to manipulate text and binary files and to create CGI scripts. The
language was later focused on Windows, by adding hundreds of specialized
functions for: network and serial communication, database interrogation,
system service creation, console applications, keyboard emulation, ISAPI
scripting (for IIS). Most of these additional functions are only available in the
Windows flavor of the interpreter, even though a Linux version is still available.
Proteus was designed to be practical (easy to use, efficient, complete), readable
and consistent.
no data types: all variables can be used as integer numbers, floating point
numbers or strings; variables are interpreted according to the functions
being applied – Proteus keeps different representations of their values
between calls, to decrease execution time in case of frequent conversions
between one type and the other;
no pre-allocated structures: all data used by Proteus are dynamically
allocated at execution time; there are no limits on: recursion, maximum
data size, number of variables, etc.;
no operators: Proteus is a completely functional language – there are no
operators; thus, there is no ambiguity when evaluating expressions and
parenthesis are not needed;
large library of predefined functions: Proteus is not a toy-language, it
comes with hundreds of library functions ready to be used for working
50
on strings, dates, numbers, for sorting, searching and so on;
Advanced Data Access (DAO), Pipes, Windows Sockets, Serial Ports: In The
Windows Version, Proteus Includes Hundreds Of System Calls Which Are
Operating System-Specific;
Clear And Comprehensible Syntax: The Names Of The Library Functions
Resamble Those Of Corresponding Functions In C, Clipper/Flagship And
Assembly; By Using Medium-Length Keywords, Proteus Programs Are Very
Easy To Understand;
Native Support For High-Level Data Structures: Arrays, Queues (Single Or
Double), Stacks, Bit Maps, Sets, AVL Trees Are Already Available In
Proteus And Do Not Require Additional Code Or Libraries To Be Used;
EXAMPLE PROGRAMS
Hello World
The following example reads the standard input (CSV format, separator
";") and prints out the first two fields separated by "|":
CONSOLELN TOKEN(L, 1, ";") "|" TOKEN(L, 2, ";")
Proteus scripts by default work on an input file and write to an output file;
the predefined identifier L gets the value of every line in input. The
function TOKEN returns the requested item of the string; the third
parameter represents the delimiter. String concatenation is implicit.
51
4.2.4 BLYNK
Blynk is a platform with iOS and Android apps to control Arduino, Raspberry Pi
and the likes over the Internet. It's a digital dashboard where you can build a
graphic interface for your project by simply dragging and dropping widgets. It's
really simple to set everything up and you'll start tinkering in less than 5 mins.
Blynk is not tied to some specific board or shield. Instead, it's supporting hardware
of your choice. Whether your Arduino or Raspberry Pi is linked to the Internet over
Wi-Fi, Ethernet or this new ESP8266 chip, Blynk will get you online and ready for
the Internet Of Your Things.
Blynk was designed for the Internet of Things. It can control hardware remotely, it
can display sensor data, it can store data, visualize it and do many other cool things.
There are three major components in the platform:
Blynk App: – It allows you to create amazing interfaces for your projects using
various widgets which are provided.
Blynk Server: – It is responsible for all the communications between the
smartphone and hardware. You can use the Blynk Cloud or run your private Blynk
server locally. It’s open-source, could easily handle thousands of devices and can
even be launched on a Raspberry Pi.
Blynk Libraries: – It enables communication, for all the popular hardware
platforms, with the server and process all the incoming and outcoming commands.
Now imagine, every time you press a Button in the Blynk app, the message travels
52
to the Blynk Cloud, where it magically finds its way to your hardware. It works the
same in the opposite direction and everything happens in a blynk of an eye.
53
PROGRAM PART
#include<LiquidCrystal.h>
#define ir 2
#define relay 3
#define rfid 4
#define temp A2
void pay(int p)
while (1)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Disconnected");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Consumption Unit");
lcd.setCursor(5, 1);
lcd.print(p);
delay(2500);
if (p == 0)
55
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Charging Charges");
lcd.setCursor(0, 1);
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
lcd.clear();
goto last;
if (p == 10)
56
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print("Charges is 10rs");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
57
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 10");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 20)
58
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print("Charges is 20rs");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
59
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 20");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 30)
lcd.clear();
60
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print("Charges is 30rs");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
61
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 30");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 40)
lcd.clear();
lcd.setCursor(0, 0);
62
lcd.print(" Charging Total ");
lcd.setCursor(0, 1);
lcd.print("Charges is 40rs");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
lcd.setCursor(0, 0);
63
lcd.print("card scanning....");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 40");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 20)
lcd.clear();
lcd.setCursor(0, 0);
64
lcd.setCursor(0, 1);
lcd.print("Charges is 50rs");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
65
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 50");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 60)
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
66
lcd.print("Charges is 60rs");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
67
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 20");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 70)
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print("Charges is 70rs");
68
int cash = 70;
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
lcd.clear();
69
lcd.setCursor(0, 0);
lcd.print("Debit 70");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 20)
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print("Charges is 80rs");
70
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
71
lcd.print("Debit 80");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 90)
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print("Charges is 90rs");
delay(2000);
72
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 90");
73
delay(2000);
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
if (p == 20)
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print("Charges is 100rs");
delay(2000);
74
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
delay(2000);
while (1)
int k;
k = digitalRead(rfid);
if (k == 1)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("card scanning....");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Debit 100");
delay(2000);
75
card = card - cash;
lcd.setCursor(0, 0);
lcd.print("balance amount");
lcd.setCursor(4, 1);
lcd.print(card);
delay(2000);
goto last;
last:
break;
void setup()
lcd.begin(16, 2);
Serial.begin(9600);
pinMode(ir, INPUT); // ir 1
pinMode(rfid, INPUT);
pinMode(relay, OUTPUT);
76
pinMode(sensor1, INPUT);
pinMode(sensor2, INPUT);
pinMode(temp, INPUT);
digitalWrite(relay, 0);
void loop()
start:
digitalWrite(2, 0);
digitalWrite(3, 0);
lcd.clear();
lcd.setCursor(4, 0);
lcd.print("welcome to ");
lcd.setCursor(0, 1);
lcd.print("charging station");
delay(3000);
int val;
while (1)
int IR = digitalRead(ir);
float B = analogRead(sensor1);
77
Vout = B * (1.15 / 1024.0);
float A = analogRead(sensor2);
int T=analogRead(temp);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("BV=");
lcd.setCursor(3, 0);
lcd.print(Vin);
lcd.setCursor(8, 0);
lcd.print("| Temp");
lcd.setCursor(0, 1);
lcd.print("SV=");
lcd.setCursor(3, 1);
lcd.print(Vin2);
lcd.setCursor(8, 1);
lcd.print("| ");
lcd.setCursor(11, 1);
78
lcd.print(T);
delay(5000);
while (1)
float B = analogRead(sensor1);
float A = analogRead(sensor2);
if (Vin <= 8)
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("BV=");
lcd.setCursor(3, 0);
lcd.print(Vin);
delay(3000);
79
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Battery power");
lcd.setCursor(5, 1);
lcd.print("Is Low");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Charging station");
lcd.setCursor(4, 1);
lcd.print("CLOSED");
delay(3000);
int IR = digitalRead(ir);
if (Vin >= 8)
lcd.clear();
delay(10);
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print(" is available");
80
delay(1000);
if (IR == 0)
lcd.clear();
delay(10);
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print(" is Parked");
delay(1000);
int IR = digitalRead(ir);
digitalWrite(relay, 1);
digitalWrite(relay, 0);
val = i;
pay(i);
81
goto start;
lcd.clear();
delay(10);
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print(i);
delay(1000);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
82
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
lcd.print("%");
delay(800);
83
CHAPTER 6
The research paper comes to the conclusion that this method of paying for parking
is significantly more effective and efficient than the current system, which relies
on hand-to-hand exchanges and entry-point token verification. Additionally, this
approach enables users to pay only the precise amount necessary for the time they
utilized a certain service in the parking lot. Since the database may also store the
amount of power utilized by the car to charge itself for the amount of time it is
parked and calculates the amount required to be paid by the user, further
implementation for charging e-vehicles using this method is possible. In order to
save the user a significant amount of time when looking for a slot and charging
his car in the parking lot. The user is also informed by this method of the number
of parking spaces that are open in a parking lot. Instead of manually verifying the
availability of parking spaces in the closest parking lots, this enables the user to
rapidly select a parking place.
Electric vehicles (EV) is the future not only of transport but of our planet.
These vehicles are plugged into a charging station at a low voltage. There are no
emissions released from these vehicles. But what if you have an electric vehicle
that gets charged up from home electricity or by solar energy. What if you can
use this charge to power your home and your garage. You will no longer need to
fear the impact of fuel exporters. This means that electric vehicle drivers will be
looking at long trips and camping. A home built electric vehicle will reduce the
carbon footprint of the family and it will also lower electricity bills. The future
potential of electric vehicles is enormous. The obvious starting point for these
vehicles is the charging station.
84
REFERENCES
86
•
87
88