From 260cb31975911a75498e9ce85efd432832b4c25e Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sat, 27 Dec 2025 21:54:08 +0800 Subject: Etlas. --- _log/etlas.md | 66 ++++++++++++++++++++-------------------------- _site/feed.xml | 2 +- _site/log/etlas/index.html | 62 +++++++++++++++++++------------------------ _site/posts.xml | 2 +- 4 files changed, 57 insertions(+), 75 deletions(-) diff --git a/_log/etlas.md b/_log/etlas.md index c274401..cc45ea4 100644 --- a/_log/etlas.md +++ b/_log/etlas.md @@ -6,41 +6,34 @@ project: true thumbnail: thumb_sm.jpg --- -Etlas is a news, stock market, and weather tracker powered by an ESP32 NodeMCU -D1, featuring a 7.5-inch Waveshare e-paper display and a -DHT22 sensor module. +Repurposed [e-reader prototype](../e-reader/) into something for regular use. +News, stocks, weather dashboard. ESP32 NodeMCU D1 + 7.5" Waveshare e-paper + +DHT22 sensor. + + +
front back
front
-The top-left panel shows two weeks of end-of-day prices—the maximum the ESP32's -SRAM can hold—from the Polygon.io API. The price feed is relayed through a -FastCGI-wrapped Flask app hosted on a VPS. This lets me configure stock symbols -in its application settings. The app cycles through them as requests come in -from the ESP32. Running the Flask app as a FastCGI process while exposing it -via httpd with htpasswd authentication keeps the server code simple and secure. +Stocks: Two weeks EOD prices from Polygon.io (max SRAM holds). Flask app on VPS +relays feed, lets me swap symbols via config. FastCGI + httpd + htpasswd. -The following diagram outlines the Etlas's overall system architecture. +gui_plot_stocks() is CPU heavy and triggers the WDT. vTaskDelay() prevents +that. Stepped graph easier to code for the bit-packed framebuffer (especially +under current memory constraints), but its messy--too messy. -![architecture](etlas_arch.png) +Note to self: Refactor gui_plot_stocks(). Bresenham’s Line Algorithm perhaps? -The more prominent panel on the right of the display shows local and world news -from Channel NewsAsia. The MCU downloads and parses XML data from the RSS feed -directly before rendering it to the display. The character glyphs used are -stored as bitmaps in the sprites directory. I skipped the proxy for news to -avoid writing more server code, but in hindsight it limits the feeds Etlas can -handle. I will fix this in a future version. +News: Channel NewsAsia RSS. MCU parses XML directly. Character glyphs stored as +bitmaps in sprites directory. -The middle and bottom right panels display the temperature and relative -humidity from the DHT22 sensor. The DHT22 uses pulse-width modulation to -transmit data to the host. The 26µs, 50µs, and 70µs pulses are too fast for the -ESP32 to measure reliably with standard APIs. Instead, the driver compares -relative pulse widths to differentiate zeros from ones: +Weather: DHT22 via PWM. 26µs/50µs/70µs pulses too fast for standard ESP32 APIs. +Compare relative pulse widths: ``` static inline int dht_await_pin_state(int state, int timeout) @@ -51,12 +44,12 @@ static inline int dht_await_pin_state(int state, int timeout) for (t = 0; t < timeout; t += delta) { ets_delay_us(delta); if (gpio_get_level(DHT_PIN) == state) - return t; + return t; } return 0; } -static inline int dht_get_raw_data(unsigned char buf[DHT_DATA_LEN]) +static inline int dht_get_raw_data(unsigned char buf[BUFLEN]) { int rc; unsigned char i, pwl, pwh; @@ -81,7 +74,7 @@ static inline int dht_get_raw_data(unsigned char buf[DHT_DATA_LEN]) return 0; } - for (i = 0; i < DHT_DATA_LEN; i++) { + for (i = 0; i < BUFLEN; i++) { if (!(pwl = dht_await_pin_state(1, 50))) { rc = 4; xQueueSend(dht_evt_queue, &rc, (TickType_t) 0); @@ -98,18 +91,15 @@ static inline int dht_get_raw_data(unsigned char buf[DHT_DATA_LEN]) } ``` -I ported this implementation from ESP8266 -to ESP32—all credit for the algorithm belongs to them. +Ported from ESP8266. -Etlas is a networked embedded system. All acquisition, processing, and -rendering of data are performed on the ESP32's 160MHz microprocessor using less -than 512KB of SRAM. The embedded software that makes this possible is written -in C using ESP-IDF v5.2.1. The e-paper display driver is derived from Waveshare -examples for Arduino and STM32 -platforms. +After flashing new versions, display would stop responding. Didn't observe this +with e-reader. Issue occurs spontaneously. Couldn't find root cause. Making a +change like adding a comment or tweaking delay in refresh() (then changing +back) fixed it. Noisy electrical connections? -Etlas has been running reliably for over a year since August 2024. +Once running, it runs: August 2024 - December 2025. -Files: [source.tar.gz](source.tar.gz) +Commit: +[a92c86a](https://git.asciimx.com/etlas/commit/?id=a92c86ac1592c2137d3d1fec1668eacc2d0ca581) diff --git a/_site/feed.xml b/_site/feed.xml index 2840acb..4ac63b7 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1 +1 @@ -Jekyll2025-12-27T21:02:00+08:00/feed.xmlASCIIMX | LogW. D. Sadeep MadurangeMatrix Rain: 2025 refactor2025-12-21T00:00:00+08:002025-12-21T00:00:00+08:00/log/matrix-digital-rainW. D. Sadeep MadurangeFingerprint door lock (LP)2025-08-18T00:00:00+08:002025-08-18T00:00:00+08:00/log/fpm-door-lock-lpW. D. Sadeep MadurangeHigh-side MOSFET switching2025-06-22T00:00:00+08:002025-06-22T00:00:00+08:00/log/mosfet-switchesW. D. Sadeep MadurangeATmega328P at 3.3V and 5V2025-06-10T00:00:00+08:002025-06-10T00:00:00+08:00/log/arduino-unoW. D. Sadeep MadurangeFingerprint door lock (RF)2025-06-05T00:00:00+08:002025-06-05T00:00:00+08:00/log/fpm-door-lock-rfW. D. Sadeep MadurangeBumblebee: browser automation2025-04-02T00:00:00+08:002025-04-02T00:00:00+08:00/log/bumblebeeW. D. Sadeep MadurangeATSAM3X8E bare-metal programming2024-09-16T00:00:00+08:002024-09-16T00:00:00+08:00/log/arduino-dueW. D. Sadeep MadurangeEtlas: e-paper dashboard2024-09-05T00:00:00+08:002024-09-05T00:00:00+08:00/log/etlasW. D. Sadeep MadurangeESP32 e-reader prototype2023-10-24T00:00:00+08:002023-10-24T00:00:00+08:00/log/e-readerW. D. Sadeep MadurangeNeo4J A* search2018-03-06T00:00:00+08:002018-03-06T00:00:00+08:00/log/neo4j-a-star-searchW. D. Sadeep Madurange \ No newline at end of file +Jekyll2025-12-27T22:33:42+08:00/feed.xmlASCIIMX | LogW. D. Sadeep MadurangeMatrix Rain: 2025 refactor2025-12-21T00:00:00+08:002025-12-21T00:00:00+08:00/log/matrix-digital-rainW. D. Sadeep MadurangeFingerprint door lock (LP)2025-08-18T00:00:00+08:002025-08-18T00:00:00+08:00/log/fpm-door-lock-lpW. D. Sadeep MadurangeHigh-side MOSFET switching2025-06-22T00:00:00+08:002025-06-22T00:00:00+08:00/log/mosfet-switchesW. D. Sadeep MadurangeATmega328P at 3.3V and 5V2025-06-10T00:00:00+08:002025-06-10T00:00:00+08:00/log/arduino-unoW. D. Sadeep MadurangeFingerprint door lock (RF)2025-06-05T00:00:00+08:002025-06-05T00:00:00+08:00/log/fpm-door-lock-rfW. D. Sadeep MadurangeBumblebee: browser automation2025-04-02T00:00:00+08:002025-04-02T00:00:00+08:00/log/bumblebeeW. D. Sadeep MadurangeATSAM3X8E bare-metal programming2024-09-16T00:00:00+08:002024-09-16T00:00:00+08:00/log/arduino-dueW. D. Sadeep MadurangeEtlas: e-paper dashboard2024-09-05T00:00:00+08:002024-09-05T00:00:00+08:00/log/etlasW. D. Sadeep MadurangeESP32 e-reader prototype2023-10-24T00:00:00+08:002023-10-24T00:00:00+08:00/log/e-readerW. D. Sadeep MadurangeNeo4J A* search2018-03-06T00:00:00+08:002018-03-06T00:00:00+08:00/log/neo4j-a-star-searchW. D. Sadeep Madurange \ No newline at end of file diff --git a/_site/log/etlas/index.html b/_site/log/etlas/index.html index e4a4a9e..678321d 100644 --- a/_site/log/etlas/index.html +++ b/_site/log/etlas/index.html @@ -44,40 +44,34 @@

