Skip to content

bjoerge/sproutpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪴 Sproutpy

Use a Wi-Fi enabled Raspberry PI Pico W and MicroPython to measure the soil moisture in your potted plants and store the measurements in the Sanity Content Cloud.

Read soil moisture levels for up to three capacitive moisture sensors at a configured interval and store these levels in a Sanity document.

What you'll need

  • Raspberry PI Pico W (how to buy)
  • Soil moisture sensor(s) (you can connect up to 3 to one Raspberry PI Pico W), for example SparkFun SEN-13322
  • Various jumper wires, connectors, breadboard, etc. See this guide for an example of how to hook up a moisture sensor to a Raspberry PI Pico

Quickstart

First, make a fork of this repository to your personal GitHub account and clone it to your local computer.

Setup the Sanity Content Cloud & Content Studio

The Sanity Content Cloud offers a convenient way to store and read the sensor measurements, and the Raspberry PI Pico W will post sensor updates directly there. The Sanity Content Studio allows you to easily view and edit the sensor data stored in the Content Cloud.

  1. Go to https://sanity.io/get-started/create-project and get your project ID and dataset
  2. Copy .env.example in the studio-folder to .env and replace the sample values with the project id and dataset from the previous step
  3. Run the Content Studio locally with npm run dev

Getting started with the Raspberry PI Pico W

Once the board and sensors are hooked up, you are ready to deploy the MicroPython app to the Raspberry PI so it can measure and send sensor measurements at regular intervals to the Sanity Content cloud.

Set up the Raspberry Pico W and calibrate sensors

  1. Open config.py in the board/ folder and set the PROGRAM_MODE to setup
  2. Flash the device with all the files contained in the board folder. Make sure you enable the REPL, so you can see logs and debug if something goes wrong.
  3. (Optional) Open config.py again and change PROGRAM_MODE to calibrate. This will allow you to find the min/max values of the moisture sensors (make sure to have a glass of water readily available).
  4. Flash the device again as in step 2
  5. Open config.py in the board/ folder and set the PROGRAM_MODE to app
  6. Flash the device again as in step 2. The PI will now read sensor levels at the configured interval and post updates to your Sanity Content Cloud dataset.

Resources

Images

Breadboard Content Studio.png

About

🪴 Use a Raspberry PI Pico W to measure the soil moisture in your potted plants and store the measurements in the Sanity Content Cloud

Topics

Resources

Stars

Watchers

Forks