Erich Styger's Modbus RTU Project Connects Microcontrollers to Electric Vehicle Charging Boxes - Hackster.io

2023-01-03 13:31:54 By : Ms. Amanda Xinhe

Please ensure that JavaScript is enabled in your browser to view this page.

Embedded developer Erich Styger's latest project offers a look at controlling an electric vehicle (EV) charging station from a Raspberry Pi Pico W or similar microcontroller board — using the Modbus Remote Terminal Unit (RTU) protocol to monitor the system and charge a vehicle only when solar power is available. Commercial EV Charging Hub

Erich Styger's Modbus RTU Project Connects Microcontrollers to Electric Vehicle Charging Boxes - Hackster.io

"I have spent some time today on a little side project […] about making an Electrical Vehicle (EV) wallbox charger accessible over Modbus RTU," Styger writes by way of introduction. "It is not finished yet, and I plan to publish more articles on it, but I can share that I’m able to access and control the Heidelberg EV charger with a Raspberry Pi Pico W (Dual Core [Arm] Cortex M0+), NXP K22FN512 (Cortex M4F) and LPC845 (Single Core Cortex M0+)."

The project, inspired by rising energy prices and a desire to switch from a hybrid to a fully electric vehicle in the coming months, centers around the 11kW Heidelberg Energy Control wallbox — chosen, in part at least, for the manufacturer's provision of a Modbus RTU interface from which the device can be queried and controlled.

"What I really wanted is to integrate the charger into my home energy management system (HEMS with Home Assistant)," Styger explains. "For this the Modbus (RS-485) interface is key: with this, I can adjust and control charging based on the energy coming from the PV (photovoltaic) system, optimizing solar energy usage. Ideally, no grid electricity is used for charging the car, because the system follows the solar production."

Styger has wired the Modbus on the charge controller to one of a number of microcontroller boards he has available, including the low-cost Raspberry Pi Pico W — though notes the firmware does not yet take advantage of the board's integrated Wi-Fi connectivity. The microcontroller communicates with the charger using the Modbus RTU protocol, providing access to system status including events such as vehicle connection and control over its settings — key to the final goal of being able to charge a vehicle purely when solar power is available.

"So far I have a command line interface working, running on an NXP LPC845, NXP K22FN512, and a Raspberry Pi Pico W," Styger concludes of the work in progress. "The Pico W will give me a WiFi interface. Additionally I plan to design a dedicated PCB, having a small OLED and some buttons as a user interface. The full integration into Home Assistant is pending too."

The full write-up is available on Styger's website; the source code has been rolled into the McuOnEclipseLibrary project, available on GitHub under a permissive open source license.

Erich Styger's Modbus RTU Project Connects Microcontrollers to Electric Vehicle Charging Boxes - Hackster.io

AC EV Charging Station Hackster.io, an Avnet Community © 2023