ETLAS: E-PAPER DASHBOARD

05 SEPTEMBER 2024

-

Etlas is a news, stock market, and weather tracker powered by an ESP32 NodeMCU -D1, featuring a 7.5-inch Waveshare e-paper display and a -DHT22 sensor module.

+

Repurposed e-reader prototype into something for regular use. +News, stocks, weather dashboard. ESP32 NodeMCU D1 + 7.5” Waveshare e-paper + +DHT22 sensor.

+ + +
front back
front
-

The top-left panel shows two weeks of end-of-day prices—the maximum the ESP32’s -SRAM can hold—from the Polygon.io API. The price feed is relayed through a -FastCGI-wrapped Flask app hosted on a VPS. This lets me configure stock symbols -in its application settings. The app cycles through them as requests come in -from the ESP32. Running the Flask app as a FastCGI process while exposing it -via httpd with htpasswd authentication keeps the server code simple and secure.

+

Stocks: Two weeks EOD prices from Polygon.io (max SRAM holds). Flask app on VPS +relays feed, lets me swap symbols via config. FastCGI + httpd + htpasswd.

-

The following diagram outlines the Etlas’s overall system architecture.

+

gui_plot_stocks() is CPU heavy and triggers the WDT. vTaskDelay() prevents +that. Stepped graph easier to code for the bit-packed framebuffer (especially +under current memory constraints), but its messy–too messy.

