Stupid Weather Box on E-Ink

As early as a year and a half ago, I bought a pair of E-Ink screens with eBay based on the SSD1606 driver, just for the weather station. And 4 months ago, before the new year, he appeared.

I will say right away that there is no watch in it, since there are watches at home literally everywhere! But he knows how to show the following:

  • current temperature in Celsius;
  • current humidity in percent;
  • current pressure in mmHg;
  • pressure history for the last 15 hours in a graph;
  • battery voltage.

Actually that's all. Necessary minimum and ultimate simplicity!

Even there is no such GUI

Principle of operation

The controller should, at the touch of a button, display relevant information on the screen. Most of the time the controller sleeps, as does the display, which is in deep sleep.

The controller periodically wakes up with watchDog and takes a pressure measurement every 5 minutes to build a graph of pressure changes.

It turned out to be very interesting with the schedule, since the pressure can change very quickly and strongly (the weather in the northern city is generally unpredictable), then at some point the graph may go off scale. To do this, once every couple of hours, the midpoint of the measurements is recalibrated (pressure can go both up and down). However, due to this, a clear difference between the previous values ​​simplifies the reading of the graph (an example on CPDV).


The main brain is the ATMega328P microcontroller, the BME280 is used as the barometer’s whole meter, and for the screen is the E-Ink of the second revision based on the SSD1606 from Smart-Prototyping, which was previously described.

This is almost the same screen as the WaveShare e-paper 2.7 ", only older (the datasheets are very similar to them).
All this works on the battery from a 120 mAh toy helicopter. The battery is charged using a module with protection against deep discharge and overcharge based on TP4056 with a 47 kΩ resistor installed for charging with a current of about 20 mA.

Power optimization

A sound and healthy sleep is our everything! Therefore, you need to sleep to the maximum!

Since there was no software for working with the screen, only a basic example of code with comments in the celestial language and datasheet (the screen only appeared a year and a half ago), most of everything had to be done by myself, since I already had experience working with different screens.

DeepSleep mode was found in the datasheet, in it the screen consumes nothing at all - 1.6mkA!

The barometer has a metering mode on demand (aka standby), in it the sensor consumes a minimum of energy, while providing sufficient accuracy for a simple indication of changes (the datasheet indicates that it is just for weather stations). The inclusion of this mode gave a consumption of 6.2 μA. Further on the module, the LDO regulator was soldered from LM6206N3 (or maybe XC6206, both of them are disguised as 662k) on the MCP1700.

This gave a gain of 2 μA more.

Since it is necessary to achieve minimum power consumption, the LowPower library was used. It has convenient work with watchDog, on the basis of which the atmega’s dream is made. However, in itself it consumes about 4 μA. I see a solution to this problem using an external timer based on Texas Instruments TPL5010 or similar.

Also, to reduce power consumption, it was necessary to flash the atme with other FUSE bits and a bootloader, which was successfully done with USBasp, and was added to the boards.txt file

The following text:
## Arduino Pro or Pro Mini (1.8V, 1 MHz Int.) w/ ATmega328p
## internal osc div8, also now watchdog, no LED on boot
## bootloader size: 402 bytes
## ------------------------------------------------- (1.8V, 1 MHz Int., BOD off)

Also put the bootloader compiled from optiboot into the “bootloaders / atmega /” folder:


Actually, as you probably guessed, all this was done on the basis of Arduino, namely pro mini at 8MHz 3.3V. The mic5203 LDO controller was soldered from this board (too gluttonous at low currents) and the LED resistor was soldered to indicate power.

As a result, it was possible to achieve an energy consumption of 10 μAh in sleep mode, which gives about 462.96 days of operation. From this number you can safely subtract a third, thereby obtaining about 10 months, which so far corresponds to reality.

I tested the version on ionistors, with a final capacity of 3 mAh, it lasts no more than 6 days (high self-discharge). The calculation of the capacitance of the ionistor was done according to the formula C * V / 3.6 = X mAh. I think that the version with the solar battery and the MSP430 will be generally eternal.

#include <SPI.h>
#include <Wire.h>
#include <ssd1606.h>
#include <Adafruit_BME280.h>
//#include <BME280_2.h> // local optimisation
#include <LowPower.h>

#include <avr/sleep.h>
#include <avr/power.h>

#define TIME_X_POS 0
#define TIME_Y_POS 12

#define DATE_X_POS 2
#define DATE_Y_POS 9

#define WEECK_X_POS 65
#define WEECK_Y_POS 9

// ====================================== //
#define TEMP_X_POS 105
#define TEMP_Y_POS 15

#define PRESURE_X_POS 105
#define PRESURE_Y_POS 12

#define HUMIDITY_X_POS 105
#define HUMIDITY_Y_POS 9
// ====================================== //

#define BATT_X_POS 65
#define BATT_Y_POS 15

#define ONE_PASCAL 133.322

