mirror of
https://github.com/Legolas-2025/Standalone-electricity-price-ticker.git
synced 2026-08-18 12:44:54 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcc434f7e4 | ||
|
|
6c7a66be8e | ||
|
|
e1ad1b01c3 | ||
|
|
f77f50f1d4 | ||
|
|
45cabc17dd | ||
|
|
fedef66ae0 | ||
|
|
65fdb14cec | ||
|
|
3da3dec344 | ||
|
|
6a6cf113b3 | ||
|
|
26b1a309e1 |
+29
-2
@@ -4,11 +4,38 @@ All notable changes to this project are documented here.
|
||||
|
||||
---
|
||||
|
||||
## v6.1.2 – LED Indicator Restored (ESP32 PWM Fix) (2026‑03‑11)
|
||||
|
||||
**Summary**
|
||||
|
||||
This release fixes a regression introduced in **v6.1.1** where the **white LED price indicator** could remain **dimly lit** even when the LCD backlight turned off, and the intended **blink/breathe patterns** no longer behaved correctly.
|
||||
|
||||
### Fixed: White LED Stuck Dim / Patterns Broken (PWM vs Digital)
|
||||
|
||||
**Problem (v6.1.1):**
|
||||
|
||||
- The sketch uses `analogWrite()` to drive the LED with PWM for breathe/blink patterns.
|
||||
- However, in some “LED OFF” branches the code used `digitalWrite(LOW)` on the same `whiteLedPin`.
|
||||
- On ESP32 (LEDC), once PWM is attached to a pin, `digitalWrite(LOW)` may **not fully disable** PWM output.
|
||||
- Result:
|
||||
- LED could remain **faintly on** (dim glow) when LEDs were supposed to be off (e.g., presence timeout / backlight off).
|
||||
- Some patterns could appear “stuck” or inconsistent.
|
||||
|
||||
**Solution (v6.1.2):**
|
||||
|
||||
- LED control is now **PWM‑only** inside `updateLeds()`:
|
||||
- Use `analogWrite(whiteLedPin, 0)` instead of `digitalWrite(whiteLedPin, LOW)`.
|
||||
- Use `analogWrite(whiteLedPin, 255)` instead of `digitalWrite(whiteLedPin, HIGH)`.
|
||||
- Blink/double‑blink toggles now switch between PWM **0** and **255**.
|
||||
- This ensures the LED is **truly off** whenever LED output is gated off (no data, no time sync, or presence timeout).
|
||||
|
||||
---
|
||||
|
||||
## v6.1.1 – Daily Min/Max Includes Negative & Zero Prices (2026‑03‑07)
|
||||
|
||||
**Summary**
|
||||
|
||||
This release fixes a bug where the **daily lowest / highest hourly price marker** ignored negative prices (and also ignored 0.0), which could cause the ticker to incorrectly mark the **lowest positive** hour as the daily minimum.
|
||||
This release fixes a bug where the **daily lowest / highest hourly price marker** ignored negative prices (and also ignored 0.0), which could cause the ticker to incorrectly mark the **lowest positive[...]
|
||||
|
||||
### Fixed: Daily Low/High Marker Ignored Negative & Zero Prices
|
||||
|
||||
@@ -40,7 +67,7 @@ This release fixes a bug where the **daily lowest / highest hourly price marker*
|
||||
|
||||
**Summary**
|
||||
|
||||
This release fixes a bug where the ticker could remain indefinitely on the **“No data for today”** screen after midnight, even though the API was already returning fresh data. It also refines the after‑midnight retry schedule.
|
||||
This release fixes a bug where the ticker could remain indefinitely on the **“No data for today”** screen after midnight, even though the API was already returning fresh data. It also refines the [...]
|
||||
|
||||
### Fixed: Stuck on NO_DATA_OFFSET After Midnight
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
# Hardware Wiring Diagram (Seeed XIAO ESP32‑C3 Electricity Price Ticker)
|
||||
|
||||
This document depicts the wiring for the **Electricity Price Ticker** project based on the connection instructions in `README.md`.
|
||||
|
||||
It includes:
|
||||
- Required peripherals (LCD + button)
|
||||
- Supported optional peripherals (presence sensor + white LED + optional TTP223 touch button alternative)
|
||||
|
||||
> Further reference (official board documentation):
|
||||
> - https://wiki.seeedstudio.com/XIAO_ESP32C3_Getting_Started/
|
||||
|
||||
> Notes:
|
||||
> - Always connect **all grounds together** (ESP32 GND, LCD GND, sensor GND, LED GND).
|
||||
> - Verify your **XIAO ESP32‑C3 pinout** in the Seeed documentation link above.
|
||||
> - **Important:** The **10 kΩ pull-down resistor on D9 is mandatory at all times** (even if the presence sensor is not connected).
|
||||
> - Button input is on **D2**. You may use either a **mechanical pushbutton** (default) *or* a **TTP223 touch module** (alternative), but not both in parallel unless you know what you’re doing.
|
||||
|
||||
---
|
||||
|
||||
## 1) Wiring overview (diagram)
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
MCU["Seeed XIAO ESP32-C3"]:::mcu
|
||||
|
||||
LCD["20x4 I2C LCD 2004<br/>PCF8574 backpack<br/>I2C addr 0x27"]:::lcd
|
||||
|
||||
%% Button input options (XIAO D2)
|
||||
D2NODE["D2 node<br/>(buttonPin input)"]:::io
|
||||
BTN["Mechanical pushbutton<br/>default option<br/>active LOW to GND"]:::btn
|
||||
TTP["TTP223 capacitive touch<br/>optional alternative<br/>OUT is HIGH when touched"]:::touch
|
||||
|
||||
%% Presence-sensor input stage (XIAO D9) - always present
|
||||
D9NODE["D9 node<br/>(presencePin input)"]:::io
|
||||
RPD["10k pull-down resistor<br/>D9 to GND<br/>MANDATORY"]:::res
|
||||
PRES["RCWL-0516 presence sensor<br/>optional"]:::pres
|
||||
|
||||
%% White LED output (XIAO D3)
|
||||
LED1["White indicator LED<br/>optional"]:::led
|
||||
|
||||
PSU5V["5V supply<br/>USB-C or regulated 5V"]:::pwr
|
||||
V33["3.3V rail from XIAO"]:::pwr
|
||||
GND["Common GND"]:::gnd
|
||||
|
||||
%% Power
|
||||
PSU5V -->|"5V"| MCU
|
||||
PSU5V -->|"5V or 3V3 if LCD supports"| LCD
|
||||
MCU -->|"3V3"| V33
|
||||
V33 -->|"3V3"| PRES
|
||||
V33 -->|"3V3"| TTP
|
||||
|
||||
%% Grounds
|
||||
MCU --- GND
|
||||
LCD --- GND
|
||||
BTN --- GND
|
||||
TTP --- GND
|
||||
D2NODE --- GND
|
||||
|
||||
D9NODE --- GND
|
||||
PRES --- GND
|
||||
|
||||
LED1 --- GND
|
||||
PSU5V --- GND
|
||||
|
||||
%% I2C
|
||||
MCU -->|"SDA D4"| LCD
|
||||
MCU -->|"SCL D5"| LCD
|
||||
|
||||
%% Button input stage (always)
|
||||
MCU -->|"D2 (buttonPin)"| D2NODE
|
||||
BTN -->|"button to GND"| D2NODE
|
||||
TTP -->|"OUT to D2 node"| D2NODE
|
||||
|
||||
%% Presence input stage (always)
|
||||
MCU -->|"D9 (presencePin)"| D9NODE
|
||||
D9NODE ---|"10k"| RPD
|
||||
RPD -->|"to GND"| GND
|
||||
PRES -->|"OUT to D9 node"| D9NODE
|
||||
|
||||
%% White LED (single LED, directly from pin with series resistor)
|
||||
MCU -->|"D3 (whiteLedPin)"| LED1
|
||||
|
||||
classDef mcu fill:#e8f0ff,stroke:#2b5fd9,stroke-width:1px,color:#000;
|
||||
classDef lcd fill:#fff4e5,stroke:#cc7a00,stroke-width:1px,color:#000;
|
||||
classDef btn fill:#eaffea,stroke:#2d8a2d,stroke-width:1px,color:#000;
|
||||
classDef touch fill:#e6fcff,stroke:#0077b6,stroke-width:1px,color:#000;
|
||||
classDef pres fill:#f3e8ff,stroke:#7b2cbf,stroke-width:1px,color:#000;
|
||||
classDef led fill:#ffe8ef,stroke:#c9184a,stroke-width:1px,color:#000;
|
||||
classDef res fill:#f5f5f5,stroke:#444,stroke-width:1px,color:#000;
|
||||
classDef pwr fill:#fff,stroke:#444,stroke-width:1px,color:#000;
|
||||
classDef gnd fill:#fff,stroke:#000,stroke-width:1.5px,color:#000;
|
||||
classDef io fill:#f5f5f5,stroke:#111,stroke-width:1px,color:#000;
|
||||
@@ -9,8 +9,9 @@ This project is an Arduino‑IDE‑friendly firmware for the **Seeed XIAO ESP32
|
||||
- Uses a white LED and an optional presence sensor to give quick visual feedback.
|
||||
- Stores daily price data in **NVS** to survive reboots and reduce API calls.
|
||||
|
||||
The latest sketch implements **Version 6.1.1**, focusing on:
|
||||
The latest sketch implements **Version 6.1.2**, focusing on:
|
||||
|
||||
- Version 6.1.2 fix: restore correct **white LED indicator** behavior (ESP32 PWM fix; no dim glow when off).
|
||||
- Version 6.1.1 fix: Correct daily **low/high hourly markers** (now includes negative and **0.0** prices).
|
||||
- Daily (not hourly) API fetching.
|
||||
- Robust **NVS storage** of daily price data.
|
||||
@@ -237,7 +238,7 @@ The LED is driven with various patterns to indicate price level; see “LED Pric
|
||||
|
||||
---
|
||||
|
||||
## Firmware Features (v6.1.1)
|
||||
## Firmware Features (v6.1.2)
|
||||
|
||||
### Core Display & Pricing
|
||||
|
||||
@@ -262,7 +263,7 @@ The LED is driven with various patterns to indicate price level; see “LED Pric
|
||||
- Local language letters.
|
||||
- Low‑price and high‑price indicators.
|
||||
- **Daily min/max markers**:
|
||||
- The low/high hourly indicators now consider **negative**, **0.0**, and positive prices (v6.1.1 fix).
|
||||
- The low/high hourly indicators consider **negative**, **0.0**, and positive prices (v6.1.1 fix).
|
||||
|
||||
### LED Price Signalling
|
||||
|
||||
@@ -275,6 +276,11 @@ The white LED (GPIO 5) reflects the **current 15‑minute interval** price:
|
||||
- Very expensive → complex “double‑blink with long on” pattern.
|
||||
- Negative price or no data → LED off.
|
||||
|
||||
**Important implementation note (v6.1.2):**
|
||||
|
||||
- On ESP32, avoid mixing PWM (`analogWrite`) and `digitalWrite` on the same LED pin.
|
||||
- The firmware now uses `analogWrite(pin, 0/255)` consistently to guarantee the LED is fully off when gated off.
|
||||
|
||||
LED is **disabled** when:
|
||||
|
||||
- No data for today.
|
||||
@@ -558,13 +564,14 @@ If NVS does not contain valid Wi‑Fi credentials, or if connecting fails repeat
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Versioning & Changelog
|
||||
|
||||
- **v5.5** – 15‑minute detail mode, LED based on current 15‑minute slot, improved DST handling (see file `20251027a_electricity_ticker_10_5_5_latest_DST_and_midnight_fix.ino`).
|
||||
- **v6.0.0** – First NVS‑enabled version:
|
||||
- Store daily price data in NVS.
|
||||
- Reduce API calls to “boot + after‑midnight”.
|
||||
- Add NVS status section to secondary menu.
|
||||
- **v6.1.2** – LED indicator restored (broken in previous version):
|
||||
- Avoid mixing PWM and `digitalWrite` on the same LED pin (ESP32 LEDC behavior).
|
||||
- Ensures LED is fully off when gated off; patterns operate correctly.
|
||||
- **v6.1.1** – Daily low/high marker fix:
|
||||
- Daily min/max and average now include negative and **0.0** prices.
|
||||
- **v6.1.0** – Midnight fetch & “today” detection fixes:
|
||||
- Correctly detect **market day** using the last `unix_seconds` timestamp.
|
||||
- Distinguish between:
|
||||
@@ -574,6 +581,11 @@ If NVS does not contain valid Wi‑Fi credentials, or if connecting fails repeat
|
||||
- Two retries every 20 minutes in the first hour (~00:20, ~00:40).
|
||||
- Then hourly retries (top‑of‑hour) until today’s dataset is available.
|
||||
- Behavior on reboot and manual long‑press is unchanged, but now respects the improved “today” logic.
|
||||
- **v6.0.0** – NVS storage & daily fetch:
|
||||
- Store daily price data in NVS.
|
||||
- Reduce API calls to “boot + after‑midnight”.
|
||||
- Add NVS status section to secondary menu.
|
||||
- **v5.5** – 15‑minute detail mode, LED based on current 15‑minute slot, improved DST handling (see file `20251027a_electricity_ticker_10_5_5_latest_DST_and_midnight_fix.ino`).
|
||||
|
||||
See [`CHANGELOG.md`](./CHANGELOG.md) for more details.
|
||||
|
||||
|
||||
+21
-6
@@ -2,6 +2,26 @@
|
||||
|
||||
## Current firmware
|
||||
|
||||
- **Version:** 6.1.2
|
||||
- **Release date:** 2026-03-11
|
||||
- **Target MCU:** Seeed XIAO ESP32‑C3
|
||||
- **Display:** 20x4 I²C LCD (PCF8574, default address `0x27`)
|
||||
- **API endpoint:** `https://api.energy-charts.info/price?bzn=SI`
|
||||
- **Resolution:** 15‑minute intervals, hourly averages for overview
|
||||
|
||||
## Highlights of v6.1.2
|
||||
|
||||
- Fix: restore proper white LED price indicator behavior on ESP32 by avoiding mixing PWM (`analogWrite`) and `digitalWrite` on the same pin.
|
||||
- Fix: LED is now truly off when backlight/LED gating turns it off (no more “dim glow”).
|
||||
- Change: `updateLeds()` uses PWM only (`analogWrite(pin, 0/255)`) for off/on and blink toggles.
|
||||
|
||||
For full details, see:
|
||||
|
||||
- [CHANGELOG.md](./CHANGELOG.md)
|
||||
- [README.md](./README.md)
|
||||
|
||||
## Previous firmware
|
||||
|
||||
- **Version:** 6.1.1
|
||||
- **Release date:** 2026-03-07
|
||||
- **Target MCU:** Seeed XIAO ESP32‑C3
|
||||
@@ -14,12 +34,7 @@
|
||||
- Fix: daily **lowest/highest hourly price marker** now includes **negative** and **0.0** prices.
|
||||
- Fix: daily average is computed over the number of valid hours (instead of always dividing by 24 even when hours were skipped).
|
||||
|
||||
For full details, see:
|
||||
|
||||
- [CHANGELOG.md](./CHANGELOG.md)
|
||||
- [README.md](./README.md)
|
||||
|
||||
## Previous firmware
|
||||
## Earlier firmware
|
||||
|
||||
- **Version:** 6.0.0
|
||||
- **Release date:** 2026-01-27
|
||||
|
||||
Reference in New Issue
Block a user