Eustaquia is a playful project that lets a plant “talk” when it’s thirsty. A GRiSP2 board running Erlang reads soil humidity via I²C and drives a servo to switch a face from happy 😀 to sad 😢 — a simple way to explore GRiSP, embedded Erlang, and basic electronics.
| Animation Example | Real test |
|---|---|
![]() | ![]() |
stateDiagram-v2
[*] --> OutOfSoil
OutOfSoil : Sensor out of soil
OutOfSoil : Face = Sad (down)
OutOfSoil --> Measuring : Inserted in soil / Start reading
Measuring : Reading humidity via I²C
Measuring --> Happy : Humidity >= Threshold
Measuring --> Sad : Humidity < Threshold
Happy : Face = Happy
Happy --> Measuring : 5s Timer / Recheck humidity
Sad : Face = Sad (down)
Sad --> Measuring : 5s Timer / Recheck humidity
In short:
- When the sensor is not in the soil, the face stays down (sad).
- Once in the soil, humidity is read every 5 seconds over I²C.
- If humidity is above the threshold → Eustaquia smiles 😀.
- If humidity is below the threshold → face stays sad 😢.
Tip: The initial state looks like the sad face. To confirm everything works, dip the sensor in water and watch it switch to happy.
-
I²C (Inter-Integrated Circuit) — Protocol for talking to devices over two lines: SDA (data) and SCL (clock). GRiSP supports it via grisp_i2c. Used here to read the soil moisture sensor (seesaw protocol).
-
PWM (Pulse Width Modulation) — You turn the signal on and off quickly; the duty cycle (percentage of time on) controls the effect. GRiSP provides grisp_pwm, which we use to drive the servo (happy vs sad position).
See docs/WIRING.md for the step-by-step wiring guide.
| Real Image 1 | Real Image 2 |
|---|---|
![]() | ![]() |
- Compile:
rebar3 compile - Deploy to GRiSP:
rebar3 grisp deploy - Insert the SD card into the board and power it on.
See the GRiSP wiki for more detail.
Generate docs locally:
rebar3 ex_doc
open doc/index.html- docs/IMPLEMENTATION.md (EN) / docs/IMPLEMENTACION.md (ES) — full implementation guide.
- docs/WIRING.md — wiring and connection guide.
Connect to the GRiSP shell (e.g. over serial), then run the tests below.
- Power the GRiSP (USB or external).
- Plug the PMOD I²C into the board (external bus, usually
i2c1). - Connect the soil sensor with the 4-wire cable: VIN → PMOD VCC, GND → GND, SDA → SDA, SCL → SCL. Do not swap SDA and SCL.
- If using the servo: connect the PMOD R/C Servo and servo as described above.
- In the project root:
rebar3 compile. Fix any deps withrebar3 depsif needed. - Flash:
rebar3 grisp deploy(orrebar3 grisp burn). Insert the SD card if required, then power the board.
- Connect over serial (see GRiSP wiki).
- Start the app if it does not start automatically; you should be able to call the project modules.
In the shell:
1> eustaquia:check_sensor().
Checking soil sensor (I2C seesaw)...
Moisture: 850 (typical range dry 200, wet 2000)
Temperature: 22.5 °C
Done. If both OK, sensor is working.
okIf you see reasonable values (moisture ~200–2000, temperature in °C), the seesaw protocol and sensor are working. On error, check wiring (VIN, GND, SDA, SCL), PMOD connection, and bus (i2c1). You can run grisp_i2c:detect(i2c1) to list I²C addresses (sensor is usually 0x36).
eustaquia:test_moisture().— Read humidity once.eustaquia:test_servo_happy()./eustaquia:test_servo_sad().— Move the servo to happy or sad.eustaquia:loop().— Full loop: every 5 s read humidity and update the face. Stop the process to exit.
- Notifications — Notify your phone when the plant is thirsty.
- Plant network — Several plants on BEAM nodes sharing state (e.g. a “neighborhood watch” so you see which one needs water).
- Configurable humidity threshold — Make the dry/wet threshold configurable (e.g. via config or shell) so you can tune it per plant or soil type.
- docs/IMPLEMENTATION.md (EN) / docs/IMPLEMENTACION.md (ES) — implementation details, hardware, software layers.
- docs/WIRING.md — wiring and connection guide with diagrams and photos.



