With this sketch you can use an ESP8266/ESP32 as the central control unit of an EVSE. It controls the HW peripherals of the EVSE and connects the charge point to an OCPP server. When booting up the EVSE, it opens a maintenance web dashboard for setting the Wi-Fi and OCPP credentials (thanks to tzapu's WiFiManager).
The communication controller can connect to an SAE J1772 driver using the GPIO pins of the ESP. Furthermore, it can show the online status and charge point availability status via status LEDs. Displays, RFID readers or energy meters are not supported, though for your project you can integrate further HW components of course.
You can find the interface descriptions in main.ino. Please be aware that although this program modulates the maximum charge rate with PWM analogous to the SAE J1772 standard, the PWM signal does not reflect the EVSE state. The latter is encoded via the other GPIO pins.
- Create an empty project in the PlatformIO IDE.
- Copy the
platformio.inifrom ArduinoOcpp's root directory to your source directory. Addtzapu/WiFiManager@0.16.0to the libdeps of theplatformio.ini. - Copy the
main.inofrom this example folder into your source directory. Adapt the pinout settings if needed. - Finished. You should be able to compile and upload the sketch onto your ESP.
If you just want to check out ArduinoOcpp you can run this sketch on an ESP without any peripherals. The pinout of the ESP8266-NodeMCU board is already fully configured in main.ino so that board is the most convenient to start testing.