Skip to content

bbusse/compost-sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

This repository contains recipes for building software for embedded systems. While the range of applications is manifold, the examples given here relate to application for gardening / farming.

It builds an ESP32 firmware in a container providing an ESPHome build environment

Configuration files for the firmware target are kept in a seperate repository and fetched during build

Different kinds of sensors are used for various applications, mostly for measuring temperature and humidity but also atmospheric pressure and fine dust where applicable

Build

Create an argfile.conf

This file must contain all the necessary variables
An example is given below, adjust to your needs

WIFI_SSID="farm-nerds"
WIFI_PASSPHRASE="farm-nerds-passphrase"
HA_API_KEY="6C6eGlbYMw1sEYlURtpIOquRlSIk58sq9Bz46m5XDsk="
HA_OTA_PASSWORD="LjwgwKMVvRlMNWom68T/lA6nR5AwFmqA"

To create an individual random HA_API_KEY

# Create key
head -c32 /dev/random | uuencode -m 

Build on Linux/BSD

Configuration yaml files for ESPHome need to be supplied as build argument
and are fetched from esphome-cfg

Compost

DS18B20 / BME280

$ podman build . -t compost-0 --build-arg-file=argfile.conf --build-arg ESPHOME_CFG=compost-0.yaml

Greenhouse

DHT22 / AM2302

$ podman build . -t greenhouse-1 --build-arg-file=argfile.conf  --build-arg ESPHOME_CFG=greenhouse-1.yaml

Seedling box

BME280

$ podman build . -t seedling-box-0 --build-arg-file=argfile.conf --build-arg ESPHOME_CFG="seedling-box-0.yaml"

Weather station

BME680

$ podman build . -t weather --build-arg-file=argfile.conf --build-arg ESPHOME_CFG=weather.yaml

Copy the built firmware from the running container to the local filesystem

$ export VARIANT=compost-0
$ podman run localhost/${VARIANT}
$ podman cp $(podman ps | awk '/'${VARIANT}'/ {print $1}'):/home/build/.esphome/build/${VARIANT}/.pioenvs/${VARIANT}/firmware.bin .

Build on Windows

Install Python including pip

Python Download

Install esphome

$ pip install esphome

Flash firmware

Connect your ESP32 for flashing

# Flash a bootloader
$ esptool.py write_flash 0x0 ~/Downloads/esp32_bootloader_v4.bin
# Flash the firmware
$ esptool.py write_flash 0x10000 firmware.bin

Resources

ESP32

ESP32

ESPHome

ESPHome
ESPHome Source Code
ESPHome Releases
ESPHome Configuration Files

Sensors

AS3935 Datasheet
BME280 Datasheet
DHT22/AM2302 Datasheet
DS18B20 Datasheet