The diagram shows a universal pinout for connecting an E-INK display to the ESP8266 that does not interfere with initialization signals and leaves the I2C pins available for
connecting a sensor (tested for 4.2' displays from Waveshare, WeAct, and should be compatible with some other manufacturers using the same controller - SSD1683 or UC8176).
This pinout is used in all schematic variants and can be used as reference, or for recheck yourself
The remaining free pin D4 should not be in a LOW state when the device starts, but it can still be used for something.
Components:
In case of using additional I2C sensors (e.g. air quality sensor, CO2), the connection is made to the same pins (SDA, SCL, 3.3V, GND), according to the pin designations on the sensor itself.
Flashing can be done via USB without any special considerations. If settings are lost or there are issues initializing specific parameters, you can reset through the control panel at http://[device IP address] (Device Management -> Reset Settings).
Firmware updates can be performed over the air via http://[device IP address]/update.
The firmware file after compilation in PlatformIO is usually saved in the project directory .pio\build\esp12e\firmware.bin.
In case of using additional I2C sensors (e.g. air quality sensor, CO2), the connection is made to the same pins (SDA, SCL, 3.3V, GND), according to the pin designations on the sensor itself.
The diagram shows a universal pinout for connecting an E-INK display to the ESP8266 that does not interfere with initialization signals and leaves the I2C pins available for
connecting a sensor (tested for 4.2' displays from Waveshare, WeAct, and should be compatible with some other manufacturers using the same controller - SSD1683 or UC8176).
This pinout is used in all schematic variants and can be used as reference, or for recheck yourself
The remaining free pin D4 should not be in a LOW state when the device starts, but it can still be used for something.
Components:
In case of using additional I2C sensors (e.g. air quality sensor, CO2), the connection is made to the same pins (SDA, SCL, 3.3V, GND), according to the pin designations on the sensor itself.
Always turn off the device ("Power switch" on scheme) or remove battery before flashing via USB
- By default, the standalone version reads input voltage on A0 pin (BAT_SENSOR), and if BAT_SENSOR switch is off, enables constant operation mode - connects to the WiFi network and obtains an IP address for remote access and further configuration/direct control. The IP address will be displayed on the screen.
- If you are using an ESP8266 version other than the D1 Mini, internal protective resistors may have different values. If necessary, you can adjust the variables in the Env.cpp -> readBatteryV() method.
Firmware updates can be performed by web-panel http://[device IP address]/update
Simply switch the device to constant mode (disconnect pin A0 and reboot). The firmware file after compilation in PlatformIO is usually saved in the project directory .pio\build\esp12e\firmware.bin.
In the case of flashing via USB, make sure to avoid connecting two power sources simultaneously (for example, USB to both the 4056 and the ESP at the same time)
In case when connecting to a computer / powering the ESP8266 via USB, the 4056 module has a battery protection chip, which should detect an "overcharge" of the battery if the "Power switch" is not turned off while the ESP is powered via USB, and instantly disconnect B- from GND, thereby automatically protecting the battery. If you need to frequently reflash the ESP8266 during development and want to avoid potential issues with the battery / charging circuit, you can expose the RX / TX / GND pins and connect the device to the computer via them, using a separate USB-COM converter (USB to TTL). In this case, to put the ESP8266 into flashing mode, you need to connect the D3 pin to GND during flashing, press RESET, or turn the power off and on again, then proceed with firmware uploading through PlatformIO.
Additional protective measures can be considered, such as adding protection using two 1N5817 diodes as implemented in the SlimeVR project
In case if a 1N5817 protection diode is added as shown in the diagram, it will protect the battery if the "Power switch" was not turned off during flashing / powering via USB. Long-term testing in this mode has not been conducted.
Scheme from bottom - version that allow power/charging directly from the ESP. In this case, the battery and power circuit will be completely isolated. In such a scheme, it is possible to charge and work via UART simultaneously, as the ESP will be powered from USB.
This option has not been used, but if you plan to develop this approach, you should also protect the device from possible simultaneous connection of two power sources (choose the ESP as the base and route the USB-C port with DATA pins and power to the device's body).
Alternatively, if the device is to be powered continuously from the mains, you might not need a battery at all. In the event of a power outage, the ESP8266 will simply reboot and continue working. However, if for some reason you prefer to use the device continuously from the mains while having a battery backup, it's better to look for charging modules designed for constant connection to the mains. For example, searching for "Lithium battery charger ups power supply 5v 18650" yields many cheap ready-made solutions designed for continuous power from the mains with battery backup. The board will be slightly larger, so you'll need to adjust the case accordingly. In practice, this hasn't been a major concern yet, as the device, even with a regular battery, lasts for several months if it's working in normal mode with sleep transitions.
In case of using additional I2C sensors (e.g. air quality sensor, CO2), the connection is made to the same pins (SDA, SCL, 3.3V, GND), according to the pin designations on the sensor itself.
Any board with an ESP32 microcontroller model will work. The most optimal option at the moment is the ESP32 S3 Super Mini (ready profile in firmware - platformio.esp32s3zero.ini) with a built-in battery charging controller (you can connect the battery directly to the ESP32 board without needing additional charging control modules, which simplifies the circuit).
Components:
The SLEEP_ON_READ_LOW switch is used only when a battery is connected and is needed to toggle between deep sleep mode and continuous operation (the device will be accessible via IP).
Defines for UserDefines.h according to this scheme
#define DEFAULT_I2C_SCL 5
#define DEFAULT_I2C_SDA 6
#define SLEEP_SWITCH_PIN 2
#define BATTERY_SENSOR_PIN 7
#define EPD_BUSY_PIN 8
#define EPD_RST_PIN 9
#define EPD_DC_PIN 10
#define EPD_CS_PIN -1
#define EPD_CLK_PIN 12
#define EPD_DIN_PIN 13
If you're using a different ESP32 board, when connecting a battery, the divider should be selected based on the upper threshold for analog input voltage reading (BAT_SENSOR) of your ESP32 and the maximum voltage of the power source (the max charge of a 3.7V Li-Ion battery can reach up to 4.2V).
The table below shows some boards that were tested.
Board Model | Input V Reading Threshold | R1 - V | R2 - GND |
ESP32 S3 SuperMini | 3.1V | 16.5kOhm | 47kOhm |
ESP32 S2 Mini | 2.6V | 32.6kOhm | 47.2kOhm |
ESP32 C3 Zero | 2.5V | 32kOhm | 44kOhm |
If your board is not in the table, one of the listed options may still work. To determine the correct values for your case, you can consult your board's documentation or run a test using a sketch like:
analogReadResolution(12);
analogSetAttenuation(ADC_11db);
Serial.println(analogRead(BATTERY_SENSOR_PIN)); // returns the input voltage in units from 0 to 4095
This way, you can calculate the corresponding maximum V for the value 4095 in your case and use the voltage divider calculator. The input voltage should not exceed 3.3V, but the actual threshold of measurable values is usually lower and varies between 2.5-3.1V.
In case of using additional I2C sensors (e.g. air quality sensor, CO2), the connection is made to the same pins (SDA, SCL, 3.3V, GND), according to the pin designations on the sensor itself.
Pages of those components that I used in the assembly, with some comments. Prices are current as of 05.08.24, screenshots are given for the exact names of products
Also used in tests without problems
USB-C connector for stand version of case