Live devices  |  All devices  |  Fields  |  About |  Test log |  Admin Login



This dashboard reports on data provided by various sensors, mainly the readings from experimental moisture and temperature sensors which are being placed in strategic locations in Bristol.

Moisture Device

This device has been developed to monitor conditions near trees to alert tree carers of exceptional conditions and to aid in research into different soil conditions and mulching and watering strategies. Developmnent has been supported by Earthwatch UK where the sensor is being tested for use in Tiny Forests.

Each device monitors the soil moisture, soil temperature and air temperature and reports this and system data every 2 hours via the mobile phone network to a server.

the device in its container

The heart of the device is the board carrying the microcomputer (underneath) and sockets for the battery pack and the SIM card holder

To restart the device you need to press the reset button which is under the left hand end which sticks out.

Field Installation

  1. check that the batteries are fully charged and that the battery box is plugged in
  2. check that a ThingsMobile SIM card is installed
  3. attach the air temperature sensor (long lead) directly to a tree or stick with tape . Sensor should be 1 foot above ground and unshaded
  4. near the tree, in the zone where water would be applied , use a trowel to dig a 6in deep slot. 
  5. place the moisture sensor point first into the slot so that it is covered
  6. place the soil temp sensor (short lead) at the bottom of the slot , away from the moisture sensor.
  7. cover the slot and compact the soil.
  8. lightly cover the device box with mulch. The GPRS aerial is attached to the underside of the lid and needs a view of the sky
  9. The device starts up with 6 test reports every 30 seconds. These reports are directed to a test log from where they can be viewed on a mobile phone with View test log. This enables the moisture readings and temperature sensors to be checked before installation. Any changes needed can be made through the dashboard editor (below). This script also checks that the usual cycle of deep-sleep and communication via GSM is functioning.
  10. The test log viewer shows an index of devices. The one of interest to us is the one whose MAC number is attached to the device. Select the page for this MAC address or wait until it appears.
  11. briefly press the black button underneath the board to start it (HARD RESET). After a few seconds the red LEDs should flash
  12. As the device starts to send reports, the page for that MAC address will show the data as it arrives. Check that all readings are within range.
  13. The test sequence will restart if the device is restarted by pressing the small black button.
  14. after 6 reports, the next report will be a real data reading and will appear in the device page on the dashboard provided the device is active( set in the dashboard). The data won't be graphed until there are a few data points buth the data view will show the data being gathered.
device installed by a rowan tree

Maintenance Tasks

Battery Change

  1. open the device box - take care if the aerial is attached to the lid
  2. check for any damp - if any, clean the inside and the board and replace the silica sachets
  3. remove the two batteries - a small screwdriver helps to ease them out. Note the orientation of the batteries - the two batteries are used in parallel so that the output voltage is the battery voltage, 4.2v. Sometimes the markings on the battery box wrongly indicate that they are in series. If in doubt, the battery box spring goes on the base of the battery.
  4. replace with two fully charged batteries
  5. press the black reset button under the chip briefly. After a few seconds, the red leds will start flashing.
  6. replace the box, making sure that sensors have not been disturbed
  7. the device will make a few test reports (see Field Installation above) which can be monitored on a smartphone

Things Mobile Topup

ThingsMobile provides a single account from which small amounts are allocated to each SIM as the credit is used. Account access (CW) is needed to topup this account. Costs are currently E0.12 / Mb.

Configuration editing

The most commonly edited fields in the configuration can be edited by a registered user in this dashboard. These include the name, the location, the email address to be used for alerts, air and water values for the moisture sensor and the assignment of temperature sensors to roles.

Configuration file

