Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-C3 Battery-Powered Weather Station with E-Ink Display

View and Edit Project In Cirkit DesignerImage of ESP32-C3 Battery-Powered Weather Station with E-Ink Display

Circuit Documentation

Summary

This document provides a detailed overview of a weather station circuit powered by an ESP32-C3 microcontroller. The circuit includes various components such as sensors, a display module, a pushbutton, a toggle switch, and a battery. The ESP32-C3 microcontroller is programmed to read data from the sensors and display it on an E-Ink display. The circuit is designed to be low-power and is suitable for battery-operated applications.

Component List

  1. ESP32-C3

    • Description: A low-power microcontroller with built-in Wi-Fi and Bluetooth capabilities.
    • Pins: GPIO2 / A0, GPIO3 / A1, GPIO4 / A2, GPIO5 / A3, GPIO6 / SDA, GPIO7 / SCL, GPIO21 / TX, GPIO20 / RX, GPIO8 / SCK, GPIO9 / MISO, GPIO10 / MOSI, 3.3V, GND, 5V
  2. Pushbutton

    • Description: A simple pushbutton used for user input.
    • Pins: Pin 3 (out), Pin 4 (out), Pin 1 (in), Pin 2 (in)
  3. Resistor

    • Description: A 1000 Ohm resistor used for current limiting.
    • Pins: pin1, pin2
    • Properties: Resistance: 1000 Ohms
  4. 3.7V Battery

    • Description: A battery used to power the circuit.
    • Pins: +, -
  5. Toggle Switch

    • Description: A switch used to control the power from the battery.
    • Pins: L1, COM, L2
  6. Adafruit BMP280

    • Description: A barometric pressure and temperature sensor.
    • Pins: VCC, 3.3V, GND, SCK/SCL, SDO/ADR, SDI/SDA, CS
  7. AHT21

    • Description: A temperature and humidity sensor.
    • Pins: Vin, GND, SCL, SDI
  8. 4.2in 400x600 E-Ink Paper Display Module

    • Description: An E-Ink display module used to display sensor data.
    • Pins: Vcc, GND, DIN, CLK, CS, DC, RST, BUSY

Wiring Details

ESP32-C3

Pushbutton

Resistor

3.7V Battery

Toggle Switch

Adafruit BMP280

AHT21

4.2in 400x600 E-Ink Paper Display Module

Code Documentation

Main Code (epd4in2_V2.ino)

//This is our actual code page. The rest of the files are either configuration or libaries. =)
//ESP32C3 powered battery weather station using an E-ink display (think Kindle screen) and two climate sensors, an AHT21 and a BMP280. 
//We are using I2C for both the AHT21 and the BMP280, and SPI for the e-ink screen

/*       Copyright for the e-ink display libraries:
 *  @filename   :   epd4in2_V2.cpp
 *  @brief      :   Implements for Dual-color e-paper library
 *  @author     :   Yehui from Waveshare
 *
 *  Copyright (C) Waveshare     August 10 2017
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documnetation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to  whom the Software is
 * furished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

//Libraries!
#include <SPI.h>
#include "epd4in2_V2.h"
#include "epdpaint.h"
#include <Adafruit_BMP280.h>
#include <Adafruit_AHTX0.h>

unsigned char image[9000]; //Buffer size!
Paint paint(image, 400, 600); //Width should be the multiple of 8
Epd epd; //Define the display

Adafruit_BMP280 bmp;             //Initialize the BMP280 sensor
Adafruit_AHTX0 aht;             //Initialize the AHT21 sensor
int buttonPin = 5;             //Assign button pin
bool toggleState = false;     //Initial button toggle state
auto lastButtonState = HIGH; //Default the last button state to high


void setup() {

  setCpuFrequencyMhz(40); //Low power mode!

  //Serial.begin(9600); //Begin serial for debugging (turn off if not needed)
  
     bmp.setSampling(Adafruit_BMP280::MODE_FORCED