PROJECTS: IoT Sourdough Grow Jar
sign up and create a new account. As soon as
the account is all set up, you can see the portal
with hosted Grafana and Prometheus instances
(Figure
B
).
As soon as this is done, you’ll need to click on
the “Send Metrics” button next to the Prometheus
card and create a new API key. Keep that API key
and user information on hand, because you will
use them soon to send your data to the database.
CONNECT SENSORS TO BOARD
DHT11
The DHT11 is a very basic and cheap sensor
made of two parts — a humidity sensor and
a thermistor. It can be used to measure the
environment in which our sourdough starter lives.
If you have bought a DHT11 sensor module,
then you should see three pins. No worries if you
see four — you’ve probably bought just a sensor
by itself. This has happened to me as well and it
is an easily solvable problem — you just won’t use
the third pin (Figure
C
).
Connect these pins to the ESP32 board in the
following way, as shown in Figure
D
:
• Vcc pin to 3.3V on board
• Data pin to pin 32 on board
• Gnd pin to Gnd on board
B
HC-SR04
The HC-SR04 ultrasonic sensor provides distance
measurements from 2cm to 4 meters, with
accuracy around 3mm. This sensor will be used
to measure how far your sourdough starter is
from the lid, and to calculate its rise and/or fall.
The HC-SR04 has 4 pins that you will connect to
the ESP32 board in the following way (Figures D
and
E
):
• Vcc pin to 5V on board
• Trig pin (sends the signal) to pin 4 on board
• Echo pin (receives signal) to pin 5 on board
• Gnd pin to Gnd on board
PROGRAMMING
You next need to write and upload a program that
will retrieve data from the sensors and send it to
the Prometheus database. Connect your ESP32
board (with connected sensors) to your computer
with a micro-USB cable.
SETTING UP ARDUINO IDE TO SUPPORT YOUR
ESP32 BOARD
Open your Arduino IDE. If you are using an ESP32
board (rather than an Arduino board), you need
to add a board definition that adds support
for your ESP32. Go to Arduino → Preferences
and input the url https://dl.espressif.com/dl/
package_esp32_index.json to the “Additional
Boards Manager URLs” input (Figure
F
). This
open-source board definition adds support for
programming ESP32 boards.
Then go to Tools → Boards → Boards Manager
and install the ESP32 core (Figure
G
). Next,
C D
E
80 makezine.com
M81_078-83_Sourdough_F1.indd 80M81_078-83_Sourdough_F1.indd 80 4/11/22 12:27 PM4/11/22 12:27 PM