The configuration file must be changed for any other changes and for adding new devices, Configuration data for devices is held in an XML file. Admin users can download the configuration for a device or a field, edit it and upload it back to the server.
For this task, since the file is XML, you need an XML-aware editor, both for ease of editing and to ensure that the XML is well-formed. Notepad++ is a useful tool but you will need to install the XML plugin which allows the XML to be check for well-formedness and supports XML-aware editing. Schema valdation is also supported by this plugin and a schema for the configuration data will provided RSN.
To create a new device, download a similar device configuration, edit the data and set the id for the new device, and then upload the configuration as a new device. The device will be added and an empty log file created.
Similarly,to create a new field, download a similar field configuration, edit the data and set the id for the new field, and then upload the configuration as a new field.

Improvements in 2022

Arduino device code

The first version of the device code required an unique device Id to be included in the Arduino script. It also required minimum and maximum values for the moisture sensor since each sensor has a different range of values. These values are needed to calculculate a percentage moisture value. This meant that every device needed its own version of the script.

The new version (currently V6.6) uses the MAC address of the device as its ID. WiFi is an integral part of the ESP32 microprocessor and although it’s not used in this design, we can still access the MAC address and use that as an device identifier in reports. The calibration values are now held in the server configuration file for a device and moisture reading conversion to a percentage is now done on the server on receipt of the report. In addition the assignment of a sensor to a role (air , soil) is also done in the server configuration.

In the field it is useful to know that the device is running and to be able to recalibrate the moisture sensor and ensure the correct sensors are used for air and soil. Previously a separate script was used for calibration, but they are now combined into one common script. On startup after pressing the hard restart button, the boot no is reset to zero. For the first 6 cycles, the sleep time is reduced so that reports are generated every 30 seconds. These reports are flagged as test values and directed to a test log where they can be viewed live on a smartphone. This allows the moisture sensor to be read in the dry condition and then immersed in water to record these limit values. After these calibration reports, the sleep time is set to 120 minutes.

The current version is on GitHub

Server Code

The dashboard shows the data from all active devices. Other tabs show all devices and all fields. Admin users can start and stop logging, archive data, edit commonly edited fields and for more complex changes or to create a now device, can edit the XML configuration file for a device.

Device construction


A custom PCB has now been created using EasyEDA and fabricated by JLCPCB. I’ve chosen to use JST XH-2.54 sockets on the board although the plugs are difficult to attach to the sensor leads. A batch of 6 devices is being made up for use by the science team at Earthwatch. A further batch of 10 boards with improved labelling is on order to replace our existing boards and for use by Bristol City Council.

6 boards

Parts list

The full Bill of Materials can be found on Github (TBD)

Construction steps

The following show the steps required for a number of tasks required to construct a device.

TTGO boards

You may need to refer to the LilyGo-T-Call pinout

  1. clean with alcohol
  2. solder headers in modules with battery plug side up using board with a couple of socket strips in place to hold the headers.
  3. check joints carefully

JST plug assembly Temperature and moisture sensors plug into the PCB with JST plugs which need to be assembled. This requires :

  • JST pins (in JST kit)
  • 3 pin JST plugs
  • SN-01BM cripping tool
This YouTube video is helpful and with a little practice, you can make good crimped pins quickly. Some hints:
  • Trim the wires to about 2.5 mm. It's hard to do this exactly with a wire stripper, even an automatic stripper. I found it easier to strip longer than I needed and trim to length with scissors.
  • It's fiddly to align the pin in the crimper (the smaller slot) but it gets easier
  • Check that the crimp is well made before inserting into the socket.
  • You can remove a pin from a socket by depressing the catch but its tricky

Temp sensors: 2 per device

  1. The two sensors have different lengths - short for the soil sensor, longer for the air temp sensor. This helps with installation and knowing which is which.
  2. install a JST plug with the correct pin orientation - looking from the catch side of the socket Left to Right: Ground/Data/Power
  3. fit in test rig and test

Moisture sensors: 1 per device

  1. Cut a 30mm wire from a section of 3-strand sensor cable
  2. add a JST plug with the wire order (from the catch side,Left to Right) : Data/Power/Ground
  3. Add a section of heat shrink to cover the wires.
  4. use a small cable tie to secure the plug to the socket on the moisture sensor
  5. add a JST plug to the other end with wire order (catch side,Left to Right): Ground/Data/Power
  6. use silicon sealant to cover the exposed electronics on the moisture sensor and around the plug
  7. test and calibrate the sensor

