I have been wanted an ambient display in my room for quite a while, but I don't want it to be just another LCD screen that I have to plug in at all times. Then I found this M5Paper thingy one day when I browsed a microcontroller store. So I bought it, played around with it, and this is like an experimental, yet usable project.
I'm not going to update this code / provide support because I'm moving to code using C so that I have more control over stuff.
I built this code so that I don't have to edit the on-device code much. The data collection and processing are done on the cloud. It just displayed whatever it received. Like in the image, it shows whatever it receives from the endpoint. I display information that I feel like I can read while I brew my coffee, or just take a walk to the kitchen, so the information here isn't really important or time-sensitive.
- Flash UiFlow into your M5Paper follow this instruction
- Edit some variables in main.py, then upload the file to the device (either via UiFlow or USB mode + Micropython)
- Implement an endpoint for the device to get data from (See next section)
The endpoint is resting on my cloud server. It is one of the microservices on my server so that everything isn't tightly coupled.
First, I have a data aggregation service that fetches data from various sources, at different intervals based on the API limitation. Then I format those data to my liking.
Second, I implement the endpoint for this device, it gets the aggregated data from my database, format it into an appropriate object (see example-endpoint-data.json
), and return the request when the device fetches.
Note that, you can see I send some device metrics to the endpoint too (Line 31), I logged these metrics on the cloud, but you can discard it.
shutdownDelay
is the delay from the device finished fetching to it being shutdown again (seconds)wakeupInterval
is the delay between fetching, during this period, the device sleep to conserve battery (seconds)textN
andfirstLine
have around 14 characters limit (except menu0, around 28)textLargeN
has around 6 characters limit (except menu0, around 13)actionName
has around 17 characters limit (except menu0, around 37)textLarge1
replacestext1
andtext2
, similarly withmenuN.textLarge2
replacestext3
andtext4
actionName
is the last line, I originally intended to allow interaction on-device, but I felt like this ambient display shouldn't have interaction on itself, the name remains
- https://www.gwendesign.ch/kb/m5stack/m5paper/#light-sleep-deep-sleep-and-shutdown-current
- Install this if M5Paper doesn't play well with Mac - M5Paper Serial Driver for MacOS Big Sur Xinyuan-LilyGO/LilyGo-T-Call-SIM800#139 (comment)
- M5Burner has several problem when setting, be sure to update it to the latest version in the app. In my case the site show 2.2.8 as latest but it has problem setting mode, I had to update in-app to 2.3.0. Do this via M5Burner setting (top-right cog icon, then update)