ESP32 Projects
Start a build
Markdown

Radbuzz for ESP32-P4

An ESP32 display project for ESP32-P4 involving Rotary encoder, SD card.

ESP32-P4ESP-IDF, ArduinoUnrated
Parts and source

Before you start

Check the exact Rotary encoder, SD card configuration against the upstream wiring or parts list.

Upstream README

Radbuzz

Radbuzz is an infotainment and trip computer for electric mopeds and motorcycles, targeting VESC-based controllers. It's built for an ESP32P4 microcontroller, but can also be run on the desktop for testing.

how it looks mounted on the moped the default map screen zoomed out

maximum zoom with range speech bubbles with help text speedometer only screen

trip meter screen menu screen settings menu screen

incoming call screen message on the speedometer screen

Features:

  • OpenStreetMap-based map (currently OpenCycleMap) with different zoom levels, via a GPS module
  • Supports receiving Google maps/OsmAnd/etc navigation instructions via the Gadgetbridge app
  • Speedometer, both based on VESC data and GPS
  • Trip data, with average consumption, distance etc
  • Tesla-style power meter bar on the right
  • Trip log shown on the map, with power indicator in color
  • Range estimation shown on the map
  • BMS status via BLE (currently em3ev KingShark/Ali new energy BMSes)
  • Incoming phone calls can accepted/declined
  • SMS:es and emails are forwarded from the phone
  • A menu for configuration
  • Written in clean and modern C++ (C++23)

Hardware:

the pinout for the ESP32P4 can be seen in waveshare_p4_touch_4_3/main.cc

Setup

First install the eim tool (the esp-idf installation manager).

eim install -i v6.1
source $HOME/.espressif/tools/activate_idf_v6.1.sh
npm i lv_font_conv -g
pip3 install jinja2 pyyaml

Build (target)

cmake -GNinja -B radbuzz_waveshare_p4_touch_4_3 -DCMAKE_BUILD_TYPE=Release <path>/radbuzz/esp32/waveshare_p4_touch_4_3
cmake --build radbuzz_waveshare_p4_touch_4_3

And then flash with

cd radbuzz_waveshare_p4_touch_4_3
ninja flash   # Or idf.py flash

Build (qt/unittest)

Install the same lvgl/Python dependencies as on target:

npm i lv_font_conv -g
pip3 install jinja2 pyyaml

And then:

cmake -GNinja -B radbuzz_qt <path>/radbuzz/qt
cmake --build radbuzz_qt

or

cmake -GNinja -B radbuzz_unittest <path>/radbuzz/test/unittest/
cmake --build radbuzz_unittest

See doc/build_instructions.md for more details on building and flashing the C6 firmware for wifi/Bluetooth.

The OSM API key

Get an API key for thunderforest via https://www.thunderforest.com/docs/apikeys/

Put this key as a plain string in an osm_api_key.txt file in the root directory of this project, to build it into the firmware.

A key can also be placed on the SD card, as app_data/osm_key.txt, which will be preferred over the build time one if it exists. It's JSON:

{"api_key": "0123456789abcdef"}

Wifi SSID

Store the SSIDs and passwords as JSON in an app_data/ssid.txt file on the SD card. E.g.,

{
  "networks": [
    {"ssid": "MySsid", "password": "PasswordForMySsid"},
    {"ssid": "OtherSsid", "password": "PasswordForOtherSsid"},
    {"ssid": "OpenCafeSsid"}
  ]
}

Leave out the password for open networks. The networks are stored on the board, and the file is only imported again when its contents change.

Trip upload

Trips are uploaded to a Traccar server with the OsmAnd protocol, configured with a JSON app_data/traccar.txt file on the SD card:

{"url": "https://host.tailnet.ts.net", "id": "device-id", "demo_id": "demo-device-id"}

The demo_id is optional, and demo trips are only uploaded with it. Like ssid.txt, the file is stored on the board and only imported again when it changes.