PCB assembly

  1. clean PCB with IsoPropanolAlcohol
  2. cut the socket strips to size and fit a TTGO board just to hold the headers at the right orientation
  3. turn upside down, hold the board in place with a bit of blue-tack and solder a few pins on the socket strips to the PCB. This ensures the headers are oriented to fit the board
  4. remove the TTGO board and solder the rest of of the pins. Ground pins take more heat.
  5. fit and solder the 4K7 resistor and trim the leads
  6. fit the JST sockets using a bit of blue-tack to hold each socket in position. Ensure the JST sockets are fully down to the PCB and with the slots on the socket pointing outwards
  7. Refit the TTGO board and check continuity:
  8. JST pins for all sensors are : GND;Data;Power (labeled on latest PCB)
  9. Board Pins are
    • Gnd to sensor Gnds
    • VP to moisture data
    • 25 to moisture power
    • 14 to temp data(both)
    • 13 to temp power both

Device assembly and configuration

  1. fit the ESP32 board to the PCB, aligned with the white line at the back edge of the board.
  2. fit two temp sensors and one moisture sensor
  3. Plug the device into a USB port and start Arduino
  4. install moisture-sensor-power-on-test.ino (source)
  5. Start the Montitor
  6. check that test reports are appearing on the monitor
  7. check voltages at the pins are as expected
  8. note the MAC address
  9. put the mosture sensor in water and note the water reading; then dry thoroughly and take the air reading
  10. note which sensor is used for which role by warming one in your hand
  11. check that the battery voltage is as expected
  12. create a label with the MAC address and stick on the board

GSM script installation and testing

This script will test the GSM connection to the server and deep sleep
  1. fit ThingsMobile SIM
  2. plug in the battery container with 2 fully-charged 18650 batteries
  3. plug the board into a USB port
  4. Install the latest production script (V6.6)
  5. Start the monitor
  6. Also open the Test Log Viewer which can also be used on a smartphone in the field
  7. The warmup phase will run through the reporting cycle 6 times in 3 minutes: collect data, connect to the server via GSM , send the data and go into deep sleep
  8. Reports should appear on the Test log Viewer with more detail shown on the Arduino monitor - check that the device is working correctly when on USB power.
  9. When all is well, unplug the USB power. If necessary, restart the device by pressing the black button under the board to restart the warmup cycle.
  10. Check in the Test Log Viewer that the device is working as expected on battery power.

Container assembly

  1. Use a 450 ml Clip & Close container
  2. Drill a 13mm hole in one end, below where the clip will be
  3. Place the device at the opposite end to the whole and the battery compartment in front of it
  4. Lead the sensor plugs through the hole. The moisture sensor is too big to go through but the hole is big enough for a JST plug.
  5. Use silicon sealant to fill the hole
  6. Place the patch aerial on the side of the container or on the lid
  7. add a few silica bags to help keep the inside dry

Server configuration

  1. login as an admin user
  2. download a similar device as a base configuration
  3. edit the MAC address to the value on the device
  4. other fields can be edited once the configuration file is uploaded
  5. upload the configuration as a new device

Fault fixing

  • If no signal can be obtained, or the aerial is damaged or disconnected, the device will retry every 30 seconds. This may mean that the batteries become exhausted quite quickly and wilneed replacing.

Work to do


I have a concern that the batteries are not lasting so long after a few recharges. Since the batteries are only replaced when the server has stopped, the batteries may be being discharged too deeply which is reducing the ability to be recharged. It may be preferable to change batteries every month.


  • user selection of graph time span
  • graphing the archived data

See Github for source code and current issues
Background on the development of the moisture sensors is in my blog.
Feedback to