E-Ink-ternal Countdown Display

by mars91 in Circuits > Microcontrollers

568 Views, 8 Favorites, 0 Comments

E-Ink-ternal Countdown Display

IMG_9954.jpg
IMG_9941.jpg
IMG_9949.jpg

This is a countdown screen that should last for years - whether for a graduation, birthday, the Unixpocalypse (when computers stop being able to display Unix time on January 19, 2038), or any other big date.

This circuit uses eInk technology and is basically always off, only waking up once a day when triggered by a real-time clock. eInk projects seem to be popping up everywhere lately, so I’m throwing my hat into the ring too.

My goal was to make a portable display that updates daily, runs on battery, uses as little power as possible, and keeps running for years.

Supplies

Screen Shot 2025-10-24 at 3.01.47 AM.png
Screen Shot 2025-10-24 at 3.19.04 AM.png
Screen Shot 2025-10-24 at 3.15.43 PM.png

These supplies support a real time clock (the DS3231SN) turning on a MCU (ATSAMD21E18A) to update a screen, whenever you want.

  1. 1x ATSAMD21E18A-A
  2. 1x DS3231SN
  3. 2x IRLML6402 (p-channel mosfet)
  4. 1x MMBT2222A (n-channel transistor)
  5. 1x MBR120 (Schottky diode)
  6. 1x CR123A Battery Holder
  7. 1x AP2112K-3.3 (LDO)
  8. 1x Adafruit 2.9" Red/Black/White eInk
  9. 1x usb-type b
  10. 3x 1uF capacitors (size 0603)
  11. 3x 10uF capacitors (size 0603)
  12. 1x 0 Ω resistor (size 0805, more on this part later)
  13. 2x 100k Ω resistors (size 0603)
  14. 3x 10k Ω resistors (size 0603)
  15. 5.1k Ω resistors (size 0603)
  16. 1k Ω resistor (size 0603)
  17. 1x LED (size 0603)


Below, you may notice a large blank spot on mine. That was originally intended for a

  1. 22uF polymer capacitor (size 7343, more on this part later and you may need it)


I’m also not including (tho still available on the PCB) a button that lets you press and hold to light up an LED. My original idea was to light up the eInk screen at night since it doesn’t have a backlight. When the PCB arrived, I tested a few layouts but ultimately didn’t like how it looked.

The blank spots for this LED feature use this button, current limiting resistor (0603), and this special adafruit LED.

Real Time Clock (RTC), DS3231SN

jason-d--XvhrIC1Mhc-unsplash.jpg

The DS3231SN’s heart is a crystal oscillator that uses very little power to tick (osciallte) back and forth. The chip keeps track of those perfectly timed ticks and always knows how many seconds have passed. With a little bit of code, those ticks can be turned into minutes, hours, days, months, and years.


It can also be programmed to trigger on an alarm tick - say tick number 2 trillion, five hundred and six :) — When that moment arrives, it simply pulls a pin down to ground, essentially mimicking a button being pressed very quickly.


When the MCU (microcontroller) is turned on, it can write a new alarm into the DS3231SN using I²C communication and resetting the alarm.


If you think this chip is awesome — it’s because it is! But the awesomeness comes at a price… this chip is usually a few dollars and there are many knock offs.


P-channel Soft Latch

axel-richter-2jXSnvMRwbc-unsplash.jpg
IMG_9952.jpg

(I pretty much made a PCB version of the circuit from this amazing video, watch this video)


Using a few cheap parts, this essentially pokes our robot to wake up and then tells it, "Keep yourself awake until the job is done."


P-channel MOSFET

The P-channel MOSFET (IRLML6402) acts as the main power gate — it lets current flow when its gate is pulled low (in this case, using the real-time clock). Once the MCU powers up, it now keeps the gate held low with a GPIO pin, "latching on" so the circuit stays on.


NPN transistor

The NPN transistor works as a protector and efficient middle man between the MCU and the MOSFET’s gate. It prevents the MCU pin from handling high gate current or higher voltages, and helps the MCU cleanly pull the MOSFET gate high to turn the system off.


