MiniFarm on reTerminal: Develop a Simple Farm Monitor & Water Management System

Note: This blog is written by Philip(aka. Dsrc12), a biomedical engineer and head of Intelligent Transport System(ITS) Projects for the NSW Government. Now is devoting himself to STEM as a volunteer. Thanks for Philip’s contribution.

The reTerminal combined with its expansion box takes the Raspberry Pi away from the desktop into the field. Here we develop a mini farm project for STEM education that explores the internals of the software using node-red. Special nodes have already being developed for Grove modules and reTerminal and these are used to fast-track the software development. The aim is to complete the whole project within a single school STEM session say 60 minutes.

We aim to show the following on the reTerminal’s screen: Air Quality, Temperature, Humidity, Light, Analog, Digital, and soil moisture.

We will also include water management so that if the soil moisture is below a threshold then the water pump will start. The code shown here only includes soil moisture sensing and manually activating the pump.

1. Hardware Needed

Grove Base Hat for Raspberry Pi Zero $9.80

(SKU:103030276)

reTerminal CM4104032- Embedded Linux with Raspberry Pi CM4 and 5-Inch Capacitive $195.00

(SKU:110070048)

Grove – Light Sensor v1.2 – LS06-S phototransistor $3.20

(SKU: 101020132)

Grove – Capacitive Soil Moisture Sensor (Corrosion Resistant) $6.50

(SKU:101020614)

Grove – Relay $3.20

(SKU: 103020005)

Grove – Air Quality Sensor v1.3 – Arduino Compatible $10.90

(SKU: 101020078)

Grove – Temperature & Humidity Sensor (SHT31) $13.10

Alternatives to SHT31 are SHT35, BME280, and BME680 but the BME modules are not provided in the Grove node-red package. You need to import them separately.

(SKU: 101020212)

Others: I2C HUB, Raspberry Pi GPIO Headers, Base Board, and Lego. Grove wrappers are used on the project to support the Grove modules and give them a neater appearance. I color code these with Blue: sensors, Red: actuators, and Green: Environmental sensors.

2. Software Needed

Node-Red

Node

Node-red uses a data flow paradigm starting from the left and sending data packets called payloads to the right. The results appear in the debug window on the right of the screen. Just import the Grove and reTerminal nodes from the internet by using the “Manage Palette” selection.

The highlighted nodes in yellow are used in my software. You don’t need the Grove Light Sensor V1.2 as there is already a Digital Sensor included in the reTerminal but it is there for comparison and demonstration of using the software.

  • The code for this node is very simple:
    msg.payload = msg.payload.light;
  • return msg;

Again getting the x value of acceleration  is added for demonstration and is not needed for the miniFarm:

  • msg.payload = msg.payload.axis.x;
  • return msg;

Here is an example of showing the soil moisture results on a chart

Code

Everything except the logic for water management is shown in the following node-red code. It is not hard to add this.

Flow

To see the results import the dashboard nodes to create a user interface. I can access this on my wifi network using http://xx.xx.xx:1880/ui (http://xx.x.x.xxx:1880/ui where  xx.x.x.xxx is where reTerminal is on my home network.)

Result

On node-red’s debug panel you can see the results and I demo the results on my youtube channel: dsrc12

The results on Chrome as shown in the following image:


About Philip:

I am a retired engineer and previously worked as a biomedical engineer and later as head of Intelligent Transport Systems (ITS) Projects for the NSW Government. Some heights of my career:

A first biomedical engineer at Westmead Hospital – Australia’s largest hospital with a major medical research role. I specified, purchased, and commissioned all of its initial hi-tech including linear accelerators, CT Scanners, and computers for nuclear medicine.
Designed computer and electronic controls for ALF (Accelerated Loading Facility) – a world leader in road testing. Machine sold to both USA and Chinese Governments in the 1980s to help them build their national road networks.
Developed ITS for rapid bus transit systems for Sydney and ITS for road safety including black ice and wet weather detection and warning systems.
Traffic light control systems – are used in many cities thorough the world including cities in China such as Hong Kong, Shanghai, etc. My role was to recruit engineers for development and integrate city traffic control with motorway ramping.
Currently, I am a volunteer to:

CSIRO as an Industry STEM Partner and supports Chatswood High School in Sydney
Blacktown Council Library and set up a STEM Club at the Mount Druitt Library


That’s it for this post. As always, we can’t wait to see what you make. Shoot us a tweet @seeedstudio, or let us know on LinkedInDiscord, or publish your project on our Project Hub on Hackster. Please be safe out there, be kind to one another, and we’ll see you next month with even more exciting news!

About Author

Calendar

July 2022
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031