// ==== for presure history in graph ==== //
#define MAX_MESURES 171
#define BAR_GRAPH_X_POS 0
#define BAR_GRAPH_Y_POS 0
#define PRESURE_PRECISION_RANGE 4.0 // -/+ 4 mm
#define PRESURE_GRAPH_MIN 30 // vertical line graph for every N minutes
#define PRESURE_PRECISION_VAL 10 // max val 100
#define PRESURE_CONST_VALUE 700.0 // const val what unneed in graph calculations
#define PRESURE_ERROR -1000 // calibrated value
// ====================================== //

#define VCC_CALIBRATED_VAL 0.027085714285714 // == 3.792 V / 140 (real / mesured)
//#define VCC_CALIBRATED_VAL 0.024975369458128 // == 5.070 V / 203 (real / mesured)
#define VCC_MIN_VALUE 2.95 // min value to refresh screen
#define CALIBRATE_VCC 1 // need for battery mesure calibration

// 37 ~296 sec or 5 min * MAX_MESURES = 14,33(3) hours for full screen
#define SLEEP_SIZE 37

#ifdef BME280_ADDRESS
#undef BME280_ADDRESS
#define BME280_ADDRESS 0x76

#define ISR_PIN 3 // other mega328-based 2, 3
#define POWER_OFF_PIN 4 // also DONEPIN

#define E_CS 6 // CS ~ D6
#define E_DC 5 // D/C ~ D5
#define E_BSY 7 // BUSY ~ D7
#define E_RST 2 // RST ~ D2
#define E_BS 8 // BS ~ D8

MOSI ~ D11
MISO ~ D12
CLK ~ D13
EPD_SSD1606 Eink(E_CS, E_DC, E_BSY, E_RST);
Adafruit_BME280 bme;

volatile bool adcDone;
bool updateSreen = true;
bool normalWakeup = false;

float battVal =0;
uint8_t battValcV =0;

uint8_t timeToSleep = 0;

float presure =0;
float temperature =0;
float humidity =0;
float presure_mmHg =0;

unsigned long presureMin =0;
unsigned long presureMax =0;

uint8_t currentMesure = MAX_MESURES;
uint8_t presureValHistoryArr[MAX_MESURES] = {0};

typedef struct {
uint8_t *pData;
uint8_t pos;
uint8_t size;
unsigned long valMax;
unsigned long valMin;
} history_t;

void setup()


attachInterrupt(digitalPinToInterrupt(ISR_PIN), ISRwakeupPin, RISING);


// tiiiiny fix....

void saveExtraPower(void)

// Disable digital input buffers:
DIDR0 = 0x3F; // on ADC0-ADC5 pins
DIDR1 = (1 << AIN1D) | (1 << AIN0D); // on AIN1/0

void initBME(void)
bme.begin(BME280_ADDRESS); // I2C addr

