A small ESP32 display for your Nissan Leaf's battery, like Leaf Spy, with no phone needed. It reads the car through a Bluetooth LE OBD dongle (ELM327 type), shows live battery data while you drive, saves a summary of every trip, and serves a web page with your trip history and battery-health trends. No battery needed: it runs from the car's USB port.
Works with 2011–2025 Leafs: 24 kWh (ZE0/AZE0), 30 kWh (AZE0), and 40 / 62 kWh (ZE1). Developed and tested on a 2017 30 kWh; the 2018+ support follows published decodes and hasn't been tried in a 2018+ car yet.
More pictures: the device's screens and the web page.
LeafDash tells the generations apart by the length of the battery controller's main reply (0x29 = 2011–12, 0x2B = 2013–17, 0x35 = 2018+). You can force it on the setup page (Car → Model years) if detection ever gets it wrong. The detected model is shown in the Diagnostics box on the trips page.
| 2011–2017 | 2018–2025 | |
|---|---|---|
| SOC, current, 12 V | battery group 1 | battery group 1 (SOC and capacity 2 bytes later) |
| Hx, capacity | battery group 1 | battery health group 0x61 |
| SOH | battery health group 0x61 (the figure Leaf Spy shows), else capacity ÷ new capacity | same |
| Gear, odometer, tires, GIDs | the car's broadcasts, with requests as backup | requests only: the 2018+ gateway passes only diagnostic requests and replies to the OBD port |
| Pack kWh | GIDs | SOC × capacity × 350 V (no GIDs reachable) |
On a 2018+ car, set Odometer counts in (setup page) to miles or km, because the odometer's unit broadcast can't be heard. Just after waking up, a 2018+ battery sends a short reply LeafDash ignores; data appears a second or two later.
About $35–60 in parts, no soldering:
| Part | What to get | About |
|---|---|---|
| Display + computer | Elecrow CrowPanel ESP32 2.13" E-paper HMI Display (model DIE01021S). The ESP32-S3 chip, screen, buttons and USB-C are all on one board. | $12–14 from Elecrow, about $25 on Amazon |
| OBD dongle | A Bluetooth LE ELM327 dongle. Developed with the Veepeak OBDCheck BLE. | $20–35 |
| Power | A USB-C cable and a car USB port or 12 V USB adapter. LeafDash runs only while the car is on. | |
| Optional | A DS3231 clock module so every trip gets a date even with no phone hotspot (see "Dates"). | $3 |
Prices are rough, from late 2026.
Yes. The CrowPanel's ESP32-S3 chip only has Bluetooth LE ("Bluetooth Low Energy", the newer low-power kind). It can't talk to "Classic" Bluetooth at all, and the firmware is written for LE on both builds.
- Will work: dongles sold as "Bluetooth LE", "BLE", "Bluetooth 4.0" or "works with iPhone": iPhones only connect to OBD dongles over LE. Dual-mode dongles (LE and Classic), like the Veepeak OBDCheck BLE, are fine.
- Won't work: "Android only" dongles (Classic Bluetooth), and Wi-Fi dongles.
- Also needed: the dongle must handle the Leaf's battery replies, which arrive in several pieces. A dongle that works with Leaf Spy on an iPhone almost certainly works here. Very cheap clones sometimes don't.
A dongle plugged into the OBD port draws a little power all the time. If the car will sit for days, unplug it (see "Note on the 12V battery").
There's a second build for a plain ESP32 dev board + 128x64 I2C OLED (SSD1306 / SSD1315 / SH1106), wired to the board's I2C pins:
| Build | Hardware | Trip log holds |
|---|---|---|
crowpanel213 (default) |
Elecrow CrowPanel ESP32-S3 2.13" e-paper. No wiring. | ~58,000 trips |
esp32dev |
ESP32-WROOM-32 dev board + 128x64 I2C OLED | ~9,500 trips |
- Flash it. With PlatformIO:
pio run -e crowpanel213 -t upload(or-e esp32dev). Libraries install automatically. Or flash a ready-made file from your web browser (see "Flashing from a web browser"). - Plug in the dongle and power LeafDash from a USB port or 12V USB adapter in the car. If Leaf Spy is open and connected to the dongle, close it: a BLE dongle takes one connection at a time.
- Set it up from your phone (once, with the car parked):
- On the LeafDash press MENU → Setup network (or hold MENU for 5 s). It restarts into setup mode and shows a Wi-Fi network name, LeafDash-XXXX. Join it from your phone (no password).
- The setup page opens by itself. If it doesn't, browse to http://192.168.4.1.
- Optionally give it a device name (also its Wi-Fi network name and web address, e.g. "Sonny's Leaf" → http://sonnys-leaf.local) and a password for its own network.
- Pick your home Wi-Fi, enter its password, optionally add your car or phone hotspot (for dates on every drive), choose your battery size (24 or 30 kWh), what the main screen shows, and °F/°C. Tap Save.
- Drive. Trips are logged automatically. When you shift into Park, wait for "Trip saved, safe to switch off" (a few seconds), then switch off.
- See your trips on your phone or computer at http://leafdash.local (or your device name's address, or the address on the LINK page). LeafDash only has power while the car is on, so either sit in the car at home with it on and in Park, or unplug LeafDash and power it from any USB charger indoors.
LeafDash's own network is off unless you turn it on (setup page: "Run LeafDash's own Wi-Fi network while parked"). Turn it on if there's no home Wi-Fi in reach of the car and you don't use a hotspot: then join LeafDash-XXXX (or your device name) with your phone while parked and open http://192.168.4.1. The setup network (MENU → Setup network) always opens it, whatever the setting.
Change settings later: open the web page and tap Settings, or hold MENU (CrowPanel) / the page button (OLED) for 5 seconds.
What it shows when:
- Power-on: "LeafDash" with three dots underneath that fill in as it gets going, and one line saying what it's doing or what to do: Searching for dongle... (no dots filled), Connecting to VEEPEAK... (1), Setting up dongle... (2), Loading data... (3, a few seconds while the car's battery controller wakes up), or, if no dongle is found, Dongle not found / Phone app connected to it? / Press OK to pick a dongle in turn.
- Car on, driving or about to: live data (pages below).
- Shifted into Park after driving: the trip is saved, then the screen changes once to "Trip saved, safe to switch off" (no numbers). Switch off as soon as you see it.
- After that, nothing changes. E-paper keeps its picture without power, so "Trip saved" stays on the glass while the car is parked, and at the next power-on until live data replaces it.
- Shift out of Park and live data comes back. It's the same trip: a stop at a drive-thru or a store with the car left on doesn't start a new one. A trip ends when the car is switched off. To split it yourself, put it in Park and choose MENU → Split trip.
- Switched off in Drive (no Park): the trip is still kept. LeafDash saves it each time the car stands still for 5 s, so it's saved up to that stop. You just don't get the "Trip saved" screen. The connection log notes it at the next power-on.
- Any button press shows the data pages for 30 seconds.
CrowPanel buttons:
- Rotary up / down: previous / next screen (in menus: move up / down)
- Rotary press (OK): full refresh, clears ghosting (in menus: change the setting or open it)
- MENU: settings menu. Hold 5 s: setup network (not while driving)
- EXIT (back): on any card, back to the main LEAF screen. On the main screen: if LeafDash isn't connected to the car, the connection screen (shows the link status; OK there picks a dongle, UP/DOWN returns to the screens); if it is, it stays on the main screen and does a full refresh. In menus: back out. On the setup network screen: cancel setup and restart normally (nothing is changed)
- On the power-on screen, OK opens the dongle picker, and rotary up/down opens the screens even with no dongle connected (30 s). Screens from the trip log (Last trip, Recent trips, Health trend, Link) show your saved data; live screens say "No live data" and why (e.g. "Dongle not found").
Settings menu (MENU):
- Screens: turn each screen below on or off (the LEAF screen is always on)
- Main screen: choose what each of its six areas shows (Left upper, Left lower, Right 1–4). Move to an area and press OK: its value gets arrows (
< Pack kWh >); turn the rotary to cycle the options in place, then OK (or EXIT) to keep it - Temperature, Distance, Clock: °F or °C; miles, km or the car's unit; 12 or 24 hour
- Time zone: OK steps through US Eastern, Central, Mountain, Arizona, Pacific, Alaska, Hawaii, UK / Ireland, Central Europe, Australia East, Japan and UTC. Used for times on the screen (stored times are always UTC)
- Date: M/D/Y, D/M/Y or Y-M-D
- Charging screen: on or off
- Health trend: what the HEALTH TREND card plots (capacity in Ah, SOH or Hx) and what against (trips, date or odometer). The same choice as the battery-health chart on the web page: change it in either place
- Split trip: in Park, end and save this trip and start a new one right away. It asks first and shows the distance so far
- Dongle: pick a different OBD dongle
- Tire positions: match the pressures to the wheels after a tire rotation
- Wi-Fi connection: shows home, hotspot or joining...; otherwise connect. Press OK to look for home Wi-Fi and your phone hotspot right away (and keep looking for the hotspot for 5 minutes, even while driving, until the clock is set). Joining also sets the clock
- Setup network: restart as LeafDash's own Wi-Fi network (LeafDash-XXXX), so your phone can join it and open the settings page (see Quick start). Use it when LeafDash isn't on your home Wi-Fi or hotspot. It asks first and saves your trip before restarting (Bluetooth is off in setup). Not while driving
- Done
The two Wi-Fi lines are at the bottom: open the menu and turn the rotary up two or three clicks to reach them.
Changes save immediately. The same settings are on the setup web page, where the time zone is picked from your phone.
Top bar on every page: the page name, live power in kW with a bar (power out fills right, regen fills left; the ticks under it step with each fresh reading, so a frozen screen is obvious), and status icons in the top-right corner:
- Wi-Fi symbol: connected to home Wi-Fi or a hotspot. Arcs stepping up one by one: joining. No symbol: Wi-Fi off (normal while driving).
- Clock: the date and time aren't set yet, so trips get dates later (or not at all). Disappears once the time is set.
- Crossed-out Bluetooth symbol: no dongle found (check it's plugged in and that no phone app is connected to it). Nothing shows while the dongle is connecting or connected.
| Page | Shows |
|---|---|
| LEAF | Six areas you choose (MENU → Main screen): Left upper (big number), Left lower, and Right 1–4. Default: SOC, kWh, then SOH / Hx / Temp / Tires. Choices: pack kWh, SOC, GIDs, range estimate, SOH, Hx, capacity (Ah), pack temperature, tires, cell spread, lowest cell, pack voltage, 12V battery, power, trip distance, trip efficiency, trip efficiency driving only (without heat/A/C and accessories), efficiency since the last charge, trip kWh used (out of the pack), trip regen kWh (back in), trip kWh net (used minus regen), speed, time, date, or blank |
| TRIP | Current trip (or the last one): distance; kWh (net, and how much came back as regen); efficiency; SOC used; time. Efficiency is distance per net kWh, worked out the same way as Leaf Spy's trip figure. The number in parentheses is the same trip measured with the car's GIDs, a second opinion (see "Efficiency") |
| BATTERY | Capacity (Ah), SOH and Hx (two decimals, as Leaf Spy shows them), pack voltage, pack temperatures (lowest - highest), 12V battery |
| CELLS | All 96 cell voltages as bars (cell 1 on the left), scaled from the lowest cell (bottom) to the highest (top), with an arrow under the lowest. Below: lowest (and which cell), highest, average and spread, in mV |
| TIRES | All four tire pressures on a car outline; flags a tire 3+ psi below the highest |
| RECENT TRIPS | Last four trips: when ("Today 8:12", "Yest", weekday, or date), distance, mi/kWh; charges show kWh added |
| HEALTH TREND | Capacity (Ah), SOH or Hx over the last 60 drives, against trips, date or odometer (MENU → Health trend), and the change |
| EFFICIENCY | Driving: one bar per quarter mile (or quarter km) of this trip, each the distance over the energy used for it, with the trip average as a dotted line and a big number, plus efficiency since the last charge ("charge 3.6") and driving only ("driving 4.9", see "Efficiency"; the heater/A/C share shows there until accessory power has been read). A hollow or dotted bar took no energy (downhill). The scale stops at twice the average, so one coasting stretch can't flatten the rest; a bar with a notch near the top went past it. Up to about 60 bars fit, roughly the last 15 mi. Parked: the same chart for recent trips, 1 bar per trip, with the last trip big, the average of recent trips, and since the last charge. The distance comes from wheel speed between odometer steps (2011–2017, after the first calibrating drive), so the bars are steady; without it, the distance inside each mile is estimated and the bars wobble more |
| LINK | Dongle, Wi-Fi address, clock status, log usage, last reply |
| CHARGING | Not in the rotation: shows by itself while the car is on, in Park, and charging (charge power, SOC, kWh added, time to 80%) |
Is it live? E-paper keeps its picture when power is lost, so a frozen screen looks like a working one. On every data page the header shows live power: the kW value and a bar. Zero sits a third of the way along; power out fills right (full at 80 kW), regen fills left (full at 30 kW). A row of small ticks under the bar steps along with every fresh reading (about every 2 s), so even at zero power you can see it change. Ticks moving = live. Ticks not moving = frozen (power lost or the board hung). If data stops but LeafDash still has power, the bar changes to "no data" within 5 s, and values turn to "--" after 15 s.
The OLED build has the LEAF, TRIP, BATTERY, CELLS (text) and LINK pages, follows the same screen switches (set them on the web page; it has no menu), and shows the kW value with a four-dot heartbeat instead of the bar.
How it connects fast. After the first connection LeafDash remembers the dongle's address, address type and serial service. At power-on it connects straight to it (no 3 s search first), asks only for that service, and uses a quick warm start (ATWS) instead of a full reset (ATZ, up to 3 s). It also asks for a shorter Bluetooth connection interval, which speeds up every exchange with the dongle. If any of that fails, it falls back: a search after two direct tries, and a full reset if the quick start doesn't work. The connection log shows which path it took.
Nothing to set up before flashing. BLE OBD dongles don't use a pairing PIN. On first use LeafDash looks for anything that looks like an OBD dongle (by name, or by the Bluetooth serial service these dongles advertise), connects, and remembers that dongle. After that it only connects to that one, so it never grabs someone else's dongle in a parking lot.
Choosing a different dongle (new dongle, or it picked the wrong device):
- On the CrowPanel: press OK on the power-on screen. A list shows what Bluetooth found nearby, likely OBD dongles first, with signal strength;
*marks the current one. Turn the rotary switch to choose and press OK. "Automatic" forgets the remembered dongle. - On the setup web page: pick it from the OBD dongle list. The list fills when Bluetooth is running (car on in Park), not in setup mode.
Open it on any phone or computer on the same network as LeafDash (see "See your trips" above).
Trips table. Every trip, newest first, with any of the 32 recorded fields as columns. Drag a heading to move it, or use Columns. The layout is saved on LeafDash.
Charts: efficiency over time, efficiency against outside temperature, where the energy went, and battery health. Battery health can show capacity (Ah), SOH or Hx against odometer, date, trip number, charge counts or temperature, with an optional best-fit line.
Downloads (at the bottom): every trip as a spreadsheet file in your units and time zone, or the raw file in UTC.
The pictures come from a test copy of the page with made-up trips (make -C test readme-web).
Trip efficiency is distance ÷ net energy: what left the pack minus what regen put back. LeafDash adds this up from the battery's own voltage and current, about once a second, which is how Leaf Spy's "Wh counter" works too. So the two should agree closely.
Distance is the odometer, with the part-miles at each end filled in (see "Distance").
Voltage between readings. Current is read every second but pack voltage only every 5 s, and the voltage sags under load and rises during regen. LeafDash learns the pack's internal resistance from pairs of readings at different currents (the connection log shows it each time you park, in milliohms; it rises in the cold and as the pack ages) and estimates the voltage for every current reading from it. Using the last voltage reading as-is overstates energy in stop-and-go driving by around 1%; the simulation check (make -C test) shows the difference.
Driving only ("driving 4.9" on the EFFICIENCY screen, "Drv eff" on the main screen, "Driving only" column on the web page) is the same distance over net energy minus heat/A/C and accessories: what moving the car took. The gap between the two is your heater. It needs the accessory power readings (2011–2017 cars through the VCM), which come in coarse steps (250 W for heat/A/C), so treat it as approximate. Energy counts from when the car is switched on, so heating the cabin before you drive off counts too (as in Leaf Spy).
The number in parentheses (TRIP screen) is the same trip measured with GIDs, the car's own count of energy left (77.5 Wh each). GIDs are the car's estimate of usable energy, and it shrinks in the cold (owners have worked out under 70 Wh per GID with a pack near freezing), so on cold mornings this figure reads worse than the real one. It's coarse (it appears once 10 GIDs, about 0.8 kWh, are used), but it's a separate measurement, so a big gap between the two means something is off. Leaf Spy's figure in parentheses is similar, but since the last charge, at 82 Wh per GID.
Since the last charge ("charge 3.6" on the EFFICIENCY screen, or "Charge eff" on the main screen) is all the driving since the battery was last charged, including the trip running now: total distance ÷ total net energy. Like Leaf Spy's "C" figure, it's the one to use for range on this charge. LeafDash spots a charge from the trip log: a trip that charged with the car on, or the battery up by more than 6 GIDs between one drive's end and the next one's start (Leaf Spy's rule; more than 3% SOC if GIDs weren't read, since SOC alone can creep up about 1% after the car sits).
Regen shows on the TRIP screen as part of the kWh line ("3.2 net, 0.6 regen"): 3.8 kWh left the pack and 0.6 came back.
Efficiency is usually worse on cold mornings: a cold pack, a heater warming the cabin, and denser air. The heater/A/C share shows on the EFFICIENCY screen.
Four numbers, and how they fit together:
- Trip kWh used: energy out of the pack this trip (driving, heater, everything).
- Trip regen: energy put back by regen braking.
- Trip kWh net: used − regen. This is what efficiency divides by.
- Pack kWh: energy left, from the car's GIDs × 77.5 Wh (Leaf Spy's default).
So pack kWh at the start − trip kWh net ≈ pack kWh now. Don't subtract regen again: net already has it taken off.
The two sides are measured differently, so expect them to differ a little. Trip energy is LeafDash adding up voltage × current every second. Pack kWh is the car's own GIDs, which move in 77.5 Wh steps and are updated every 10 s. A gap of a few percent is normal. A steady, large gap (both ways, trip after trip) would mean the current scale or the Wh per GID is off: compare both with Leaf Spy's Wh counter and kWh for the same trip.
"Range (estimate)" on the main screen is pack kWh × your average efficiency over the last 10 drives with a distance (total miles ÷ total net kWh). It needs a few logged trips first, and since pack kWh includes the bottom reserve, it reads a little optimistic near empty.
Like Leaf Spy, kWh comes from the car's GIDs (energy units): kWh = GIDs × 77.5 Wh (Leaf Spy's default, so the two show the same kWh; OVMS uses 80). LeafDash reads GIDs every 10 s from car CAN message 0x5B3, which the car's control module sends to the dashboard (decoded per the Leaf DBC: 10 bits, byte 4 bits 0-1 and byte 5).
If GIDs can't be read, kWh is estimated as SOC × capacity (Ah) × 360 V. Both constants are in config.h (WH_PER_GID, PACK_NOMINAL_V).
The serial log shows [gids] 243 (19.4 kWh) when GIDs are coming in. Compare with Leaf Spy's GIDs once to confirm.
The LEAF page shows the lowest and highest tire pressure ("Tires 35-37", in psi), and the web page shows them too. LeafDash asks the instrument cluster for them every 30 s (module 0x743, service 22 PIDs 0E25–0E28, ¼ psi each; as used by py-nissan-leaf-obd-ble). If the cluster doesn't answer, it listens for the TPMS broadcast instead (0x385, bytes 2–5 in ¼ psi; OVMS and the Leaf DBC). TPMS sensors only report now and then, mostly once the car is moving, so it can show "--" for the first minute or two of a drive.
After a tire rotation. 2011–2017 Leafs never relearn which sensor is on which wheel, so after a rotation the car keeps showing each pressure where that tire used to be (unless a shop or Leaf Spy Pro re-registered the sensors). Fix it by swapping wheels until each pressure is in the right place:
- Setup page → Tire positions: a picture of the car with the live pressures. Tap a wheel, then the wheel it belongs on: the two swap. Moved wheels show where their sensor was ("was rear right"). Save to keep it.
- On the LeafDash: MENU → Tire positions. Turn the knob to a wheel, OK, turn to where it belongs, OK. Saved on every swap. EXIT when done.
- Reset (both places) goes back to the car's own positions.
Not sure which tire is which? Let a little air out of one tire and see which number drops; readings come in while driving.
LeafDash keeps one summary per trip. Each is 96 bytes, so the log holds about 58,000 trips (CrowPanel), roughly 50 years at 3 trips a day. Nothing is ever deleted. 9 bytes of each record are kept free for future fields. Older logs are converted automatically on first boot; fields they never had are left blank.
| Column | What it is |
|---|---|
| trip | Trip number |
| date, time | Start (local time in the page download, UTC in /trips.csv) |
| duration_min | Minutes the car was on |
| drive_min | Minutes in Drive or Reverse (the rest is sitting in Park with the car on) |
| odometer | Odometer at the end of the trip |
| distance | Odometer ticks plus the estimated partial miles at each end (see Distance) |
| units | mi or km (your setting) |
| kwh_used, kwh_in, kwh_net | Energy out of the pack, back in (regen), and the difference |
| efficiency | Distance per net kWh |
| climate_kwh | Heater / A/C energy during the trip |
| aux_kwh | Other accessory energy (lights, fans, 12V charging...) |
| gids_start, gids_end | GIDs at start and end (as in Leaf Spy) |
| peak_kw, peak_regen_kw | Highest power out of and back into the pack while driving |
| pack_v_start, pack_v_end, pack_v_min | Pack voltage at start and end, and the lowest under load |
| outside_temp | Average outside temperature, in your display unit |
| pack_temp_min, pack_temp_max | Pack temperature range, in your display unit |
| cell_spread_mv | Largest gap between highest and lowest cell during the trip |
| lowest_cell_mv, lowest_cell_no | Lowest single cell voltage seen, and which cell (1–96). The same cell showing up trip after trip is an early sign of a weak cell |
| tire_start_low_psi, tire_start_high_psi | Lowest and highest of the four tires at the first reading of the trip (close to cold pressure). Trips logged before this change have end-of-trip values (fw blank) |
| low_12v | Lowest 12V battery voltage seen (usually right at car-on, before the car starts charging it) |
| ah, hx, soh | Capacity and Hx at the end. SOH is worked out on export (Ah ÷ new-pack Ah from your settings) |
| quick_charges, l1l2_charges | The car's lifetime charge counters (the "QCs" and "L1/L2s" Leaf Spy shows) |
| coverage_pct | Share of the trip with good battery readings. Below ~95%, the kWh totals are missing some energy (dongle dropouts) |
| fw | Firmware version that recorded the trip, so later fixes to a decode can be applied to old trips |
Charges since the previous trip, and energy charged between trips (GIDs at this start minus GIDs at the last end, x 77.5 Wh), can be worked out from consecutive rows.
Units never get mixed up. The car's odometer counts in its market units (miles for a US car), and the dash display setting doesn't change that (CAN 0x355, per OVMS). LeafDash stores it in metres anyway, so changing any units setting never mixes up the log. Distances are converted to your chosen units only when shown or downloaded.
Display settings (setup page, or MENU on the device): distance (same as the car, miles or km), temperature, 12- or 24-hour clock, and date order (M/D/Y, D/M/Y or Y-M-D). These change only what you see. Downloads always use 24-hour time and Year-Month-Day dates; distance and temperature follow your settings and the header names the unit.
A blank cell means it couldn't be read on that trip. Trips logged by older firmware have blank GIDs, tires and charge counts. SOC at start and end is also kept, for the on-screen trip summary, but isn't exported.
When it saves. The car's USB port loses power the instant you switch off, so the trip is saved before that:
- Shift into Park: LeafDash checks the gear selector every 2 s while moving, and every 0.8 s once you've stopped (car CAN message 0x421). Going from Drive or Reverse into Park saves the trip, reads the odometer, saves again, then shows "Trip saved". That takes a few seconds.
- Stopped in Drive: once per stop, after standing still for 2 s (a light, a drive-thru, or just before you shift into Park). If you switch off without Park, or before the Park save, the trip is kept up to that stop.
- Backup: every minute while driving, every 2 minutes while parked with the car on.
- Car stops answering: saved at once (the car being switched off, or the dongle link dropping mid-drive).
- Before a restart: the trip is closed and saved before the setup network starts, and before LeafDash restarts after you save settings on the web page.
That's about 60 writes an hour of driving, plus one per stop. Each rewrites one 96-byte record and takes a few milliseconds; LittleFS spreads writes over the whole 5 MB, so the flash will outlast the car many times over. The connection log notes each Park save ("trip 12: saved at Park, 8.4 km"), any save that failed, and the gear reading going missing, and it keeps the last four power-ons. LittleFS never corrupts a file if power is cut mid-write.
Trips and charging. A trip starts when the car's battery controller starts answering (car on). On the next power-up the previous trip is closed. A car-on blip under a minute that went nowhere is discarded. A session where SOC rises and the car doesn't move is marked as charging; it shows in the TRIPS card but is left out of the download. The charge counters track charging instead.
Getting the data off. LeafDash needs power (car on in Park, or a USB charger indoors). Then open the trips page:
- On home Wi-Fi or a car/phone hotspot LeafDash knows: http://leafdash.local (or your device name's address)
- If you turned on LeafDash's own network (setup page), join LeafDash-XXXX or your device name and go to http://192.168.4.1
- From the setup page: the "Trips and downloads" link at the top.
The page shows the battery now (charge, kWh, the 96 cells, range at your recent efficiency), with Settings at the top. Below that: your driving stats for the last 30 days or all time, then the trips table, then charts (efficiency over time, efficiency against outside temperature, where the energy went, battery health).
Battery health chart. Pick what to show (capacity in Ah, SOH % or Hx %) and what to plot it against (odometer, date, trip number, quick charges, L1/L2 charges, outside or pack temperature). The default is capacity against odometer. If some drives have no odometer reading or no date, it switches to trip number so none are left out. Tick Best-fit line for a least-squares straight line; the text above the chart gives its slope (for example "−0.8 points per 1,000 mi") and R² (how closely the points follow the line, 1.0 = exactly). Your choices are saved on LeafDash, like the table layout.
Trips table. Every trip is a row, newest first; charging sessions show "Charging". Every recorded field is available as a column.
- Drag a heading left or right to move that column.
- Tap Columns to show or hide columns, move them up or down, or go back to the defaults.
- The layout is saved on LeafDash itself, so it's the same on your phone and computer and survives updates.
- On a phone the table scrolls sideways; the first column stays put. The efficiency cell is green when it's 8% better than your recent average, amber when 8% worse. On iPhone, open the page in Safari: the Wi-Fi sign-in pop-up can't save files.
Wi-Fi is off while driving (in Drive or Reverse), so it doesn't compete with the Bluetooth link; the one exception is the hotspot search for the time in the first minutes, until the clock is set. Shift into Park and it rejoins within a few seconds, starting with the network it was last on. The setup network (MENU → Setup network) turns Bluetooth off, so live data and the trip meter scan don't run in it.
The board has no battery-backed clock, so it gets the time from:
- Your phone's hotspot (no hardware). Add your phone's hotspot on the setup page. For the first 10 minutes after each power-on, and again for 5 minutes once the car starts answering, while the clock isn't set, LeafDash keeps looking for it (every 12 s parked, every 30 s while driving), gets the internet time through it, then turns Wi-Fi off. After the first time it joins, it remembers the hotspot's exact name and asks for it by name straight away. That matters on iPhones: the hotspot usually doesn't show up in Wi-Fi scans unless the phone's Personal Hotspot page is open, but it still answers a device that asks for it by name. If it isn't joining, open that page on the phone once, or press MENU → Wi-Fi connection to try again right away. To make it automatic on an iPhone, add a Shortcuts automation: Automation → Bluetooth → [your Leaf's Bluetooth] → Is Connected → Set Personal Hotspot: On, set to run immediately. The phone then turns its hotspot on whenever it connects to the car. Uses a few KB of data per drive.
- A DS3231 clock module (about $3). Keeps time on its own coin cell. Every trip gets a date, anywhere.
- CrowPanel: wire it to the 4-pin header marked GND / 3V3 / IO41 / IO40: GND→GND, VCC→3V3, SDA→IO41, SCL→IO40.
- OLED build: put it on the same SDA/SCL pins as the OLED (GPIO 21/22).
- It's detected automatically. Many cheap DS3231 boards try to charge their coin cell: fit a rechargeable LIR2032, or remove the charging diode/resistor if you use a CR2032.
- Home Wi-Fi (internet time). Once the dongle is connected (a few seconds after power-on), LeafDash joins home Wi-Fi if it's in range and gets the time. Trips that started before that get their date filled in. After the first join it remembers the access point and channel and goes straight to them, skipping the scan.
- Your phone's browser. Opening the LeafDash web page sets the clock if nothing better has.
Without a clock module, a trip that starts away from home is dated once the clock gets set while the board stays powered. If the power goes off first, that trip stays "(no date)", but its order and all its other data are kept.
The odometer is read every 3 s while driving and again when you shift into Park, from the best source the car offers:
- The instrument cluster in whole km (Nissan service 21, ID 19, module 0x743). Found on a 2017 whose cluster answers only Nissan's older service 21. A km step is 0.62 mi, so there are almost twice as many steps as with miles. Used only after it agrees with source 2 or 3 at the start of each connection ("odometer: using the cluster's km reading" in the connection log); otherwise skipped.
- The broadcast (CAN 0x5C5, 2011–2017), in the car's market units (miles in the US).
- The cluster's standard request (service 22, 0E01), same units. Some clusters reject it.
The trip meters (Trip A/B) count tenths, but a scan of the cluster's codes (22 0E00–0E4F, 21 01–3F) didn't find them.
The odometer only counts whole units (km or miles). On its own that makes a trip off by up to one unit at each end. LeafDash knows the moment each unit ticks over, so the whole units in between are exact; it fills in the two partial units (start to first tick, last tick to Park):
2011–2017 cars: wheel speed. The ABS module broadcasts vehicle speed (CAN 0x284). LeafDash reads it every 2 s while driving and adds it up over time.
- The signal's scale is learned from the odometer: whole miles ÷ summed speed. Each drive checks it (every mile must agree within 15%, which also proves the signal is real) and the learned value is kept for the next drive.
- The first drive with at least 3 whole miles calibrates it ("wheel speed calibrated" in the connection log). Until then, the method below is used.
- Readings a few seconds apart are joined with a straight line; a gap over 20 s falls back to the method below for that piece.
- Simulated: typical error about 0.04 mi, worst 0.1 mi (0.05 / 0.17 mi with 30% of readings missed).
- Raw frames show under Diagnostics ("Speed").
2018+ cars, or no speed readings: rolling time. Each partial mile = rolling time × speed.
- The speed comes from the nearest whole mile of the same trip, so neighborhood streets at the ends aren't measured at highway speed. A trip with no whole mile uses the typical speed near the ends of your recent trips.
- Rolling time counts only while the motor is pushing or braking: pack power minus heater/A/C and accessories is above 0.7 kW. Sitting at a light in Drive doesn't count.
- Simulated: typical error about 0.15 mi with mile steps, 0.07 mi with km steps, against about 0.4 mi from the odometer alone.
Each partial piece is capped at one mile, so the result is never further off than the odometer alone. Distances show one decimal on the device, the web page and the download. Trips logged before this change keep their whole-mile distances.
Speed is also a main-screen option (2011–2017, after the first calibrating drive), in mph or km/h to match your distance setting.
Not needed: trips are saved when you shift into Park. The CrowPanel does have a battery connector, but the board can't measure the battery or tell when USB power is gone, and lithium cells don't like a hot parked car.
python3 tools/release.py builds both boards and puts two files per board in release/ (it needs PlatformIO and esptool):
leafdash-<board>-full.bin: everything. Write it at 0x0. Use it the first time. It clears saved settings (Wi-Fi, dongle, units) but keeps your trips.leafdash-<board>-update.bin: the app only. Write it at 0x10000. Keeps settings and trips.
To flash: open the online ESP flasher in Chrome or Edge (Safari and Firefox can't talk to USB devices), plug in the board, click Connect, pick its port, enter the address, choose the file, and click Program. Then press reset. Don't tick "Erase flash": that deletes your trips.
Check the address every time. The online flasher fills in 0x1000 by itself (right for older ESP32 boards, wrong for this one). A file written at 0x1000 overwrites the board's start-up code and settings, and the board won't start: the serial log repeats Checksum failure. Fix: write leafdash-crowpanel213-full.bin at 0x0. Your trips survive (they're stored much further up), but settings are reset, so redo Wi-Fi setup.
From a terminal instead: esptool write-flash 0x0 release/leafdash-crowpanel213-full.bin.
- Make a folder named
LeafDash, copy everything fromsrc/into it, and renamemain.cpptoLeafDash.ino. - In
config.h, setBOARD_CROWPANEL_213to 1 (CrowPanel) or 0 (OLED). - Install the ESP32 board package, NimBLE-Arduino (2.x), and Adafruit GFX (CrowPanel) or U8g2 (OLED).
- Board: "ESP32S3 Dev Module" (CrowPanel) or "ESP32 Dev Module" (OLED). Partition scheme: the largest SPIFFS/LittleFS option with at least a 2 MB app. Upload.
Most people never need these. Settings marked "default" can also be changed on the setup page.
EPD_CONTROLLER: the CrowPanel ships with an SSD1680 or a JD79661 display chip, detected at boot (shown in the serial log). If the screen is blank or garbled, force 1 (SSD1680) or 2 (JD79661).EPD_ROTATE_180: 1 if the picture is upside down.EPD_MIRROR: 1 if the picture is mirror-imaged (reads backwards).EPD_INVERT: 1 if the picture is white-on-black.EPD_FULL_EVERY: how many quick refreshes between full (flashing) ones that clear ghosting. Default 150, about every 5 minutes while driving.OLED_SH1106: 1 for SH1106 screens (common on 1.3" boards).CURRENT_SIGN: flip to -1 if power reads negative while driving.DEBUG_RAW: 1 prints every raw dongle reply to the serial monitor (115200 baud).
| Value | Source | Confidence |
|---|---|---|
| SOC, Hx, capacity (Ah) | LBC group 1. OVMS, Battery-Emulator and the Leaf CAN spreadsheet agree | High |
| Cell voltages, pack voltage | LBC group 2. OVMS | High |
| Pack temperatures | LBC group 4. OVMS and the spreadsheet | High |
| Odometer | Instrument cluster 0x743, service 21 ID 19, whole km (found by scanning a 2017 cluster; matched the dash). Car CAN 0x5C5 / 0x355 (OVMS, Leaf DBC). Cluster service 22 PID 0E01 (py-nissan-leaf-obd-ble): rejected by the 2017 cluster ("7F 22 11") | High |
| Vehicle speed | Car CAN 0x284 bytes 4–5 (OVMS, Leaf CAN spreadsheet); scale learned from the odometer | Medium until seen in the car |
| GIDs / kWh | Car CAN 0x5B3, per the Leaf DBC only (OVMS reads GIDs from a different bus) | Medium. Compare with Leaf Spy's GIDs once |
| Charge counters | VCM 0x797 → 0x79A, service 22 PIDs 1203 (quick) and 1205 (L1/L2). Community logs on mynissanleaf.com and a Home Assistant Leaf integration | High; read once per drive |
| Outside temperature | VCM service 22 PID 115D, byte / 2 - 40 °C. py-nissan-leaf-obd-ble; same scale as the car's 0x54C broadcast in OVMS | Medium. Compare with the dash once |
| Climate / aux power | VCM service 22 PIDs 1151 (A/C system, x250 W) and 1152 (auxiliary, x100 W). py-nissan-leaf-obd-ble | Medium. Coarse steps; whether 1151 includes the resistive (PTC) heater is unconfirmed. Compare with Leaf Spy on a cold day |
| Tire pressures | Broadcast 0x385 (OVMS, Leaf DBC); BCM 0x745 service 21 ID 10 (layout unknown, raw reply in Diagnostics); cluster PIDs 0E25–0E28 (py-nissan-leaf-obd-ble), but the 2017 cluster rejects service 22 | Not working yet on the 2017 |
| Gear (Park detection) | Car CAN 0x421, byte 0 bits 3–5. OVMS | High; the Leaf DBC is unsure 0x421 is on the AZE0 car bus, OVMS uses it there |
| 12V battery | Group 1 as mV per Battery-Emulator; the older spreadsheet implies ~2% different | Medium. Check with a voltmeter |
| Current, power, kWh, efficiency | Group 1 bytes 2–5, signed, ÷1024, times pack voltage (group 2). Sign confirmed in the car (discharge reads negative, so it's flipped). Scale still to check against Leaf Spy; the GIDs figure in parentheses on the TRIP screen is a cross-check | Medium |
| SOH | Estimate: capacity now ÷ capacity new. Leaf Spy's SOH may differ by a few % | Estimate |
- Something didn't connect at power-on: power-cycle LeafDash, open the web page and expand Diagnostics. The connection log shows what happened this power-on and the one before, with times since power-on: when the dongle was found, connected and set up, when the car first answered, each Wi-Fi attempt and why it failed, and when the clock was set. It's also at
/events.txt. - Slow start (car takes a while to wake up): LeafDash now recovers by itself instead of needing a power cycle:
- Dongle not found after about 30 searches, or 3 failed connects: Bluetooth is restarted from scratch.
- Dongle connected but the car silent for about a minute: the dongle is set up again (every minute for 10 minutes, then every 10 minutes).
- Wi-Fi and Bluetooth take turns on the shared radio. Bluetooth goes first: no Wi-Fi attempt starts while the dongle is being connected, or in the first 20 s after power-on while LeafDash looks for it. After that, no dongle search starts while a Wi-Fi join is in progress, and a network that isn't in range is given up after its quick scan (a few seconds) instead of a 15-20 s join attempt.
- Power-on screen says "Dongle not found": check the dongle is plugged in. A BLE dongle takes one connection at a time and hides while connected, so if Leaf Spy (or another app) is open and connected to it, LeafDash can't see it. Having used Leaf Spy before is fine; only a live connection gets in the way. If you replaced the dongle, choose the new one with OK, or choose "Automatic".
- "Loading data..." doesn't go away: the battery controller isn't answering. This is normal for a few seconds after power-on; if it stays, the car may be in accessory mode (power pressed without the brake).
ELM init failed: setDEBUG_RAW 1and look at which AT command the dongle rejected.unknown G1 layout: probably a 2018+ Leaf.- "Trip saved" never appears / no distance: the dongle may not support listen mode (
ATMA), which reading the gear and odometer needs. The serial log shows[odo] not seen. The trip is still saved each time the car stops (power near zero for 5 s), just without the confirmation screen. - Tires, gear or odometer not working: open the trips page and expand Diagnostics. It shows the raw replies from the car for each source LeafDash tried (TPMS broadcast, instrument cluster, body control module). Tire sensors only start reporting after ~500 ft of driving.
- Hotspot not joining / no date: the LINK page's Wi-Fi line says why:
- hotspot not found: nothing answered to the hotspot's name. For the very first join, open Settings → Personal Hotspot on the iPhone and leave it open until LeafDash joins; after that it finds the hotspot by name. LeafDash only sees 2.4 GHz networks. On iPhone turn on Settings → Personal Hotspot → Maximize Compatibility. Also check the hotspot is on and "Allow Others to Join" is enabled. The serial log lists every network it did see.
- hotspot: password?: the network was found but wouldn't let LeafDash in. Re-enter the password on the setup page.
- joined, no internet time: connected, but the hotspot has no internet (or blocks time servers).
- Name matching ignores upper/lower case and the iPhone's curly apostrophe (Sonny’s vs Sonny's).
- After fixing the cause, MENU → Wi-Fi connection → OK tries again right away instead of waiting for the next automatic try.
- Page doesn't load on home Wi-Fi: try the IP address on the LINK screen instead of leafdash.local. Wi-Fi and Bluetooth share one radio, and while Bluetooth is on the ESP32 has to keep Wi-Fi in a power-saving mode that slows every request. So when no dongle is connected (e.g. on a charger indoors) and a web page is open, LeafDash switches Bluetooth off and runs Wi-Fi at full speed; Bluetooth comes back 30 s after the page is closed. With the dongle connected (car on), pages still work but respond more slowly.
- leafdash.local doesn't open: some Android phones don't support
.localnames. Use the IP address shown on the LINK page.
The firmware is PlatformIO (Arduino framework). Host-side checks need only g++ and make:
make -C test # every source compiles against host shims + trip distance simulation
make -C test ui # e-paper layout test (after one `pio run -e crowpanel213`)
make -C test web # web page screenshots against a mock LeafDash (needs Playwright)
python3 test/web/mock_server.py live 8801 # work on the pages in a browser
The web pages live in web/ as plain HTML. After editing them, run python3 tools/embed_pages.py to regenerate src/web_pages.h (don't edit that file by hand). See CLAUDE.md for the code layout and conventions.
A dongle left in the OBD port draws power all the time, and the Leaf's 12V battery is small. If the car will sit for days, unplug the dongle.
- OVMS3
vehicle_nissanleaf.cpp: github.com/openvehicles/Open-Vehicle-Monitoring-System-3 - Battery-Emulator
NISSAN-LEAF-BATTERY.cpp: github.com/dalathegreat/Battery-Emulator - Leaf CAN messages, DBC files and spreadsheet: github.com/dalathegreat/leaf_can_bus_messages
- Elecrow CrowPanel 2.13" demo code and schematic: github.com/Elecrow-RD/CrowPanel-ESP32-2.13-E-paper-HMI-Display-with-122-250
Google Sheets trip upload. Whenever LeafDash is online (home Wi-Fi or the phone hotspot), send new and updated trips to a Google Sheet:
- A small Google Apps Script, deployed as a web app on the sheet, receives each trip as JSON over HTTPS.
- It appends a row per new trip and updates an existing row in place, matched by trip ID (e.g. when a later save adds the final odometer).
- Columns as in the trip log table above, in display units and the sheet's time zone. Drives only; charging shows up through the charge counters.
- It can add calculated columns (optional cost per trip from an electricity rate) and a battery-health tab (Ah, Hx, SOH over time) with charts.
- First sync uploads every trip already on the device.
- It never touches columns you add yourself (notes, destinations).
- On LeafDash: one "Sheet URL" field on the setup page, an "uploaded up to trip N" marker in flash, and an upload step after the clock sync. HTTPS uses the ESP32's built-in root certificate bundle.
MIT. See LICENSE.

















