PaperColor Stock Ticker for ESP32-S3
An ESP32 camera project for ESP32-S3 involving E-paper display.
Parts and sourceBefore you start
Check the exact E-paper display configuration against the upstream wiring or parts list.
Upstream README
PaperColor Stock Ticker
A battery-powered color e-ink stock ticker for the M5Stack PaperColor. Pre-market, regular hours and after-hours US quotes on a 6-color Spectra 6 e-paper panel — no cloud account, no API key, no soldering.
中文说明 · Quick start · How it works · FAQ
What it is
The M5Stack PaperColor is a 4-inch Spectra 6 color e-paper display with an ESP32-S3 behind it. This firmware turns it into a glanceable stock dashboard: it wakes on a timer, pulls quotes, repaints the screen once, and goes back to deep sleep. The image stays on the panel while the device is asleep, so it reads like a printed page sitting on your desk.
It is deliberately not a real-time ticker. Color e-ink takes 15–30 seconds for a full refresh and has no partial-update mode, so the design leans into that: a newspaper front page that updates a few times an hour, not a chart that flickers every second.
Setup is done entirely from your phone. On first boot the screen shows a Wi-Fi QR code — scan it with your camera, and a settings page opens where you pick your networks and your tickers. You never type anything on the device itself.
Two things to know before you start. The on-screen labels and the phone settings page are in Chinese — symbols, prices and percentages are universal, the words around them are not. And every clock time the device prints (the date in the masthead, "data as of", "next refresh") is Beijing time, because that is where it was built. Both are just strings in ui.cpp and portal.cpp; a translation PR would be welcome.
Features
| 📈 Extended hours | Pre-market, regular session, after-hours and overnight are tracked separately. Pre/post quotes are shown when they exist, with the session labeled on screen. |
| 📱 QR-code Wi-Fi setup | First boot opens a captive portal and paints a Wi-Fi QR code. Scan, connect, configure. No credentials in source code, no recompiling. |
| 🔑 No API key | Quotes come from Sina Finance's free public endpoint. Nothing to sign up for, no rate-limit dashboard, no token to rotate. |
| 🔋 Measures its own battery life | Deep sleep between refreshes, radio off, panel power rail cut. Rather than quote a number that would not match your usage, the device tracks its own drain and prints the estimated days remaining in the footer. |
| 🔌 One wake, one repaint | A wake — connect, fetch, repaint — takes about 40–60 seconds, and the panel is driven exactly once in it. Every network step has a hard timeout, so a bad Wi-Fi can't hold the radio open. |
| 🎨 Six-color native | Every pixel uses one of the panel's six exact colors (black, white, red, yellow, green, blue), so nothing gets dithered or snapped to a near-match. |
| 🇨🇳 Red-up or green-up | Toggle between the Chinese convention (red = up) and the Western one (green = up) from the settings page. |
| ⭐ Up to 10 tickers | Five per page, page through with a button. The day's biggest mover gets a yellow row — but only if it actually moved 3% or more. |
| 📶 Multi-network | Store up to four networks. On each wake the device scans and joins the highest-priority one it can actually see — phone hotspot at your desk, home Wi-Fi otherwise. |
| 🛰 Honest offline state | If a fetch fails you get the last good data plus a yellow "offline" chip, never a stale screen pretending to be live. |
Hardware
Just the board — nothing else to buy, nothing to solder.
M5Stack PaperColor, plus a USB-C cable for the initial flash.
| At a glance | |
|---|---|
| Panel | 4" Spectra 6 color e-paper, 400×600 |
| Colors | black, white, red, yellow, green, blue — used exactly, never dithered |
| Refresh | full panel only, 15–30 s, no partial update |
| MCU | ESP32-S3, 16 MB flash, 8 MB PSRAM |
| Radio | 2.4 GHz Wi-Fi only — there is no 5 GHz radio |
| Battery | 1250 mAh built in, USB-C charging |
Quick start (3 steps)
1. Flash the firmware
Download papercolor-ticker-merged.bin from the latest release, plug the board into your computer with USB-C, and run:
uvx esptool --chip esp32s3 write_flash 0x0 papercolor-ticker-merged.bin
That single file contains the bootloader, the partition table and the firmware, which is why it goes to 0x0. When the write finishes, esptool resets the board for you.
No uv? pip install esptool, then use esptool.py in place of uvx esptool. If the board isn't found automatically, add --port — /dev/cu.usbmodem* on macOS, /dev/ttyACM0 on Linux, COM5-ish on Windows. Prefer building from source? See Build it yourself.
2. Scan the QR code on the screen
The board reboots into setup on its own: it opens an open hotspot called PaperColor-XXXXXX (the last three bytes of its MAC) and paints the matching Wi-Fi QR code in the middle of the screen.
Point your phone camera at it. Your phone joins that hotspot, and the settings page opens by itself.
If it doesn't pop up: Android usually shows a "sign in to this network" notification — tap it. Otherwise open 192.168.4.1 in any browser while connected to the device hotspot. You can also join PaperColor-XXXXXX by hand from your Wi-Fi settings; the name is printed under the QR code.
3. Add your Wi-Fi and your tickers
On that page:
- Tickers — tap the preset chips (GOOG, AMZN, META, AVGO, NFLX, INTC, QCOM, BABA, PDD, MSTR) or type any symbol into the box and tap 添加 (add). Up to 10, and at least one is required. ✕ removes one.
- Network — type your Wi-Fi name and password. Leave the password empty for an open network. There is no scan list; the name has to be typed exactly, capitals included.
- Colors — 红涨绿跌 is red-up/green-down, 绿涨红跌 is green-up/red-down.
- Tap 保存并重启 (save and restart).
[!IMPORTANT] The ESP32-S3 has no 5 GHz radio — it can only join a 2.4 GHz network. On iPhone, turn on Settings → Personal Hotspot → Maximize Compatibility first. On Android, pin the hotspot to 2.4 GHz and turn off "switch off hotspot automatically".
The device restarts, joins your network, fetches quotes and repaints. Your dashboard is on screen 40–60 seconds later. You can close the settings page as soon as it says saved.
That's it. From now on it refreshes on its own.
Walked away mid-setup? Setup mode exits after 5 minutes with no activity, and the screen then tells you to press C to bring the QR code back. Nothing is lost — the device just sleeps instead of holding its radio on.
Daily use
Three programmable buttons (on the side of the board, one above the other). All three wake the device from deep sleep, and the dashboard footer prints what they do.
| Button | GPIO | What it does |
|---|---|---|
| A | 10 | Next page of tickers. Reads from cache — no radio, so the new page is up in about 20 seconds instead of a minute. |
| B | 9 | Refresh right now. This is the one to press after you switch your phone hotspot on. |
| C | 1 | Open settings. Paints the QR code again so you can change tickers or networks. |
Not sure which button is which? Press one and watch: C is unmistakable, it paints the blue setup screen with the QR code, and pressing C again leaves it.
Once the device is on your own Wi-Fi, the setup screen also prints a http://192.168.x.x address. Any phone or laptop on the same network can open that directly — no need to switch Wi-Fi networks just to add a ticker.
The dashboard footer always shows the battery level, which network the last refresh used, the page indicator, and the time of the next scheduled refresh.
When the screen says something else
The dashboard is not the only thing the device draws. These four screens each mean something specific, and each retries on its own — you never have to power-cycle it.
| On screen | What happened | What to do |
|---|---|---|
| 还没配网 "not set up yet" |
First boot, and you left setup without saving. | Press C for the QR code. It sleeps up to 6 hours between reminders; any button wakes it. |
| 等待网络 "waiting for network" |
None of the saved networks was visible, or the password was rejected. The name on screen is always your first saved network, not necessarily the one that failed. | Turn your hotspot on and press B. Press C to fix the credentials. It retries by itself every 10 minutes. |
| 行情源不可达 "quote source unreachable" |
Wi-Fi is fine, the quote request failed. Usually the endpoint or your DNS, not you. | Press B to retry now, or wait — it retries every 10 minutes. |
| 时钟未同步 "clock not synced" |
NTP didn't answer, so the device can't tell which trading session it's in. | Press B. It retries every 15 minutes. See why it refuses to draw. |
How it works
Refresh schedule
The device only wakes when there could be something new, and always wakes a minute after a session boundary so the label on screen stays correct.
| Session | US Eastern | Refreshes every |
|---|---|---|
| Pre-market | 04:00 – 09:30 | 30 min |
| Regular | 09:30 – 16:00 | 15 min |
| After hours | 16:00 – 20:00 | 30 min |
| Overnight / closed | everything else | sleeps toward the next pre-market open, in stretches of at most 6 hours |
Two honest caveats. Deep sleep is capped at 6 hours per stretch so the clock can't drift too far, which means even a quiet weekend costs a handful of wakes and repaints. And the calendar knows about weekends but not about market holidays — on Thanksgiving the device will happily wake on the pre-market schedule and repaint the same unchanged numbers.
Daylight saving is handled by the standard EST5EDT rules, so the schedule follows the market rather than a fixed UTC offset. The clock is set over NTP on first boot and re-synced every 24 hours, because the ESP32's sleep clock drifts. A wrong clock means a wrong date and a wrong session label, so the firmware would rather say "clock not synced" than draw a dashboard it can't honestly timestamp.
What's on the screen
- Masthead — the paper's name and today's date
- Status line — a blue chip for the current session, a yellow "offline" chip when the data is stale, the current time and the timestamp of the data (both Beijing time)
- Index — Nasdaq Composite by default: level, percentage change with an up/down triangle, and the point change underneath
- Ticker rows — symbol, Chinese name, last price, percentage change with a triangle. Five per page
- Yellow row — the day's biggest mover, marked 异动, and only when it moved at least 3%
- Footer — battery, network, page indicator, next refresh time, button legend
Battery life
The device measures its own. Nobody can tell you a number that means anything for your usage — it depends on how much of your day is market hours, how many tickers you page through, and how often you hit B. So instead of quoting a figure, the firmware works it out from your actual device.
It keeps a reference point in RTC memory — a battery percentage and the moment it was read — and compares every later wake against it. Once the battery has dropped at least 3% and at least 12 hours have passed, the footer starts showing an estimate next to the battery icon:
▮ 87% 约31天 home-wifi 1/2 页 · 下次刷新 16:01
└── measured days remaining
The estimate only appears once there is enough signal to be worth printing; below that threshold the quantization noise in a voltage-derived battery gauge would swing it between "5 days" and "400 days" between refreshes. It gets steadier the longer the device runs, and it resets itself whenever you charge (plugged into USB, or the reading jumps back up), because charging measures the wrong thing.
The same numbers go to the serial log every refresh, if you would rather graph it:
[batt] 87% anchor=100@1755600000 days=31
What the firmware does to earn a long number: deep sleep between refreshes with the radio off and the EPD/SD power rail switched off; a hard timeout on every network step so a bad Wi-Fi can never hold the radio open; page-turns served from cache without waking the radio at all; and exactly one panel repaint per wake.
Under the hood
- Deep sleep between refreshes. Wi-Fi off, display asleep, and the EPD/SD power rail switched off to kill its leakage current. Every step of a wake is capped (10s to join Wi-Fi, 8s for NTP, 13s for HTTP) so a bad network can never keep the radio on.
- RTC-memory fast reconnect. The last successful access point's channel and BSSID survive deep sleep, so a normal wake skips the full-channel scan entirely.
- Per-ticker cache merge. A partial response only updates the symbols that came back — one flaky quote never wipes out good data.
- One paint per wake. The whole frame is drawn inside a single
startWrite()/endWrite()pair, so the panel does exactly one full refresh instead of one per drawing call. - Settings in NVS. Tickers, networks and color preference live in flash, not in the source. Saving bumps a generation counter that invalidates the cached quotes.
Configuration
Everything you'd normally change is on the phone settings page (button C):
- Tickers — tap a preset or type any US symbol, 1–10 letters (dots are fine, so
BRK.Bworks). Up to 10. Common names get a Chinese label on screen automatically; anything else just shows the symbol. - Networks — up to 4 saved, tried in the order they're listed. Adding a network that's already saved updates its password instead of adding a duplicate. Save fails with an explicit message if you're already at 4.
- Colors — red-up/green-down, or green-up/red-down.
To change the defaults a freshly-flashed device starts with, edit firmware/src/config.h: the default ticker list, the index it tracks, the refresh intervals and the NTP servers all live there.
Baking in Wi-Fi credentials is optional and only worth it if you're flashing a batch of devices for other people. Copy firmware/src/secrets.h.example to secrets.h and fill it in; it's gitignored, and the build works fine without it. Networks added this way show up on the settings page as firmware built-ins and can't be deleted there — though saving a network with the same name will override the password.
Build it yourself
Needs PlatformIO.
git clone https://github.com/lhfer/m5stack-papercolor-stock-ticker.git
cd m5stack-papercolor-stock-ticker/firmware
pio run --target upload
The panel driver only exists on the git trunk of M5Unified and M5GFX, so platformio.ini pins both to specific commits rather than registry releases. If the upload port isn't detected, uncomment the upload_port line for your OS at the top of that file.
Watch the logs with pio device monitor. The USB serial port disappears while the device is in deep sleep — that's normal, not a crash.
The parser and the market-clock logic have no Arduino dependencies and are unit-tested on the host:
cd firmware/test/host && mkdir -p build && \
c++ -std=c++17 -I../../src test_core.cpp ../../src/quotes_parser.cpp ../../src/market_time.cpp -o build/test_core && \
./build/test_core
Project layout
firmware/
src/
main.cpp wake → connect → fetch → paint → sleep
portal.cpp phone settings page + captive portal + QR
wifi_mgr.cpp scan-then-join with an RTC fast path
quotes.cpp HTTP fetch
quotes_parser.cpp Sina response parsing (host-testable)
market_time.cpp US session clock incl. DST (host-testable)
ui.cpp the 400×600 six-color layout
settings.cpp NVS-backed runtime config
config.h compile-time defaults
test/host/ host unit tests + captured fixtures
design/ original design canvas artboards (archive)
FAQ
Why do I have to type my Wi-Fi name by hand?
Because the settings page deliberately has no scan list. While you're configuring, your phone is connected to the device's hotspot — and a phone that is serving a hotspot to something else usually isn't broadcasting the network you actually want to join, so a scan list would be missing the one entry you came for. Typing it once is more reliable than scanning and finding nothing.
Type it exactly as it appears under Settings → Personal Hotspot, capitals included. On iPhone 12 and newer, turn on Maximize Compatibility — the ESP32-S3 is 2.4 GHz only and can't see a 5 GHz hotspot.
It stops updating when I'm out with my phone hotspot.
iPhone hotspots go to sleep after roughly 90 seconds with no clients, and a non-Apple device can't wake them. The reliable move is: open the Personal Hotspot settings page (which keeps it awake), then press B.
On Android, disable the "turn hotspot off automatically" timer and pin it to 2.4 GHz, and it will keep refreshing on its own.
If the device wakes and can't see any known network, it scans for about two seconds, draws the "waiting for network" screen and goes back to sleep for 10 minutes. A missing hotspot costs very little battery.
Why does the refresh take so long?
Color e-paper has no partial-update mode. Every change is a full 15–30 second repaint of the whole panel, and it visibly cycles through colors while it works. That's the panel, not the firmware.
Can I track non-US stocks?
The current code requests the gb_ (US) namespace from Sina. A-shares and Hong Kong tickers use different prefixes and a slightly different field layout — supported by the same endpoint, but the parser would need extending. PRs welcome.
Can I have the screen in English?
Not today. All the on-screen strings are Chinese literals in ui.cpp, the settings page is Chinese in portal.cpp, and the timestamps are hardcoded to Beijing time in ui.cpp. Nothing in the layout depends on that — it's a swap of string constants and one time offset, and a PR that does it properly is very welcome.
How long does the battery last?
There is no published number, on purpose — it depends entirely on how much of your day is market hours and how often you press B, since a full repaint is by far the most expensive thing the device does. Nights and weekends are cheap but not free: the device still wakes at least every 6 hours to keep its clock honest, and each of those wakes is another full repaint.
So the device measures itself and prints the answer in the footer. See Battery life for how it works and when the estimate appears.
Design archive
design/ holds the original artboards as they came out of the design canvas: the three layout directions that were explored (newspaper front page, big-type board, color cards) plus the device setup screen and the phone settings page. Direction A — the newspaper front page — is what shipped. They're kept as a record of the reasoning, not as a buildable asset.
Disclaimer
Quotes come from an undocumented public Sina Finance endpoint. It's free and it has no key, but it isn't a supported API — it can change or disappear without notice. This project is a hobby display for glancing at numbers. It is not investment advice, and you should not trade on it.
Contributing
Issues and pull requests are welcome — especially other quote sources, other markets, English strings, and alternative layouts for the six-color panel. CONTRIBUTING.md has the build and test commands, plus what to include in a bug report.
Acknowledgements
Built on M5Unified and M5GFX by M5Stack and lovyan03.