diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-12-27 21:54:08 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-12-27 22:35:42 +0800 |
| commit | 260cb31975911a75498e9ce85efd432832b4c25e (patch) | |
| tree | beb18229fc21074619ccdea54650fe2630e947fb /_site/log/etlas | |
| parent | 3e6ecf82e6f95490ac6b6d73833cc2ab17ef49a2 (diff) | |
| download | www-260cb31975911a75498e9ce85efd432832b4c25e.tar.gz | |
Etlas.
Diffstat (limited to '_site/log/etlas')
| -rw-r--r-- | _site/log/etlas/index.html | 62 |
1 files changed, 27 insertions, 35 deletions
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 @@ <h2 class="center" id="title">ETLAS: E-PAPER DASHBOARD</h2> <h6 class="center">05 SEPTEMBER 2024</h5> <br> - <div class="twocol justify"><p>Etlas is a news, stock market, and weather tracker powered by an ESP32 NodeMCU -D1, featuring a 7.5-inch <a href="https://www.waveshare.com/" class="external" target="_blank" rel="noopener noreferrer">Waveshare</a> e-paper display and a -DHT22 sensor module.</p> + <div class="twocol justify"><p>Repurposed <a href="../e-reader/">e-reader prototype</a> into something for regular use. +News, stocks, weather dashboard. ESP32 NodeMCU D1 + 7.5” Waveshare e-paper + +DHT22 sensor.</p> <table style="border: none;"> <tr style="border: none;"> <td style="border: none;"><img src="dash.jpg" alt="front" style="width: 100%" /></td> <td style="border: none;"><img src="pcb.jpg" alt="back" style="width: 100%" /></td> </tr> + <tr style="border: none;"> + <td colspan="2" style="border: none;"><img src="etlas_arch.png" alt="front" style="width: 100%" /></td> + </tr> </table> -<p>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.</p> +<p>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.</p> -<p>The following diagram outlines the Etlas’s overall system architecture.</p> +<p>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.</p> -<p><img src="etlas_arch.png" alt="architecture" /></p> +<p>Note to self: Refactor gui_plot_stocks(). Bresenham’s Line Algorithm perhaps?</p> -<p>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.</p> +<p>News: Channel NewsAsia RSS. MCU parses XML directly. Character glyphs stored as +bitmaps in sprites directory.</p> -<p>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:</p> +<p>Weather: DHT22 via PWM. 26µs/50µs/70µs pulses too fast for standard ESP32 APIs. +Compare relative pulse widths:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>static inline int dht_await_pin_state(int state, int timeout) { @@ -87,12 +81,12 @@ relative pulse widths to differentiate zeros from ones:</p> 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]) } </code></pre></div></div> -<p>I ported <a href="https://github.com/Fonger/ESP8266-RTOS-DHT" class="external" target="_blank" rel="noopener noreferrer">this</a> implementation from ESP8266 -to ESP32—all credit for the algorithm belongs to them.</p> +<p>Ported from <a href="https://github.com/Fonger/ESP8266-RTOS-DHT" class="external" target="_blank" rel="noopener noreferrer">ESP8266</a>.</p> -<p>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 -<a href="https://github.com/waveshareteam/e-Paper" class="external" target="_blank" rel="noopener noreferrer">examples</a> for Arduino and STM32 -platforms.</p> +<p>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?</p> -<p>Etlas has been running reliably for over a year since August 2024.</p> +<p>Once running, it runs: August 2024 - December 2025.</p> -<p>Files: <a href="source.tar.gz">source.tar.gz</a></p> +<p>Commit: +<a href="https://git.asciimx.com/etlas/commit/?id=a92c86ac1592c2137d3d1fec1668eacc2d0ca581">a92c86a</a></p> </div> <p class="post-author right">by W. D. Sadeep Madurange</p> </div> |
