summaryrefslogtreecommitdiffstats
path: root/_site/poc/etlas/index.html
diff options
context:
space:
mode:
Diffstat (limited to '_site/poc/etlas/index.html')
-rw-r--r--_site/poc/etlas/index.html166
1 files changed, 166 insertions, 0 deletions
diff --git a/_site/poc/etlas/index.html b/_site/poc/etlas/index.html
new file mode 100644
index 0000000..d2b60bd
--- /dev/null
+++ b/_site/poc/etlas/index.html
@@ -0,0 +1,166 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Etlas: e-paper dashboard</title>
+
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Etlas: e-paper dashboard</title>
+ <link rel="stylesheet" href="/assets/css/main.css">
+ <link rel="stylesheet" href="/assets/css/skeleton.css">
+</head>
+
+
+
+ </head>
+ <body>
+
+ <div id="nav-container" class="container">
+ <ul id="navlist" class="left">
+
+ <li >
+ <a href="/" class="link-decor-none">hme</a>
+ </li>
+ <li >
+ <a href="/log/" class="link-decor-none">log</a>
+ </li>
+ <li class="active">
+ <a href="/poc/" class="link-decor-none">poc</a>
+ </li>
+ <li >
+ <a href="/about/" class="link-decor-none">abt</a>
+ </li>
+ <li><a href="/feed.xml" class="link-decor-none">rss</a></li>
+ </ul>
+</div>
+
+
+
+ <main>
+ <div class="container">
+ <div class="container-2">
+ <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>
+
+<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>
+</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>The following diagram outlines the Etlas’s overall system architecture.</p>
+
+<p><img src="etlas_arch.png" alt="architecture" /></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>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>
+
+<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>static inline int dht_await_pin_state(int state, int timeout)
+{
+ int t;
+ static const uint16_t delta = 1;
+
+ for (t = 0; t &lt; timeout; t += delta) {
+ ets_delay_us(delta);
+ if (gpio_get_level(DHT_PIN) == state)
+ return t;
+ }
+ return 0;
+}
+
+static inline int dht_get_raw_data(unsigned char buf[DHT_DATA_LEN])
+{
+ int rc;
+ unsigned char i, pwl, pwh;
+
+ gpio_set_level(DHT_PIN, 0);
+ ets_delay_us(1100);
+ gpio_set_level(DHT_PIN, 1);
+
+ if (!dht_await_pin_state(0, 40)) {
+ rc = 1;
+ xQueueSend(dht_evt_queue, &amp;rc, (TickType_t) 0);
+ return 0;
+ }
+ if (!dht_await_pin_state(1, 80)) {
+ rc = 2;
+ xQueueSend(dht_evt_queue, &amp;rc, (TickType_t) 0);
+ return 0;
+ }
+ if (!dht_await_pin_state(0, 80)) {
+ rc = 3;
+ xQueueSend(dht_evt_queue, &amp;rc, (TickType_t) 0);
+ return 0;
+ }
+
+ for (i = 0; i &lt; DHT_DATA_LEN; i++) {
+ if (!(pwl = dht_await_pin_state(1, 50))) {
+ rc = 4;
+ xQueueSend(dht_evt_queue, &amp;rc, (TickType_t) 0);
+ return 0;
+ }
+ if (!(pwh = dht_await_pin_state(0, 70))) {
+ rc = 5;
+ xQueueSend(dht_evt_queue, &amp;rc, (TickType_t) 0);
+ return 0;
+ }
+ buf[i] = pwh &gt; pwl;
+ }
+ return 1;
+}
+</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>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>Etlas has been running reliably for over a year since August 2024.</p>
+
+<p>Files: <a href="source.tar.gz">source.tar.gz</a></p>
+</div>
+ <p class="post-author right">by W. D. Sadeep Madurange</p>
+ </div>
+ </div>
+ </main>
+
+ <div class="footer">
+ <div class="container">
+ <div class="twelve columns right container-2">
+ <p id="footer-text">&copy; ASCIIMX - 2025</p>
+ </div>
+ </div>
+</div>
+
+
+ </body>
+</html>