Compare commits

..

No commits in common. "30402d41d3919d01a97383b12b7015291a96cc69" and "d22963e249592dc75f6c3f2fcc9a4be832560a6b" have entirely different histories.

2 changed files with 7 additions and 31 deletions

View file

@ -1,16 +1,7 @@
# ESP32-based Environmental Sensor # Readme
Author: Jannik Beyerstedt Author: Jannik Beyerstedt
**license:** GNU GPL v3 **license:** GNU GPL v3
A simple temperature and humidity sensor node using an ESP32 and a Si7021 sensor element running of a 18650 LiIon battery cell.
The sensor outputs the data to an influxDB instance, which must be reachable via HTTP.
To save energy, we use a lower CPU frequency.
But this requires compiling the core framework again with the changed settings (see below).
This repository contains the code running on the ESP32, as well as the PCB and case design.
## Dependencies ## Dependencies
Prepare toolchain (macOS): Prepare toolchain (macOS):
@ -52,8 +43,7 @@ git clone --recursive https://github.com/espressif/esp-idf.git
``` ```
## Checkout this project and configure arduino-es32 with esp-idf:
## Checkout this project and configure arduino-esp32 with esp-idf:
``` ```
TODO!! TODO!!
@ -81,17 +71,3 @@ make all
make flash make flash
``` ```
You would probably have to adapt the `UPLOAD_PORT` in the `Makefile` or set it via an environment variable. You would probably have to adapt the `UPLOAD_PORT` in the `Makefile` or set it via an environment variable.
## Battery Life
The hardware was designed with two options to drop the battery voltage to a level, which can be fed to the ESP32: A voltage regulator or a simple diode.
A test with increased data rate (for a shorter test duration) showed, that the voltage regulator leads to a slight battery life benefit.
Using a measurement interval of 30 seconds and a WiFi connection interval of 3 minutes, the 2500mAh LiIon (3.7V) battery lasted 30 days with the diode and 36 days using the voltage regulator.
The selected voltage regulator has a quite low drop-out voltage and more importantly a low leaking current during the deep-sleep phases, which have a very low current needed by the ESP32.
In comparison a diode has no leaking current at all, but a more or less fixed voltage drop.
The benefit of the voltage regulator is, that the battery voltage range can be exploited further than what can be done with the diode.
The lowest operational battery level was 3.2 V using the diode and 2.8 V using the voltage regulator.

View file

@ -31,11 +31,11 @@
#define BOARD 4 /* IMPORTANT: select one of the BOARD_* types */ #define BOARD 4 /* IMPORTANT: select one of the BOARD_* types */
#endif #endif
#define DB_HOSTNAME "influx-iot.fra80" #define DB_HOSTNAME "ursaminor.fra80"
#define DB_PASSWD "c2Vuc29yczpTZW5zb3JzLXcuaW5mbHV4QGhvbWU" // BasicAuth String #define DB_PASSWD "c2Vuc29yczpTZW5zb3JzLXcuaW5mbHV4QGhvbWU" // BasicAuth String
#if BOARD == BOARD_ESP32 #if BOARD == BOARD_ESP32
#define BATT_FULL 3700 // 4.2V Battery #define BATT_FULL 3800 // 4.3V Battery
#define BATT_CUTOFF 2500 // 2.8V Battery #define BATT_CUTOFF 2500 // 2.8V Battery
#else #else
#error "unsupported board chosen" #error "unsupported board chosen"
@ -68,9 +68,9 @@ String serviceUri = "/write?db=test";
#endif #endif
/* GLOBAL VARIABLES */ /* GLOBAL VARIABLES */
const uint16_t wlanConnectCheckInterval = 250; // milli seconds: poll wifi.state after wifi.begin() const uint16_t wlanConnectCheckInterval = 250; // milli seconds: poll wifi.state after wifi.begin()
const uint16_t wlanConnectTimeout = 15000; // milli seconds const uint16_t wlanConnectTimeout = 15000; // milli seconds
RTC_DATA_ATTR uint8_t wlanConnectFailCnt = 0; RTC_DATA_ATTR uint8_t wlanConnectFailCnt = 0;
Si7021 si7021 = Si7021(); Si7021 si7021 = Si7021();
float temp = 0.0; float temp = 0.0;