Important
More features are hopefully coming soon!
This repository is not even close to being finished. I will try to include all the files and useful resources, but there are a lot, so it will take time.
This is an e-paper clock based on a WeAct Studio 2.9" BW display, and a custom Info Station V6 mainboard.
The clock can connect to a local network to get the time hen powered on. After this, and internal timer is calibrated to the current timezone. The display is refreshed every minute. Between the refreshes, the ESP32-C3 and the display enters deep sleep to preserve battery power.
At set hours, the clock will resync to a time server, and it will show the last resync. The clock can also monitor it's battery level. By pressing the update button, the display is kept awake to be able to remain connected to a computer, and receive and update easily. Pressing the top button enables seconds mode, witch shows the seconds for a set amount of time, or until the button is pressed again.
Settings can be configures easily in the settings.h file.
Descriptions and recommendations are written next to important options.
Note
I try to document the code as much as I can, but if you have any questions, feel free to contact me.
The current version used by the codebase is V6.
The PCB can be found in the mainboard folder. There are also gerber files, specifically exported for production with JLCPCB. If you just want to look at the schematic, you can use the pdf.
Note
The main branch is using the V6 motherboard. If you want to use a V2 motherboard, check out the dedicated branch.
- Install PlatformIO.
- Clone this repository to your local machine.
- Copy the
src/wifi_secret.h.outlinefile, and rename it tosrc/wifi_secret.h. - Enter your WiFi SSID (network name) and password,
replacing the placeholder values in
src/wifi_secret.h. - Change your port settings in the
platformio.inifile. You can also use auto port detection on windows but not on linux. - Select the correct environment for uploading:
- With
platformio.run --environment YourEnvironmenton command line. - By selecting the correct folder in VSCode.
- With
- I recommend using the default settings for the first upload.
After that, you can change the settings in the
settings.hfile by commenting or uncommenting definitions, or by changing values. A short explanation of options are included in the file.
Implement
- Add charging detection.
- Add stopper mode.
- Show wifi strength at last sync.
- Multiple WiFi connections. More Info
- Skip resync if the wifi times out.
- Better fonts, for example Roboto.
- Switch to using precise time.
Ideas
- Add hibernation for night? (Basically just a longer deep sleep at night.)
- Indicate potential drift based on time from last sync.
Test
- Check SNTP time documentation, if it only gets time once.
- Test the three different internal, and external oscillators. More Info
- Test power consumption with different configurations.
- Ways to connect to WiFi faster, like storing the channel number, or setting up a persistent wifi connection.
- GPIO4 can and will fuck with you!
Document
- Document the telemetry collection server.
- Document the font creation process.
- Document assembly and schematics.
- Document 3D printed parts.
After ordering multiple display panels from the same AliExpress listing, I received two different kinds of display modules. from the outside they look almost identical, apart from the part number on the display ribbon cable. The older ones are marked FPC-A005, while the newer ones are marked FPC-7519rev.b. The displays have the same documentation provided by WeAct Studio.
As they are both copies of similar displays, we have to take these numbers with a grain of salt. The old one seems to be a copy (and simplification) of a 3 color display, while the new one seems to be a copy (and again, simplification) of this Waveshare panel. While the old display lacks the third color, the new one is missing the gray levels. (Or at least, I could not get it to work...)
After powering the on, the difference is obvious: the refresh times. While the old display takes around 4s to do a full refresh, the new one only takes around 2s, and does not blink as much, making it a lot less distracting. The new display does seem to loose quality faster when doing partial refreshes. For these reasons, I prefer partial refreshes on the old, and full refreshes on the new display.
The new display also goes to hibernation, while the old one seems to consume around 1mA. I am still testing this aspect.
Despite these differences, the communication and setup for the displays are the same, they are a drop-in replacement for each other.
As WeAct Studio does not provide any information regarding display health, I will be referencing Waveshare's display health information for a very similar display.
It suggest full refreshing every "several" partial refreshes. As several is not too exact, I would go with 5-10 partial refreshes for a full refresh However, after running one of the older displays for around 2 months with only fast refreshes, I do not see any mayor degradation.
It also recommends a refresh interval of "at least 180s". That will not happen for a clock of course, but again I do not see any particular reason this should affect the display in any negative way.
They also suggest powering down the display, or putting it in deep sleep. This of course is done as soon as possible, and is an understandable requirement.
As the default SPI pins on the ESP32-C3 Supermini are located in locations unsuitable for this project, as they use important pins in the RTC pin domain. These are the pins that can be used for wakeup from deep sleep, and the pins that can be held during deep sleep. As these pins are needed for other applications, we need to remap the SPI pins to less important ones.
The port remapping is done by modifying the default pins_arduino.h
configuration file. Thankfully this can be done on a per-project basis.
The location of the configuration file is changed to the local one with
the board_build.variants_dir = variants option.
To view the new pin configuration, check out the file:
pins_arduino.h.
Modes are stored in a uint8_t, and have constants with their names
and a *_MODE suffix.
| Mode Name: | NULL | RESET | NORMAL | RESYNC | SECONDS | STOPPER | UPDATE | CRITICAL |
|---|---|---|---|---|---|---|---|---|
| Decimal Value: | 0 | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
| Bit shifted Value: | 0 | 1 << 0 | 1 << 1 | 1 << 2 | 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6 |
The project is currently uses the external oscillator over the default RC oscillator, or the internal 8MD256 oscillator. This is presumably the middle gorund considering both accuracy and power consumption. The compromises are not yet fully clear to me, further testing and investigation is required.
- Purchase display: AliExpress.
- Library used for the display: GxEPD2
- Sleep modes on the ESP32-C3: Espressif Documentation.
- GPIO documentation: Espressif Documentation.
- Showcasing the display and library: Video. And the code they used: GitHub.
- Generating new fonts: Adafruit Documentation. (tl;dr: You pretty much must do this on linux.)
- How to remap global SPI ports: Arduino Forum Thread. (I looked 3 hours for this.)
- Advanced deep sleep wakeup functionality: Espressif Documentation.
- Deep sleep wakeup with gpio: StackOverflow.
- Holding pins in deep sleep: Reddit.
- ADC accuracy: Link Tree.
- Built in adc calibration: Reddit.
- Estimating battery percentage from voltage: Desmos, Reference Data.
- Rebooting with persistent RTC memory: Reddit.
- ESP-C3 supermini pinout: Arduino Forum Thread.
- Sub sleep levels: Espressif Documentation.
- Optimization: Espressif Documentation
- Display driver: Data Sheet
- Online XBM editor: Webpage
The display could be reasonably used with Esphome. The configuration however is quite difficult, and the power efficiency will definitely be worse. I do not think I will be attempting to port it. I already have code for a similar project.
The mainboard is borrowed from Weather Station V1. The only hardware difference is the display, as that project uses the 3 color version. The software however is completely different, as that project uses Esphome.
After designing the new mainboard, I will be publishing more information and configuration regarding that project, in a separate repo.