LowPower.powerDown(SLEEP_250MS, ADC_OFF, BOD_OFF); // wait for chip to wake up.
while(bme.isReadingCalibration()) { // if chip is still reading calibration, delay
LowPower.powerDown(SLEEP_120MS, ADC_OFF, BOD_OFF);

Adafruit_BME280::SAMPLING_X1, // temperature
Adafruit_BME280::SAMPLING_X1, // pressure
Adafruit_BME280::SAMPLING_X1, // humidity

Main code:
void loop()
for(;;) { // i hate func jumps when it's unneed!
if(normalWakeup) {
} else {
normalWakeup = true;


// func to exec in pin ISR
void ISRwakeupPin(void)
// Keep this as short as possible. Possibly avoid using function calls
normalWakeup = false;
updateSreen = true;
timeToSleep = 1;

adcDone = true;

void debounceFix(void)
normalWakeup = true;
updateSreen = false;

uint8_t vccRead(void)
uint8_t count = 4;
ADMUX = bit(REFS0) | 14; // use VCC and internal bandgap
do {
adcDone = false;
while(!adcDone) sleep_mode();
} while (--count);
bitClear(ADCSRA, ADIE);
// convert ADC readings to fit in one byte, i.e. 20 mV steps:
// 1.0V = 0, 1.8V = 40, 3.3V = 115, 5.0V = 200, 6.0V = 250
return (55U * 1023U) / (ADC + 1) - 50;

unsigned long getHiPrecision(double number)
// what if presure will be more 800 or less 700? ...
number -= PRESURE_CONST_VALUE; // remove constant value
number *= PRESURE_PRECISION_VAL; // increase precision by PRESURE_PRECISION_VAL
return (unsigned long)number; // Extract the integer part of the number

void checkVCC(void)
// reconstruct human readable value
battValcV = vccRead();
battVal = battValcV * VCC_CALIBRATED_VAL;

if(battVal <= VCC_MIN_VALUE) { // not enought power to drive E-Ink or work propetly
// to prevent full discharge: just sleep
LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);

void checkBME280(void)
bme.takeForcedMeasurement(); // wakeup, make new mesure and sleep
temperature = bme.readTemperature();
humidity = bme.readHumidity();
presure = bme.readPressure();

void updatePresureHistory(void)
// convert Pa to mmHg; 1 mmHg == 133.322 Pa
presure_mmHg = (presure + PRESURE_ERROR)/ONE_PASCAL;

// === calc presure history in graph === //
if((++currentMesure) >= (MAX_MESURES/3)) { // each 4,75 hours
currentMesure =0;
presureMin = getHiPrecision(presure_mmHg - PRESURE_PRECISION_RANGE);
presureMax = getHiPrecision(presure_mmHg + PRESURE_PRECISION_RANGE);

// 36 == 4 pixels in sector * 9 sectors
presureValHistoryArr[MAX_MESURES-1] = map(getHiPrecision(presure_mmHg), presureMin, presureMax, 0, 35);

for(uint8_t i=0; i < MAX_MESURES; i++) {
presureValHistoryArr[i] = presureValHistoryArr[i+1];

void updateEinkData(void)
if(updateSreen) {
updateSreen = false;

// bar history

for(uint8_t i=1; i <= (MAX_MESURES/PRESURE_GRAPH_MIN); i++) {

for(uint8_t i=0; i <= MAX_MESURES; i++) {
Eink.drawPixel(i, BAR_GRAPH_Y_POS+presureValHistoryArr[i], COLOR_BLACK);

Eink.setCursor(BATT_X_POS, BATT_Y_POS);

Eink.setCursor(BATT_X_POS, BATT_Y_POS-3);

Eink.setCursor(TEMP_X_POS, TEMP_Y_POS);




void updateEinkSreen(void)
Eink.display(); // update Eink RAM to screen

// as Eink display acts not like in DS, then just sleep for 2 seconds
LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);

void effectiveIdle(void)

void drawDefaultScreen(void)

Eink.printAt(TEMP_X_POS, TEMP_Y_POS, F("00.00 C"));
Eink.printAt(PRESURE_X_POS, PRESURE_Y_POS, F("000.00 mm"));
Eink.printAt(HUMIDITY_X_POS, HUMIDITY_Y_POS, F("00.00 %"));

Eink.printAt(BATT_X_POS, BATT_Y_POS, F("0.00V"));
// just show speed in some kart racing game in mushr... kingdom \(^_^ )/
Eink.printAt(BATT_X_POS, BATT_Y_POS-3, F("000cc"));

void drawDefaultGUI(void)
Eink.drawHLine(0, 60, 171, COLOR_BLACK); // split 2 areas

// draw window
Eink.drawRect(0, 0, 171, 71, COLOR_BLACK);

// frame for text
Eink.drawRect(BATT_X_POS, BATT_Y_POS, 102, 32, COLOR_BLACK);

void snooze(void)
do {
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
} while(--timeToSleep);

void disablePower(void)
digitalWrite(POWER_OFF_PIN, HIGH);
digitalWrite(POWER_OFF_PIN, LOW);

void enterSleep(void)
// wakeup after ISR signal;
timeToSleep = SLEEP_SIZE;


Since I do not have a 3D printer, but I have a 3D pen MyRiwell RP800A. It turned out that it was not so easy to make planar and even structures. Everything was drawn with PLA plastic, which was at that time, so the case came out multi-colored, which in addition gives a certain charm (then I will remake it under the tree when the plastic with wood chips arrives).

The first parts were drawn directly on paper, and then come off. This left marks on the plastic. Moreover, the details were crooked and they needed to be straightened somehow!

The solution turned out to be banal simple - draw on glass, and put “drawings” of the necessary body elements under it.

And here's what happened:
The screen refresh button simply had to be red on a white background!

The back wall is made with the simplest pattern, thereby creating ventilation holes.

The button was fixed on a horizontal strut inside (in yellow) with the same handle.

The button itself is taken from an old computer case (it has a nice sound).

Inside, everything is fixed with hot-melt adhesive and plastic, so that it is not easy to disassemble it.

Of course, the connector for charging and updating the firmware is left. The case, unfortunately, had to be made monolithic for greater strength.


It took 4 months, and after not fully charging (up to 4V), the voltage on the battery went down to just 3.58V, which guarantees an even longer service life until the next charge.

Homeworkers are very used to this contraption in the case of headaches or if you need to find out the exact weather forecast for the next hour or two, then immediately go to her and see what happened with the pressure. On KPDV, for example, a strong pressure drop is seen, as a result there was heavy snow with the wind.

Links to repositories:
library for the screen
library for lowPower
library for BME280

In connection with the increased interest in the body, he posted more images. Smart-Prototyping screen of the second revision. An analogue to him on Ali is here .

Click me:

P.S. КПДВ было сделано вечером, как итог сегодня ночью выпало очень, очень много снега в Санкт-Петербурге.
P.P.S Синюю изоленту известным причинам добавлять в опрос не стал.

Only registered users can participate in the survey. Please come in.

I propose to decide which case is better:

  • 25.1% Plywood and jigsaw our everything 48
  • 14.1% Wood cut 27
  • 19.4% Acrylic is better 37
  • 2.1% Plastic knitting 4
  • 33.0% 3D printer 63
  • 19.4% Cut from a single piece of metal 37
  • 9.4% Candy Iron Can 18
  • 4.2% All of hot glue 8
  • 19.4% Make shit and sticks 37
  • 6.3% Great cardboard 12
  • 8.9% Polymer clay 17