100 kΩ resistors

The 100 kΩ resistors act as weak pull-ups, making sure the MOSFET’s gate defaults to a known high voltage when nothing else is driving it. That ensures the system stays off until activated and helps define true voltage levels during operation.


That big “empty” capacitor pads and why it you might need it…


When I first breadboarded the design, I was using a different, more powerful MCU with a bigger bootloader. It took about a second or two to start up. By the time it finished booting up, the MOSFET had already cut the power... It did not have enough time to latch and could not keep itself on.

The capacitor is a clever analog solution. It stored enough energy to keep the MCU powered for a moment - basically a little charge reservoir that kept the circuit alive just long enough for the MCU to fully wake up and latch itself on. So I ordered the PCB.

Thankfully, before the PCB arrived, I tested the design on a ATSAMD21E18A and discovered that this MCU powers up instantly. No reservoir cap needed at all :|


In fact, when I tested this on other fast-starting MCUs, I found that the capacitor could actually retrigger the MOSFET, keeping the circuit stuck in a zombie loop - constantly turning off, back on, and off again as the capacitor recharges.


So,

use the capacitor only if your MCU needs a few seconds to start up - it’s a trial-and-error thing. Always test the full setup before soldering your final board. It's not needed for this project and potentially could stop it from working.


Estimating the capacitor

~formula for estimating the capacitor needed for extra booting up time.

t = R × C × ln(Vinitial / Vfinal)

Where t is the time you want the voltage to stay high (in seconds). If the pull-up resistor is 100kΩ and you want to hold power for about 1 second, and your voltage drops from 3V down to 2V before it shuts off:

C ≈ 1 / (100,000 × ln(3 / 2)), C ≈ 18 microfarads (µF). So, using a capacitor around 10–22 µF will usually give you about a one extra second of hold time at 3V with a 100kΩ resistor.

EInk Display

1028-08.jpg
IMG_9959.jpg
Screen Shot 2025-10-24 at 3.21.34 AM.png

eInks are great displays for power saving. I went with a trusted brand, Adafruit, and used their 2.9-inch tri color display. It really only uses current to update the display. The eInk screen then locks the pixels in place showing the image even after cutting power to the display.


Adafruit's great documents for this display (they also talk about other similar screens in this doc).

There are many pins, but we dont need all of them. The PCB routes them correctly. You can use the PCB schematic to see what pins are connected where. The display uses SPI communication.


I ordered two screens, and they’re a bit expensive — around $30 each. I guess I was lucky to get two different versions: one was blue and used the UC8151D chipset, and the other was black with the SSD1680 chipset. Adafruit or a distubuter may give you either one ¯\_(ツ)_/¯. For me, I found that the UC8151D needed a reset (RST) pin, while the SSD1680 did not. So I added a 0-ohm resistor jumper to the trace for the screen’s RST pin. It is needed for the UC8151D but works for both, so it's probably best to just include it.

How Long Will It Last?

artem-maltsev-XE8Pe5uz_WI-unsplash.jpg
Screen Shot 2025-10-24 at 3.31.28 AM.png

The device is off most of the time because of a soft latch, so the only current draw comes from the RTC keeping time. The RTC draws 3 µA, and the display plus microcontroller draws about ~20 mA while updating, which takes roughly 15 seconds each day.


My possibly incorrect calculation

  1. Active energy per day: Q_active = 20 mA × (15 s / 3600 s/h) = 0.0833 mAh/day
  2. RTC standby per day: Q_RTC = 0.003 mA × 24 h = 0.072 mAh/day
  3. Total daily drain: Q_total = 0.0833 + 0.072 = 0.1553 mAh/day


battery will last

  1. Battery lifetime = 1500 mAh / 0.1553 mAh/day ≈ 9660 days
  2. Lifetime in years = 9660 ÷ 365 ≈ 26.5 years


CR123A batteries claim to last for 10 years before self-discharge reduces capacity, so divide the 26.5 years by 3 to be ultra conservative and it may last up to 8–12 years on a single battery!