-

architecture

+

Note to self: Refactor gui_plot_stocks(). Bresenham’s Line Algorithm perhaps?

-

The more prominent panel on the right of the display shows local and world news -from Channel NewsAsia. The MCU downloads and parses XML data from the RSS feed -directly before rendering it to the display. The character glyphs used are -stored as bitmaps in the sprites directory. I skipped the proxy for news to -avoid writing more server code, but in hindsight it limits the feeds Etlas can -handle. I will fix this in a future version.

+

News: Channel NewsAsia RSS. MCU parses XML directly. Character glyphs stored as +bitmaps in sprites directory.

-

The middle and bottom right panels display the temperature and relative -humidity from the DHT22 sensor. The DHT22 uses pulse-width modulation to -transmit data to the host. The 26µs, 50µs, and 70µs pulses are too fast for the -ESP32 to measure reliably with standard APIs. Instead, the driver compares -relative pulse widths to differentiate zeros from ones:

+

Weather: DHT22 via PWM. 26µs/50µs/70µs pulses too fast for standard ESP32 APIs. +Compare relative pulse widths:

static inline int dht_await_pin_state(int state, int timeout)
 {
@@ -87,12 +81,12 @@ relative pulse widths to differentiate zeros from ones:

for (t = 0; t < timeout; t += delta) { ets_delay_us(delta); if (gpio_get_level(DHT_PIN) == state) - return t; + return t; } return 0; } -static inline int dht_get_raw_data(unsigned char buf[DHT_DATA_LEN]) +static inline int dht_get_raw_data(unsigned char buf[BUFLEN]) { int rc; unsigned char i, pwl, pwh; @@ -117,7 +111,7 @@ static inline int dht_get_raw_data(unsigned char buf[DHT_DATA_LEN]) return 0; } - for (i = 0; i < DHT_DATA_LEN; i++) { + for (i = 0; i < BUFLEN; i++) { if (!(pwl = dht_await_pin_state(1, 50))) { rc = 4; xQueueSend(dht_evt_queue, &rc, (TickType_t) 0); @@ -134,19 +128,17 @@ static inline int dht_get_raw_data(unsigned char buf[DHT_DATA_LEN]) }
-

I ported this implementation from ESP8266 -to ESP32—all credit for the algorithm belongs to them.

+

Ported from ESP8266.

-

Etlas is a networked embedded system. All acquisition, processing, and -rendering of data are performed on the ESP32’s 160MHz microprocessor using less -than 512KB of SRAM. The embedded software that makes this possible is written -in C using ESP-IDF v5.2.1. The e-paper display driver is derived from Waveshare -examples for Arduino and STM32 -platforms.

+

After flashing new versions, display would stop responding. Didn’t observe this +with e-reader. Issue occurs spontaneously. Couldn’t find root cause. Making a +change like adding a comment or tweaking delay in refresh() (then changing +back) fixed it. Noisy electrical connections?

-

Etlas has been running reliably for over a year since August 2024.

+

Once running, it runs: August 2024 - December 2025.

-

Files: source.tar.gz

+

Commit: +a92c86a

diff --git a/_site/posts.xml b/_site/posts.xml index 38aac29..b6480ed 100644 --- a/_site/posts.xml +++ b/_site/posts.xml @@ -1 +1 @@ -Jekyll2025-12-27T21:02:00+08:00/posts.xmlASCIIMXW. D. Sadeep Madurange \ No newline at end of file +Jekyll2025-12-27T22:33:42+08:00/posts.xmlASCIIMXW. D. Sadeep Madurange \ No newline at end of file -- cgit v1.2.3