Moisture Puck - BitKnitting/should_I_water GitHub Wiki

Here are images of a Moisture Puck:
Moisture Puck Enclosure moisture puck inside

Hardware

The hardware includes a Feather RFM69HCW, an inexpensive moisture sensor, and an enclosure. I tried making a robust enclosure on my 3D printer. However, I was not able to make an enclosure that sufficiently withstood the sun and rain.
UPDATE NOTE: After watching Andreas Spiess' video, "Why most Arduino Soil Moisture Sensors suck", I ordered some capacitive touch moisture sensors. I am currently using the first type of moisture sensor Andreas discusses.

Firmware

The Arduino source code is located at this GitHub location. Here is a generalized view of the code flow:

Node

Eventually, I will have moisture pucks at several locations within my front and back yard. This way, I can water only as needed. To do this, I identify each moisture puck with a node ID. Nodes are defined in reading_model.py:

class Node(BaseModel):
    nodeID = IntegerField()
    description = CharField(max_length=255)
    threshold = IntegerField()

I use the following commands on the Raspberry Pi to see what is in the node table and add a node to the garden_readings.db:

$ sqlite3 garden_readings.db
sqlite> select * from node;
1|1|Planters up front|180
sqlite>update node set threshold=190 where id=2

Input Pin

Note:
int current_reading = analogRead(A0); // !!!The moisture sensor must be on this analog pin.!!!

RTC - CircuitPython's Nemesis

I wanted to use CircuitPython. Not having the ability to wake up the M0 stopped me....sadly...i.e. I could not do this:

/********************************************************
  set_rtc
  see https://www.arduino.cc/en/Reference/RTC
********************************************************/
void set_rtc() {
  rtc.setTime(timeInfo.values.hour, timeInfo.values.minute, timeInfo.values.second);
  rtc.setAlarmTime(timeInfo.values.wateringHour, 00, 00);
  rtc.enableAlarm(rtc.MATCH_HHMMSS);
}
/********************************************************
  go_to_sleep
********************************************************/
void go_to_sleep() {
  rf69.sleep();
  rtc.standbyMode();
}
/********************************************************
  wake_up - called back by rtc when an alarm goes off.
********************************************************/
void wake_up() {
}
⚠️ **GitHub.com Fallback** ⚠️