This is just my guest. I'll let you know in a few years if I'm right :)

PCB & Programming the Blank SAMD21

IMG_9912.jpg
IMG_9913.jpg

Order the PCB

order here

I can also provide the kicad files if anyone wants.


Blank SAMD21

I love every chance I get to work with the ATSAMD21E18A. A small but impressive chip:

  1. Ultra-low power
  2. 48 MHz CPU (ARM Cortex-M0+)
  3. 256KB Flash
  4. UART, I²C, SPI
  5. 10-bit DAC (!)


Assembly:

Align the stencil, apply solder paste, place components (watch silkscreen triangles for chip orientation), and melt the solder on the hot plate (I place the assembled board when the plate is off and remove the board when the plate reaches 215 °C).

Watch for:

  1. LEDs and Diode polarity
  2. Clean any solder bridges with flux + a soldering iron
  3. Test continuity before power up

Programming the SAMD21 (Bootloader)

A blank SAMD21s needs a bootloader before you can upload code. Yep, you need to upload code just to upload code. To get ready, you’ll use the 5 test pads: VIN, GND, SWDIO, SWCLK, and RST - these are used to load the bootloader onto the blank MCU. Solder male pins to the pads. I use clay to hold the pins steady while soldering.


Here are the best step-by-step directions I used.

My summary:

  1. Google how to write a bootloader. Find an article called "How Much Pain Do You Want"
  2. Then instead, download Adafruit’s bootloader-QTPy_m0-v3.16.0.bin from here.
  3. Set up Atmel Studio on a Windows machine (real or virtual)
  4. Plug in J-LINK and update its firmware
  5. Connect to board via VIN, GND, SWDIO, SWCLK, RST
  6. In Atmel Studio:
  7. Tools → Device Programming → ATSAMD21E18A → Apply
  8. Click Read → verify voltage and device signature
  9. Set BOOTPROT fuse to 0 bytes → Program, then Verify
  10. Flash the .bin bootloader file (Erase + Verify flash)
  11. Set BOOTPROT to 8192 bytes → Program
  12. Remove male pins with solder iron.

You now have a SAMD21 with Adafruit’s tested bootloader! The chip will show up as a USB device and can be programmed via Arduino IDE!


Add the display

Test the circuit before soldering the Adafruit display on the other side. You can light up the power indicator LED using the soft latch code, battery, and MCU before adding the expensive display. Watching that LED blink on the custom soft latch PCB might be my proudest blink yet.

Code

9407011_31.jpg

The code does four things

  1. Latches onto the MOSFET gate to keep the whole system running.
  2. Sets a new timer for the RTC.
  3. Updates the screen.
  4. Latches off, so the transistor pulls the gate high and turns everything off.


There are some nuances.

Battery In With USB

After getting a working bootloader, I plugged in my 3V battery before uploading the code. The RTC won’t work without this 3V source. If the RTC loses that external power, even for a second, it’ll stop tracking time, alarms, and the soft latch won’t work.


Setting the Correct Initial Time

This line sets the correct time for the MCU and RTC:

rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

The nuance is that this line uses your computer’s time when you upload the code. So, after you upload it, you’ll likely disconnect it and run it just on the battery. At that point, this line doesn’t make sense and might cause issues. When the circuit turns on it will reach this line but it is no longer getting valid time data from your computer.

What worked for me was running the code once with that line, then commenting it out and uploading again. That way, the MCU and RTC get the correct time once, and you don’t touch it again. My circuit refreshes the screen literally a second after midnight every day.


Setting Dates

Set your SET_DATE and TARGET_DATE to match when you uploaded the code (or started the countdown) and your goal date. I set mine to my expected master’s degree graduation date and the day I enrolled :)


Note: SET_DATE < TARGET_DATE. The set date isn’t super important, it just helps track the progress of your countdown.

DateTime SET_DATE(2025, 1, 1); // Start of countdown
DateTime TARGET_DATE(2026, 12, 15); // Target date

Extras

3D files to help make a case.

Thank you for checking out this instructables!