IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER
This study focuses on the problem of managing the energy efficiency of the fleet of electric vehicles of a motor transport enterprise operating in a large city, taking into account the requirements of sustainable electromobility and the constraints of the power system. As a tool for information supp...
Збережено в:
| Дата: | 2023 |
|---|---|
| Автори: | , |
| Формат: | Стаття |
| Мова: | Українська |
| Опубліковано: |
Institute of Renewable Energy National Academy of Sciences of Ukraine
2023
|
| Теми: | |
| Онлайн доступ: | https://ve.org.ua/index.php/journal/article/view/427 |
| Теги: |
Додати тег
Немає тегів, Будьте першим, хто поставить тег для цього запису!
|
| Назва журналу: | Vidnovluvana energetika |
| Завантажити файл: | |
Репозитарії
Vidnovluvana energetika| _version_ | 1871103686895206400 |
|---|---|
| author | Bosak, An. Bosak, Al. |
| author_facet | Bosak, An. Bosak, Al. |
| author_institution_txt_mv | [
{
"author": "An. Bosak",
"institution": "National Technical University of Ukraine «Igor Sikorsky Kyiv Polytechnic Institute»; Educational and scientific institute of energy saving and energy management"
},
{
"author": "Al. Bosak",
"institution": "National Technical University of Ukraine «Igor Sikorsky Kyiv Polytechnic Institute»; Educational and scientific institute of energy saving and energy management"
}
] |
| author_sort | Bosak, An. |
| baseUrl_str | https://ve.org.ua/index.php/journal/oai |
| collection | OJS |
| datestamp_date | 2026-07-18T06:32:19Z |
| description | This study focuses on the problem of managing the energy efficiency of the fleet of electric vehicles of a motor transport enterprise operating in a large city, taking into account the requirements of sustainable electromobility and the constraints of the power system. As a tool for information support of the control process, a system of fuzzy control of charging stations of electric vehicles in real time based on a microcon-troller is considered. Planning for charging electric vehicles (EVs) in conditions The power limit of the charg-ing station is carried out using the Coefficient EV charging algorithm. The algorithm involves controlling the charging of electric vehicles by assigning a weight factor (WCC) to each vehicle connected to the charging station. Optimization of the electrical load of the charging station is carried out from the standpoint of min-imizing electricity costs and meeting the demand for charging electric vehicles without going beyond the network limitations. Computer simulation of the charging mode of electric vehicles and the load of the charging station was performed. The results of modeling the charging of electric vehicles using the pro-posed algorithm in the Matlab Simulink environment are compared with the results of modeling using cal-culations on the Arduino Mega 2560 board. The proposed implementation approach on the Atmega 2560 microcontroller provides a reduction in power consumption during peak hours of the power grid, as well as on-demand SOC charging of all connected electric vehicles. |
| doi_str_mv | 10.36296/1819-8058.2023.4(75).29-38 |
| first_indexed | 2025-07-17T11:39:14Z |
| format | Article |
| fulltext |
29
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
УДК 621.316 https://doi.org/10.36296/1819-8058.2023.4(75)29-38
IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING
STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER
Received Nov. 13. 2023; accepted Dec. 20. 2023
Available online Dec. 30. 2023
An. Bosak1, Al. Bosak2
Author for correspondence: Andrii Bosak,
e-mail: avbosak@gmail.com
This study focuses on the problem of managing the energy
efficiency of the fleet of electric vehicles of a motor
transport enterprise operating in a large city, taking into
account the requirements of sustainable electromobility
and the constraints of the power system. As a tool for information support of the control process, a system of fuzzy
control of charging stations of electric vehicles in real time based on a microcon-troller is considered. Planning for
charging electric vehicles (EVs) in conditions The power limit of the charg-ing station is carried out using the Coef-
ficient EV charging algorithm. The algorithm involves controlling the charging of electric vehicles by assigning a
weight factor (WCC) to each vehicle connected to the charging station. Optimization of the electrical load of the
charging station is carried out from the standpoint of min-imizing electricity costs and meeting the demand for
charging electric vehicles without going beyond the network limitations. Computer simulation of the charging
mode of electric vehicles and the load of the charging station was performed. The results of modeling the charging
of electric vehicles using the pro-posed algorithm in the Matlab Simulink environment are compared with the
results of modeling using cal-culations on the Arduino Mega 2560 board. The proposed implementation approach
on the Atmega 2560 microcontroller provides a reduction in power consumption during peak hours of the power
grid, as well as on-demand SOC charging of all connected electric vehicles.
Keywords: electric vehicle fleet, fuzzy logic, state of charge, charging weight coeficient, microcontroller.
РЕАЛІЗАЦІЯ СИСТЕМИ НЕЧІТКОГО КЕРУВАННЯ ЗАРЯДНИМИ СТАНЦІЯМИ ЕЛЕКТРОМОБІЛІВ У
РЕАЛЬНОМУ ЧАСІ НА ОСНОВІ МІКРОКОНТРОЛЕРА ARDUINO MEGA 2560
Отримано 13 жов. 2023 р.; рекомендовано до публікації 20 груд. 2023 р.
Доступно онлайн 30 груд. 2023 р.
А. В. Босак1, А. В. Босак2
Автор для коресподенції: Андрій Босак,
e-mail: avbosak@gmail.com
Це дослідження фокусується на проблемі управління
енергоефективністю флоту електромобілів авто-
транспортного підприємства, що функціонує в умо-
вах великого міста, з урахуванням вимог стійкої елек-
тромобільності та обмежень енергосистеми. Як інструмент інформаційного забезпечення процесу
управління розглядається система нечіткого керування зарядними станціями електромобілів у реаль-
ному часі на основі мікроконтролера. Наведене планування заряджання електромобілів (EV) в умовах
обмеження потужності зарядної станції виконано з використанням алгоритму заряджання на основі
нечіткої логіки та оптимізації з урахунанням обмежень приєднання. Алгоритм передбачає контроль
зарядки електромобілів шляхом присвоєння вагового індексу заряджання (CWI) кожному
1 PhD student
https://orcid.org/0000-0002-4667-9720
2 Cand. of tech. Sciences., Assoc. Prof.
https://orcid.org/0000-0003-0545-9980
1,2 National Technical University of Ukraine «Igor
Sikorsky Kyiv Polytechnic Institute»;
Educational and scientific institute of energy saving
and energy management
1 Аспірант.
https://orcid.org/0000-0002-4667-9720
2 Канд. техн. наук, доцент.
https://orcid.org/0000-0003-0545-9980
1,2 Національний технічний університет України
«Київський політехнічний інститут імені Ігоря Сі-
корського»;
Навчально-науковий інститут енергозбереження
та енергоменеджменту
30
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
транспортному засобу, підключеному до зарядної станції. Оптимізацію електричного наванта-
ження зарядної станції виконано з позицій мінімізації витрат електроенергії та забезпечення попиту
на зарядку електромобілів без виходу за обмеження мережі. Виконано комп’ютерне моделювання ре-
жиму заряджання електромобілів та навантаження зарядної станції. Результати моделювання за-
рядки електромобілів з використанням запропонованого алгоритму в середовищі Matlab Simulink по-
рівнюються з результатами моделювання з використанням обчислень на платі Arduino Mega 2560.
Запропонований підхід реалізації на мікроконтролері Atmega 2560 забезпечує зниження електроспо-
живання в години пікових навантажень електричної мережі, а також зарядку на вимогу SOC всіх під-
ключених електромобілів.
Ключові слова: парк електромобілів, нечітка логіка, рівень заряду, ваговий індекс заряджання, мікро-
контролер.
Introduction. Most of the solutions to the problem of charg-
ing a large number of EVs are based on various types of plan-
ning and the creation of their charging profile - charging sce-
narios with technical limitations. These restrictions depend
on the situation at the charging station (the number of EVs,
their charging levels, the possibility of simultaneous service,
the declared charging time). A convenient charging period
for the EV owner and the network load schedule may conflict
[1]. The development of a real-time charging control algo-
rithm should provide each EV with guaranteed charging in
conditions of limited power consumption.
Assessment of the situation can be implemented by provid-
ing a weight index for each vehicle that is connected to the
EV charging station. A simplified algorithm of the proposed
system is shown in Fig. 1. The decision to charge or hold the
EV depends on two stages of computing. At the first stage,
a charge weight index (CWI) is calculated for all connected
EVs, which determines their priority. At the second stage,
optimization is carried out – network and price constraints
are taken into account, the required final level of battery
charge and the charging power delivered to electric vehi-
cles with the highest CWI [2].
One of the primary benefits of this algorithm lies in its sim-
plicity, rapid execution, and cost-effective implementation
and upkeep. In contrast to other real-time algorithms de-
signed to solve differential equations, which demand sub-
stantial computational resources, this algorithm can be
effectively employed on a 16-bit microcontroller operating
at a clock speed of only 2 MHz.
Development of fuzzy logic for the proposed charging sys-
tem. The first step in the implementa�on of this approach
is that Upon connec�ng a new electric vehicle (EV) to the
charging sta�on, the EV owner communicates key parame-
ters, including the parking dura�on 𝑡𝑡𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝, the desired
and ini�al levels of batery charge 𝑆𝑆𝑆𝑆𝐶𝐶𝑟𝑟𝑟𝑟𝑟𝑟 , 𝑆𝑆𝑆𝑆𝐶𝐶𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖, , to the
charging sta�on controller (CSC). This informa�on is u�-
lized to compute the energy required for batery charging
𝑊𝑊𝑟𝑟𝑟𝑟𝑟𝑟 and the charging power 𝑆𝑆𝑐𝑐ℎ𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 . Notably, any uncer-
tainty, as typically found in scheduling algorithms, is elimi-
nated in this process [3].
Following the principles of fuzzy logic, the procedure for
calculating CWI using the fuzzy system comprises the fol-
lowing components, as outlined in reference [4]:
• Fuzzification: this step involves converting conventional
numerical data into membership functions (MF).
• Decision Block: here, MFs are combined with control
rules to derive fuzzy results.
• Defuzzification: the computation of each output ob-
tained from the decision block leads to the creation of a
lookup table, from which a numerical output is selected.
The structure of the fuzzy logic blocks described above is
illustrated in Fig. 2.
Charging/
Hold
Fig. 1. Simplified representation of the proposed electric vehicle charging algorithm
31
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
The calculated index is then used in the second optimiza-
tion stage of the algorithm.
Fuzzification
Decision
block Rules
De-fuzzification
Charge Weight
Index
Wrequired Scharge tparking
Fig. 2. Structure of fuzzy logic
CWI is determined as a function of the energy required for
charging, the charging power, and the parking duration [5]
. The CWI membership function is formed according to the
functions of input parameters:
𝑓𝑓:𝑊𝑊req𝑖𝑖
, 𝑆𝑆charge𝑖𝑖, 𝑡𝑡parkingк𝑖𝑖 → CWI𝑖𝑖
𝜇𝜇(𝑊𝑊req𝑖𝑖
), 𝜇𝜇(𝑆𝑆charge𝑖𝑖), 𝜇𝜇(𝑡𝑡parking𝑖𝑖) → 𝜇𝜇(CWI𝑖𝑖), (1)
here 𝑊𝑊req is the required energy to charge the battery,
𝑆𝑆charge is the charging power, 𝑡𝑡parking the time of EV being
connected to the station, respectively, and 𝜇𝜇 is the mem-
bership function.
The energy needed for the charging process is determined
by multiplying the discrepancy between the battery's spec-
ified initial charge level, as set by the EV owner, and the
desired charge level by the battery's capacity:
𝑊𝑊req = (𝑆𝑆𝑆𝑆𝐶𝐶req−𝑆𝑆𝑆𝑆𝐶𝐶init)⋅𝐸𝐸bat
100
, (2)
with 𝑆𝑆𝑆𝑆𝐶𝐶reqand 𝑆𝑆𝑆𝑆𝐶𝐶init indicating required and initial
charge levels of battery, and 𝐸𝐸bat the capacity of the battery.
Conversely, the charging power at the battery end is de-
fined by a relationship involving the charge level, voltage,
and charging current:
𝑃𝑃charge = 𝑓𝑓bat(𝑆𝑆𝑆𝑆𝑆𝑆,𝑉𝑉charge,𝐼𝐼charge) , (3)
Hence, the charging power on the grid side:
𝑆𝑆charge=
𝑃𝑃charge
𝜂𝜂
, (4)
𝑤𝑤𝑤𝑤𝑤𝑤ℎ 𝜂𝜂 – the efficiency of the charger.
The characteristics of the MF (graphic representation is
shown in Fig. 3), such as input and output variables, their
corresponding forms of functions and terms, with their cor-
responding ranges, are taken by assessing the conditions of
connection and operation of charging stations in Ukraine
and are described in the previous paper [2].
Fig. 3. Membership functions for the required energy for charging 𝑊𝑊𝑟𝑟𝑟𝑟𝑟𝑟 (a), parking time 𝑡𝑡𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 (b), charging power
𝑆𝑆𝑐𝑐ℎ𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 (c) and the output charging weight index of the CWI (d)
32
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
Fuzzy control rules are established based on the designer's
expertise and data acquired through testing. Typically,
these rules are structured as if-then statements, outlining
the logical associations between input and output variables
[6].
The proposed fuzzy system comprises 40 rules. Each solu-
tion phase includes a unique coefficient (index) used to
scale the initial term value.
The decision-making block conveys the outcome of the ap-
plied rule to membership functions. A fuzzy implication is
employed, resulting in an "if, then" expression. In the realm
of fuzzy logic, this operation involves identifying the mini-
mum of the initial membership function values [7]:
𝜇𝜇(CWI) = 𝜇𝜇(𝑊𝑊req) ∩ 𝜇𝜇(𝑆𝑆charge) ∩ 𝜇𝜇(𝑡𝑡parking) =
𝑚𝑚𝑚𝑚𝑚𝑚[𝜇𝜇(𝑊𝑊req), 𝜇𝜇(𝑆𝑆charge),𝜇𝜇(𝑡𝑡parking)]𝐸𝐸V𝑖𝑖 , (5)
The assessment and evaluation of the created fuzzy system
were performed by employing a three-dimensional func-
tion graph (Fig. 4). Adjustments to the membership func-
tions and rules were made to ensure that the figure dis-
played a descending pattern or a flat surface in its
coordinates. This was done in a manner such that neighbor-
ing values had a minimal impact on the process of deter-
mining the initial variable. The choice of the descent direc-
tion was as follows: when moving closer to zero along the
axis representing the energy required for charging, the
graph descended, while in the case of parking time, it ex-
hibited an opposite, ascending trend.
Fig. 4. Three-dimensional mapping of membership func-
tions and rules
During the defuzzification phase, the CWI vector for each
electric vehicle connected to the charging station is deter-
mined using the widely adopted gravitational method [4].
The calculation involves identifying the arithmetic mean of
the elements derived from the membership function values
with the highest degrees of membership:
CWI = ∑ 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸(EV𝑖𝑖)𝐸𝐸𝐸𝐸
∑ 𝜇𝜇(EV𝑖𝑖)𝐸𝐸𝑉𝑉
, (6)
𝐸𝐸V means all connected EVs, 𝜇𝜇(EV𝑖𝑖) are the membership
functions after the solution block.
Op�miza�on of the objec�ve func�on taking into account
network constraints. The aim of the op�miza�on process
is to choose a maximum number of electric vehicles with
the highest CWI priority indices. Equa�on (7) represents
the objec�ve func�on, which incorporates a decision vec-
tor concerning whether to allow charging for electric vehi-
cles.
𝑚𝑚𝑚𝑚𝑚𝑚 𝐹𝐹(𝑡𝑡) = ∑ CWI(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆(𝑖𝑖),𝑡𝑡) ×𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆(𝑖𝑖) Decision(Spot(𝑖𝑖),𝑡𝑡) (7)
with 𝐹𝐹(𝑡𝑡) is the objective function,
Spot(𝑖𝑖) - spot of the charging station,
Decision(𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆(𝑖𝑖),𝑡𝑡) - The decision to charge (1) or not (0) the
charging spot for the calculation period of the method t,
derived from conditions (10). A constraint is imposed on
the objective function.
Power limitations. The energy demand in each time period
is taken into account - the power limit looks like this:
𝑆𝑆chargeEV(𝑡𝑡) + 𝑆𝑆load ≤ 𝑆𝑆𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 , (8)
𝑆𝑆chargeEV(𝑡𝑡) is the total load capacity of electric vehicles
charged in a specific period of time, kVA; 𝑆𝑆load - load ca-
pacity of other consumers connected to the grid, kVA, 𝑆𝑆𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚
- maximum network capacity.
Other are current and voltage limitations:
�𝐼𝐼(𝑡𝑡)� ≤ 𝐼𝐼𝑀𝑀𝑀𝑀𝑀𝑀(𝑡𝑡);
𝑉𝑉𝑚𝑚𝑚𝑚𝑚𝑚 < 𝑉𝑉(𝑖𝑖, 𝑡𝑡) < 𝑉𝑉𝑚𝑚𝑚𝑚𝑚𝑚 , (9)
𝐼𝐼(𝑡𝑡) is the load current in a given period of time, is the maxi-
mum current;
𝑉𝑉𝑚𝑚𝑚𝑚𝑚𝑚,𝑚𝑚𝑚𝑚𝑚𝑚 – the minimum and maximum voltage on the bus
to which the charging station is connected.
Status restrictions. The auxiliary variable Decision is a solu-
tion (0/1) that, prior to fuzzy logic calculations, allows the
EV to be held or charged. Given the conditions where the
EV reaches the desired SOC charge level or the EV is not
connected to the charging spot, the following provisions
are suggested:
Decision�Spot(𝑖𝑖),𝑡𝑡� = 0,
if 𝑆𝑆𝑆𝑆𝐶𝐶(Spot(𝑖𝑖),𝑡𝑡) ≥ 𝑆𝑆𝑆𝑆𝐶𝐶req�Spot(𝑖𝑖),𝑡𝑡�
AND (10)
Decision(Spot(𝑖𝑖),𝑡𝑡) = 0, if Occupied(Spot(𝑖𝑖),𝑡𝑡) = 0,
Here Occupied(Spot(𝑖𝑖),𝑡𝑡) is the availability of the charging
spot: free (1) or occupied (0) by EV.
The real-time approach manages the charging procedure
in a manner that enables swift responses to fluctuations
in power consumption conditions during the connection.
33
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
Additionally, the calculation frequency can be adjusted,
either upward or downward, to accommodate specific
calculation requirements. Initially, the system refreshes
all details related to electric vehicles and computes the
necessary energy to reach the desired charge level. After
determining the charging workload index in the phase-
system, it proceeds to calculate the current SOC charge
level, energy consumed by each vehicle, and the aggre-
gate electricity demand at the conclusion of the 10-mi-
nute interval.
Following the comple�on of the fuzzy logic computa�on
phase, the system chooses the maximum quan�ty of elec-
tric vehicles with the highest CWI, ensuring compliance
with all limita�ons set by both the energy supply company
and the charging sta�on owner. Each authorized electric
vehicle is charged at the maximum charging rate. Once the
batery reaches the desired SOC charge level, the workload
index for that par�cular vehicle becomes zero.
Review and comparison of exis�ng microcontrollers. Ap-
proach of selec�ng the best microcontroller to implement
fuzzy logic and integrate it into an exis�ng charge control
system depends on various factors, including the specific
requirements of the system, available resources, and anal-
ysis of different microcontroller pla�orms. Here are some
popular microcontroller op�ons that are o�en used to im-
plement fuzzy logic:
1. Arduino: Arduino boards, such as the Arduino Uno, Duo,
and Mega, are widely used for prototyping and integra-
�on into various systems. They have a large community
and numerous libraries that can simplify the implemen-
ta�on of fuzzy logic [8].
2. Raspberry Pi: While the Raspberry Pi is not a microcon-
troller in the tradi�onal sense, it is a popular single-
board computer with more processing power and
memory than typical microcontrollers. It can handle
complex fuzzy logic tasks and integrates seamlessly into
exis�ng systems [9].
3. STM32 Series: STMicroelectronics' STM32 microcon-
trollers offer a wide range of choices, from energy-effi-
cient to high-performance devices. They are well-suited
for real-�me compu�ng and have development tools
available [10].
4. PIC microcontrollers: Microchip's microcontrollers from
the PIC family are known for their reliability and ease of
use. They have different sizes and capabilities, which al-
lows you to find an option for implementation [11].
5. ESP8266/ESP32: These microcontroller modules are
popular for the Internet of Things (IoT). They have Wi-
Fi and Bluetooth capabilities, which can be useful for
remote monitoring and control of fuzzy logic systems
[12].
6. NXP/Freescale microcontrollers: NXP microcontrollers
such as the HC12 are among the most popular for
implemen�ng fuzzy logic due to their prevalence and
cost [13].
When choosing a microcontroller, it is important to take
into account the following factors, which will be compared
in the next paragraph [14]:
• Compu�ng power – microcontroller should have
enough compu�ng power to work efficiently with fuzzy
logic algorithms.
• Memory: Sufficient RAM and Flash memory is required
to store fuzzy sets, rules, and other data.
• The I/O interfaces are necessary to obtain variables and
issue a solution for charging or holding an electric vehicle.
• Development Tools: It is important to have develop-
ment tools, development environments, and libraries
available for the selected microcontroller.
• Cost: since there is a goal of efficient use of funds, it is
required having an op�mal controller in terms of
price/cost.
Power and memory of the microcontroller. The compu�ng
power of microcontrollers can vary significantly depending
on the model, series, and configura�on. The comparisons
below will be general, while a detailed overview of the
board parameters is given in Table 1.
Usually, the microcontrollers men�oned above are divided
into several classes depending on their power:
Arduino Uno, Duo, Mega (AVR-based):
− This is a classic representa�ve of microcontrollers with
low compu�ng power.
− Low clock speed (16 MHz).
− Limited amount of memory (a few kilobytes in RAM and
Flash).
− Uno is suitable for simple fuzzy logic tasks (drive con-
trol, fan control, etc.), while Mega is for computation-
ally demanding fuzzy logic operations of the charging
system.
Raspberry Pi 4:
− The Raspberry Pi is a single-board computer, and it has
significantly higher processing power compared to typ-
ical microcontrollers.
− It has an ARM processor with a much higher clock rate
and more memory (gigabytes of RAM).
− Suitable for complex fuzzy logic problems and other
computa�onally intensive opera�ons.
STM32 series (e.g. STM32F4xx):
− The STM32 has different models with different levels of
compu�ng power.
− The most powerful models in this series have a Cortex-
M4 core with fast clock speeds and hardware support
for numerous opera�ons.
− They can usually handle complex fuzzy logic opera�ons
without much difficulty.
34
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
ESP8266/ESP32 (ESP32):
− The ESP8266/ESP32 has litle processing power com-
pared to some other microcontrollers (are more power-
ful comparing to Arduino Uno, but less powerful than
the Raspberry Pi).
− They are suitable for most fuzzy logic tasks, but may
have limita�ons in the amount of available memory.
NXP/Freescale Microcontrollers (Kine�s, LPC):
− All of these series have different models with different
compu�ng power characteris�cs.
− The most powerful models can handle complex fuzzy
logic opera�ons.
The cost of the mentioned above boards will not be given
in this article, as it can fluctuate significantly depending on
the place of purchase, region and other factors. To justify
the choice of the board after the analysis of prices, it is de-
termined that it is directly proportional to the power of the
processor and the amount of memory.
Experimental setup and results. Arduino Mega 2560 micro-
controller. The Arduino Mega is a microcontroller board
that belongs to the Arduino line and features greater re-
sources compared to larger amounts of memory and more
GPIO pins compared to the Arduino Uno. This board is well
suited to the proposed system, including the implementa-
�on of fuzzy logic [14]. The appearance of the board is
shown in Fig. 5. Since, in addi�on to fuzzy logic calcula�ons,
it is necessary to carry out the stage of op�miza�on of the
objec�ve func�on, this microcontroller was chosen.
Fig. 5. Appearance of the Arduino Mega 2560 board
Detailed descrip�on of the characteris�cs of the Arduino
Mega [8]:
Microcontroller: ATmega2560. Frequency: 16 MHz
Memory: Flash memory: 256 KB (for program code),
RAM: 8 KB (for variable and data storage)
EEPROM: 4 KB (for data storage)
Analog and digital GPIO pins:
Digital Pins: 54 digital GPIO pins, 15 of which can work as
PWM outputs.
Analog pins: 16 analog inputs for reading analog signals
from 0 to 5 V.
Serial interfaces:
− UART (Universal Asynchronous Receiver/Transmiter):
There are many UART ports for communica�ng with
your computer or other devices.
− SPI (Serial Peripheral Interface): There is hardware sup-
port for SPI to communicate with devices such as sen-
sors and displays.
− I2C (Inter-Integrated Circuit): There is hardware support
for I2C to communicate with devices via I2C.
External interface:
− USB: USB port for programming and communica�on
with a computer.
− DC connector: To power the microcontroller.
Adjustable supply voltage: 7-12 V (7-12 V recommended).
Opera�ng voltage: 5 V (usually powered by voltage through
a regulator on the board).
Connectors: The Arduino Mega has numerous connectors
for connec�ng addi�onal modules and sensors, including
Arduino shields, which can be simply inserted onto the top
of the board.
The procedure the microcontroller integra�on into the
system. The electric charging sta�on, which is the object of
Table 1. Main parameters of microcontrollers
Microcontroller/
Platform Frequency Flash
Memory RAM Specialized Functions/Interfaces
Arduino Uno 16 MHz (ATmega328P) 32 KB 2 KB 14 digital, 6 analog UART, SPI, I2C, PWM, USB
Arduino Mega 2560 16 MHz (ATmega2560) 256 KB 8 KB 54 digital, 16 analog UART, SPI, I2C, PWM, USB
Raspberry Pi 4 (4GB) 1.5 GHz (Quad-core ARM
Cortex-A72) 4 GB 4 GB GPIO, HDMI, Ethernet, USB, I2C, SPI, UART
STM32F407VG 168 MHz (Cortex-M4) 1 MB 192 KB 100 GPIO pins, UART, SPI, I2C, PWM, CAN, USB,
Ethernet
ESP32-WROOM-32 240 MHz (Dual-core
Tensilica LX6) 4 MB 520 KB UART, SPI, I2C, PWM, Wi-Fi, Bluetooth
NXP Kinetis K64F
(MK64FN1M0VLL12) 120 MHz (Cortex-M4) 1 MB 256 KB 82 GPIO pins, UART, SPI, I2C, PWM, CAN, USB,
Ethernet
NXP LPC1768 100 MHz (Cortex-M3) 512 KB 64 KB 70 GPIO pins, UART, SPI, I2C, PWM, CAN, USB,
Ethernet
35
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
research, is a combina�on of charging spots into one net-
work. This charging spot and its connec�on diagram are
shown in Fig. 6.
Fig. 6. Charging spot and wiring diagram
The main elements of the charging station, the functions of
the connector and theType 2 J1772 connector, the process
of connecting the EV to the charging station are described
below. The switching, protection and control devices of the
charging unit are shown in Fig. 7. Fig. 8 shows the pin loca-
tion of the charging spot connector.
The controller manages the power supply process of the
electric vehicle during charging [15].
Contactors are used for load control (powering EVs), exter-
nal ventilation, and J1772 connector lockout. The LED indi-
cation indicates the current status of the system. Charging
current can also be controlled during the charging process.
The setting point of the charging current is set via the RS485
interface.
One of the biggest advantages of this algorithm is its sim-
plicity, speed and low cost of implementation and mainte-
nance. Compared to other real-time algorithms that solve
differential equations and require high computing power,
the presented algorithm can be implemented on a 16-bit
microcontroller with an integer arithmetic logic device and
a clock frequency of only 2 MHz. The diagram of connecting
the controller to the existing EV charging station spots is
shown in Fig.9.
Fig. 7. Main devices and components of the charging station
After calculating the fuzzy logic and optimizing the target
function, the microcontroller sends a signal to the control
key E2 (Control Switch) – if charging during a given period
of time, the allowed contact will be closed. If, according to
the algorithm's decision, no charging is allowed during this
period of time, contact E2 will remain open.
Fig. 8. Charging Spot Connector Contacts
The purpose of this work is to develop a real-�me charging
system of EVs. The choice was made on the combina�on of
the MATLAB/Simulink environment and the Arduino board.
MATLAB/Simulink provides the "Simulink Support Package
for Arduino Hardware" to develop control algorithms in
Fig. 9. Connection diagram of the controller into charging station circle
36
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
Simulink and load it directly into the hardware pla�orm (Ar-
duino board). The "Simulink Support Pack for Arduino Hard-
ware" allows to create and run Simulink models in a variety
of areas and uses. It offers a library of units for configuring
and accessing Arduino sensors, actuators, and communica-
�on interfaces via a USB cable [16].
Fig. 10 shows a general view of the Matlab Simulink model
and the connec�on of the Arduino board to the charging
sta�on. The power of the charging sta�on is 24 kW. The
transformer and network equipment are limited to a capac-
ity of 120 kW. A simula�on of the Simulink model was car-
ried out and the SOC change graphs for each connected EV
were evaluated a�er each itera�on of the change of the
fuzzy rules based coefficient.
The Arduino package allows to perform tasks such as:
• Retrieving analog and digital sensor data from an Ar-
duino board.
• Control of devices with digital and PWM outputs.
• Communica�on with the Arduino board via USB cable.
• Access to peripherals and sensors connected via Inte-
grated Circuit (I2C) or Serial Peripheral Interface (SPI)
The developed charging control system developed in
Matlab was uploaded onto an Arduino Mega 2560 via USB
interface. The MATLAB Coder solu�on converted the code
of the proposed system, stored in an m-file, into code writ-
ten in C++, which is "understandable" for Arduino. Also,
with the help of Matlab, the transmission of collected the
data from an electric vehicle was simulated, in pa�cullar
𝑆𝑆𝑐𝑐ℎ𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 ,𝑊𝑊𝑟𝑟𝑟𝑟𝑟𝑟, 𝑡𝑡𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝. Sending the microcontroller's deci-
sion to charge or hold the EV was also simulated via Ar-
duino blocks.
The transfer of input data of the EVs’ and network’s param-
eters from the Matlab model to the board is carried out us-
ing the Serial Transmit block from the Simulink Support
Package for Arduino Hardware library [17]. The output of
the matrix with the decision to charge or hold connected
electric vehicles is implemented using the Serial Receive
block (Fig. 11).
Fig. 11. Used in the project Arduino Library Blocks
The fuzzy system developed in Matlab Fuzzy Logic Designer
was saved in a file with a .fis extension that cannot be op-
erated by Arduino. In order to calculate the result of fuzzy
logic for each itera�on of calcula�ons, the fuzzy system was
rewriten in C++ and uploaded into the memory of the mi-
crocontroller board.
The logic of op�miza�on of the objec�ve func�on (taking
into account the constraints of the network in the model)
is writen in the language of Matlab, which is also converted
to C++ and stored in Arduino memory.
Analysis of simulated data. In this sec�on, the proposed
charging system with calcula�ons on the Arduino Mega
2560 is compared to the calcula�ons performed on a PC.
Fig. 10. General view of the entire model in Matlab Simulink
37
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
The demand for electricity during a 24-hour charging sce-
nario for different compu�ng scenarios is shown in Fig.12,
Fig.13 and Fig.14.
Fig. 12. Electricity load within 24 hours based on uncon-
trolled charging. (Solid line – total demand with electric ve-
hicles, dashed line – other load)
Fig. 13. Electricity load within 24 hours based on the pro-
posed charging method is calculated on a PC in the Matlab
Simulimk environment. (Solid – total demand with electric
vehicles, dashed – other load)
Fig. 14. Electricity load for 24 hours based on the proposed
charging method when performing calculations on the Ar-
duino Mega 2560. (Solid – total demand with electric vehi-
cles, dashed – other load)
As can be seen from Fig. 12 network overload (load above
120 kW) up to 16% occurs during uncontrolled charging
from 7 a.m. to 11 a.m
Table 2 shows a comparison of the energy consumed per
day for different computing modes.
A comparison of these charging calcula�ons shows that the
calcula�ons of the power transferred to electric vehicles,
taking into account the constraints in the Matlab Simulink
environment, do not differ from the calcula�ons on the Ar-
duino Mega 2560.
Discussion and Conclusions. The opera�on of the fuzzy
controller based on the proposed methodology was tested
on the Arduino Mega 2560 microcontroller. The simplicity
of implementa�on of the real-�me method is confirmed by
the scheme of the fuzzy logic controller connec�on to the
exis�ng control system of electric charging sta�ons, which
will control the charging process.
The results show that the simula�on graphs with calcula-
�ons of the proposed system based on fuzzy logic on a PC
in the Matlab environment and on an Arduino board do not
differ. The fuzzy controller integra�on procedure into the
Table 2. On-grid energy consumption for different charging methods
Network Load
without EM
(Matlab Simulink)
Uncontrolled EV
charging
(Matlab Simulink)
Network Simulation – Matlab
Simulink, ChargingManagement
System Computing – Matlab
Network Simulation –
Matlab Simulink,
Charging
Control System
Computing – Arduino
Mega 2560
Total energy
consumed in
24h 𝑊𝑊𝑎𝑎𝑎𝑎𝑎𝑎 , kWh
1825,2 2267.1
(grid overload) 2292,1 2292
Consumed en-
ergy by EVs in
24h 𝑊𝑊𝐸𝐸𝐸𝐸, kWh
1825,2 441,9 467,5 467
38
Відновлювана енергетика. №4/2023 | Комплексні проблеми енергетичних систем на основі НВДЕ
process is also described. Compared to other works, the
greatest contribu�on of this lies in describing the elements
for programming and implementa�on each of the fuzzy
controller so�ware and hardware aspects. This allows to
es�mate the op�mal parameters, uncertain�es and nonlin-
eari�es of the system without a mathema�cal model. Fi-
nally, simula�on and implementa�on on the Arduino Mega
2560 microcontroller were shown to verify that the pro-
posed methodology, as well as the theore�cal and experi-
mental results, are valid.
REFERENCES
1. P.-Y. Kong and G. K. Karagiannidis, “Charging Schemes
for Plug-In Hybrid Electric Vehicles in Smart Grid: A
Survey,” IEEE Access, vol. 4, pp. 6846–6875, 2016, doi:
10.1109/ACCESS.2016.2614689.
2. A. Yandulskii, O. Kurson, A. Bosak, S. Kondratiev, and A.
Kuznietsov, “Improvement of Electric Charging Station
Efficiency using situation-dependent Fuzzy Algorithms,”
in 2018 IEEE International Conference on Electrical
Systems for Aircraft, Railway, Ship Propulsion and Road
Vehicles & International Transportation Electrification
Conference (ESARS-ITEC), Nottingham: IEEE, Nov. 2018,
pp. 1–6. doi: 10.1109/ESARS-ITEC.2018.8607378.
3. K. Qian, C. Zhou, M. Allan, and Y. Yuan, “Modeling of
Load Demand Due to EV Battery Charging in Distribution
Systems,” IEEE Trans. Power Syst., vol. 26, no. 2, pp.
802–810, May 2011, doi:
10.1109/TPWRS.2010.2057456.
4. Y. Bai, H. Zhuang, and D. Wang, Eds., Advanced Fuzzy
Logic Technologies in Industrial Applications. in
Advances in Industrial Control. London:
Springer London, 2006. doi: 10.1007/978-1-84628-469-4.
5. E. Akhavan-Rezai, M. F. Shaaban, E. F. El-Saadany, and
F. Karray, “Online Intelligent Demand Management of
Plug-In Electric Vehicles in Future Smart Parking Lots,”
IEEE Systems Journal, vol. 10, no. 2, pp. 483–494, Jun.
2016, doi: 10.1109/JSYST.2014.2349357.
6. C. C. Lee, “Fuzzy logic in control systems: fuzzy logic
controller. I,” IEEE Trans. Syst., Man, Cybern., vol. 20,
no. 2, pp. 404–418, Apr. 1990, doi: 10.1109/21.52551.
7. F. O. Karray and C. W. De Silva, Soft computing and
intelligent systems design: theory, tools, and applications.
Harlow, England ; New York: Pearson/Addison Wesley,
2004.
8. L. Louis, “Working Principle of Arduino and Using it as a
Tool for Study and Research,” IJCACS, vol. 1, no. 2,
pp. 21–29, Apr. 2016, doi: 10.5121/ijcacs.2016.1203.
9. S. Karthikeyan, R. A. Raj, M. V. Cruz, L. Chen, J. L. A.
Vishal, and V. S. Rohith, “A Systematic Analysis on
Raspberry Pi Prototyping: Uses, Challenges, Benefits,
and Drawbacks,” IEEE Internet Things J., vol. 10, no. 16,
pp. 14397–14417, Aug. 2023, doi:
10.1109/JIOT.2023.3262942.
10. B. Deng, Z. Bo, Y. Jia, Z. Gao, and Z. Liu, “Research on
STM32 Development Board Based on ARM Cortex-M3,”
in 2020 IEEE 2nd International Conference on Civil
Aviation Safety and Information Technology (ICCASIT,
Weihai, China: IEEE, Oct. 2020, pp. 266–272. doi:
10.1109/ICCASIT50869.2020.9368860.
11. The Quintessential PIC® Microcontroller. in Computer
Communications and Networks. London: Springer-
Verlag, 2005. doi: 10.1007/1-84628-202-0.
12. D. Hercog, T. Lerher, M. Truntič, and O. Težak, “Design
and Implementation of ESP32-Based IoT Devices,”
Sensors, vol. 23, no. 15, p. 6739, Jul. 2023, doi:
10.3390/s23156739.
13. D. H. Summerville, Embedded Systems Interfacing for
Engineers using the Freescale HCS08 Microcontroller II:
Digital and Analog Hardware Interfacing. in Synthesis
Lectures on Digital Circuits & Systems. Cham: Springer
International Publishing, 2009. doi: 10.1007/978-3-031-
79803-0.
14. A. M. Ibrahim, Fuzzy logic for embedded systems
applications. in Embedded technology series.
Amsterdam ; Boston, Mass: Newnes, 2004.
15. Dana Plymouth Technology Center, “OpenECU-EVCC
(OE-EVCC) User Guide.” 2022. [Online]. Available:
https://www.scribd.com/document/589256904/Open
ECU-EVCC-UserGuide
16. Mathworks, “Arduino Support from MATLAB and
Simulink.” [Online]. Available:
https://www.mathworks.com/hardware-
support/arduino.html
17. MathWorks, “Simulink Support Package for Arduino
Hardware.” [Online]. Available:
https://www.mathworks.com/matlabcentral/fileexcha
nge/40312-simulink-support-package-for-arduino-
hardware
|
| id | veorgua-article-427 |
| institution | Vidnovluvana energetika |
| keywords_txt_mv | keywords |
| language | Ukrainian |
| last_indexed | 2026-07-19T01:12:09Z |
| publishDate | 2023 |
| publisher | Institute of Renewable Energy National Academy of Sciences of Ukraine |
| record_format | ojs |
| resource_txt_mv | veorgua/c3/b1b8f450a061be03677d00c6c51cfbc3.pdf |
| spelling | veorgua-article-4272026-07-18T06:32:19Z IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER РЕАЛІЗАЦІЯ СИСТЕМИ НЕЧІТКОГО КЕРУВАННЯ ЗАРЯДНИМИ СТАНЦІЯМИ ЕЛЕКТРОМОБІЛІВ У РЕАЛЬНОМУ ЧАСІ НА ОСНОВІ МІКРОКОНТРОЛЕРА ARDUINO MEGA 2560 Bosak, An. Bosak, Al. electric vehicle fleet, fuzzy logic, state of charge, charging weight coeficient, microcontroller. парк електромобілів, нечітка логіка, рівень заряду, ваговий індекс заряджання, мікроконтролер. This study focuses on the problem of managing the energy efficiency of the fleet of electric vehicles of a motor transport enterprise operating in a large city, taking into account the requirements of sustainable electromobility and the constraints of the power system. As a tool for information support of the control process, a system of fuzzy control of charging stations of electric vehicles in real time based on a microcon-troller is considered. Planning for charging electric vehicles (EVs) in conditions The power limit of the charg-ing station is carried out using the Coefficient EV charging algorithm. The algorithm involves controlling the charging of electric vehicles by assigning a weight factor (WCC) to each vehicle connected to the charging station. Optimization of the electrical load of the charging station is carried out from the standpoint of min-imizing electricity costs and meeting the demand for charging electric vehicles without going beyond the network limitations. Computer simulation of the charging mode of electric vehicles and the load of the charging station was performed. The results of modeling the charging of electric vehicles using the pro-posed algorithm in the Matlab Simulink environment are compared with the results of modeling using cal-culations on the Arduino Mega 2560 board. The proposed implementation approach on the Atmega 2560 microcontroller provides a reduction in power consumption during peak hours of the power grid, as well as on-demand SOC charging of all connected electric vehicles. Це дослідження фокусується на проблемі управління енергоефективністю флоту електромобілів автотранспортного підприємства, що функціонує в умовах великого міста, з урахуванням вимог стійкої елек-тромобільності та обмежень енергосистеми. Як інструмент інформаційного забезпечення процесу управління розглядається система нечіткого керування зарядними станціями електромобілів у реаль-ному часі на основі мікроконтролера. Наведене планування заряджання електромобілів (EV) в умовах обмеження потужності зарядної станції виконано з використанням алгоритму заряджання на основі нечіткої логіки та оптимізації з урахунанням обмежень приєднання. Алгоритм передбачає контроль зарядки електромобілів шляхом присвоєння вагового індексу заряджання (CWI) кожному транспортному засобу, підключеному до зарядної станції. Оптимізацію електричного навантаження зарядної станції виконано з позицій мінімізації витрат електроенергії та забезпечення попиту на зарядку електромобілів без виходу за обмеження мережі. Виконано комп’ютерне моделювання режиму заряджання електромобілів та навантаження зарядної станції. Результати моделювання зарядки електромобілів з використанням запропонованого алгоритму в середовищі Matlab Simulink порівнюються з результатами моделювання з використанням обчислень на платі Arduino Mega 2560. Запропонований підхід реалізації на мікроконтролері Atmega 2560 забезпечує зниження електроспоживання в години пікових навантажень електричної мережі, а також зарядку на вимогу SOC всіх підключених електромобілів. Institute of Renewable Energy National Academy of Sciences of Ukraine 2023-12-30 Article Article application/pdf https://ve.org.ua/index.php/journal/article/view/427 10.36296/1819-8058.2023.4(75).29-38 Vidnovluvana energetika ; No. 4(75) (2023): Scientific and applied Journal renewable energy ; 29-38 Возобновляемая энергетика; ##issue.no## 4(75) (2023): Scientific and applied Journal renewable energy ; 29-38 Відновлювана енергетика; № 4(75) (2023): Науково-прикладний журнал Відновлювана енергетика; 29-38 2664-8172 1819-8058 10.36296/1819-8058.2023.4(75) uk https://ve.org.ua/index.php/journal/article/view/427/335 Copyright (c) 2023 An. Bosak, Al. Bosak https://creativecommons.org/licenses/by-nc-nd/4.0 |
| spellingShingle | electric vehicle fleet fuzzy logic state of charge charging weight coeficient microcontroller. Bosak, An. Bosak, Al. IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER |
| title | IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER |
| title_alt | РЕАЛІЗАЦІЯ СИСТЕМИ НЕЧІТКОГО КЕРУВАННЯ ЗАРЯДНИМИ СТАНЦІЯМИ ЕЛЕКТРОМОБІЛІВ У РЕАЛЬНОМУ ЧАСІ НА ОСНОВІ МІКРОКОНТРОЛЕРА ARDUINO MEGA 2560 |
| title_full | IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER |
| title_fullStr | IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER |
| title_full_unstemmed | IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER |
| title_short | IMPLEMENTATION OF A REAL-TIME FUZZY CONTROL SYSTEM FOR ELECTRIC VEHICLE CHARGING STATIONS BASED ON ARDUINO MEGA 2560 MICROCONTROLLER |
| title_sort | implementation of a real-time fuzzy control system for electric vehicle charging stations based on arduino mega 2560 microcontroller |
| topic | electric vehicle fleet fuzzy logic state of charge charging weight coeficient microcontroller. |
| topic_facet | electric vehicle fleet fuzzy logic state of charge charging weight coeficient microcontroller. парк електромобілів нечітка логіка рівень заряду ваговий індекс заряджання мікроконтролер. |
| url | https://ve.org.ua/index.php/journal/article/view/427 |
| work_keys_str_mv | AT bosakan implementationofarealtimefuzzycontrolsystemforelectricvehiclechargingstationsbasedonarduinomega2560microcontroller AT bosakal implementationofarealtimefuzzycontrolsystemforelectricvehiclechargingstationsbasedonarduinomega2560microcontroller AT bosakan realízacíâsisteminečítkogokeruvannâzarâdnimistancíâmielektromobílívurealʹnomučasínaosnovímíkrokontroleraarduinomega2560 AT bosakal realízacíâsisteminečítkogokeruvannâzarâdnimistancíâmielektromobílívurealʹnomučasínaosnovímíkrokontroleraarduinomega2560 |