Erich Styger's Raspberry Pi Pico W-Powered Charge Control Fills His Electric Vehicle with Sunlight

Using MQTT to talk to Home Assistant and Modbus RTU to control an EV charger, this gadget maximizes solar energy into the battery.

Engineer Erich Styger has taken responsibility for his energy footprint serious with a bit of technology: a Raspberry Pi Pico W-powered electric vehicle charging system which aims to maximize the amount of solar energy, rather than grid energy, that goes into the vehicle — all nicely tied in to Home Assistant for good measure.

"I’m in the final stage of finishing a electrical vehicle (EV) charger controller, which optimizes battery loading using the available PV system: use as much as possible the solar energy and not the grid," Styger explains. "While the controller talks with a Modbus (RS-485) interface to the vehicle charger itself, it uses MQTT over Wi-Fi to get information about the available solar energy from HomeAssistant and the Powerwall."

The project builds on Styger's earlier work in finding and using a Modbus Remote Terminal Unit (RTU) interface in a commercial off-the-shelf Heidelberg EV charging station — which, handily, takes the high-current part of the problem, getting power into the vehicle's battery, out of his hands. Using this control, then, Styger sought to tie everything in to Home Assistant and provide a means to limit charging to only when excess solar is available.

Styger's solution for this: a Raspberry Pi Pico W microcontroller board, installed as a module on a custom PCB which includes four addressable WRGB LEDs for status reporting, a compact OLED display, and a joystick for navigation. Messaging between Home Assistant and the charge controller is handled via MQTT, with the Modbus RTU protocol used from the controller to the EV charging station.

"With the MQTT protocol, the controller receives information about the solar energy produced and how much is used by the building," Styger explains. "That way the system can adjust the charging levels to maximize usage of solar energy for the charging process: instead [of] feeding energy to the grid, it is used first to charge the vehicle battery."

A full write-up is available on Styger's website; project source code has been published to GitHub under the permissive BSD 3-clause license, along with an SVG for a laser-cut enclosure.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles