Skip to content

Smart Garden

the lions gate sensors system architecture

Project Team

  • Cameron Calderwood
  • Dawid Pietruszka
  • Pangiotis Siokas
  • Tibor Toth
  • Kamil Wierzbicki
  • John Baxter

Modularisation of node firmware

Tibor Toth

Official T-Beam repository on Github.

T-Beam Pinout diagram T-Beam Pinout diagram

  • Analog sensors have to be connected to an ADC (Analog to Digital Conversion)
  • The T-Beam uses 18650 batteries
  • PIN 21 and 22 are used for SCL and SDA connections
  • PIN 23 is used by LoRa. If a sensor is connected to it, LoRa will break.
  • PIN 2 readings can result in weird outputs
  • On how to use the IDE used to write code for T-Beam, refer to the PlatformIO_getting_started.docx
  • The T-Beam goes into light sleep every 2 minutes. The interval can be changed by editing the secondsToSleep variable.


DS18B20 The DS18B20 is a waterproof thermometer. It uses the OneWire library and requires a 4.7k – 5.1k Ohm resistor. In the current version of the hardware, the thermometer is connected to PIN0, GND and 5V. Tutorial Diagram for 1 and for multiple sensors:

Waterproof thermometer Waterproof thermometer

Waterproof thermometer Waterproof thermometer

The main.cpp program uses the header_DS18B20.h header file, which contains the needed libraries (OneWire and DallasTemperature), functions and configuration for the sensor to work. When multiple temperature sensors are connected on the same pin, the individual readings are recognized by the index of the sensor, e.g. float tempC = sensors.getTempCByIndex(0);. If there is a reading available on the pin and the index, it means that there are sensors ready.

SEN0114 and MQ7 The SEN0114 is an analog soil moisture sensor. This moisture sensor can read the amount of moisture present in the soil surrounding it. It is a low-tech sensor, but ideal for monitoring an urban garden, or your pet plant's water level. The datasheet is available here. The main.cpp program uses the header_SEN0114.h header file, which contains the needed libraries, functions, and configuration for the sensor to work. If the sensor is not connected on the PIN it will read 4095.

The MQ7 is an analog CO-level sensor. Instructions on how to use the sensor are available here. The sensor is connected to PIN 15 on the T-Beam. The main.cpp program uses the header_MQ7.h header file, which contains the needed libraries, functions, and configuration for the sensor to work. If the sensor is not connected on the PIN it will read 2147483647. A third-party library is used to calculate the exact readings. MQ7.h and MQ7.cpp files are available in the src folder.

Soil sensor Soil sensor

Battery The 18650 battery powers the T-Beam when it is not connected via cable to a power outlet. To read the battery voltage all the needed functions and libraries are available in the header_battery_AXP20X.h file. It requires a library, called AXP20X and a function to calculate the voltage. It is important to initialize the battery using the init_Battery() function.

I2C sensors There are 3 sensors available currently that can use this protocol, the HTU21D, BME280 and the TSL2591. All 3 of these sensors connect using the SDA and SCL connections (PIN 21 and 22). They have their own header files, with their libraries. To decide whether the sensor is available each them have an init function to determine availability.

  • init_BME280() -> bme.begin(0x76)
  • init_HTU21D() -> htu.begin()
  • init_TSL2591() -> tsl.begin()

I2C sensor I2C sensor

SEN-15901 Weather Station The weather station is capable of measuring wind speed, wind direction and rain fall. These sensors contain no active electronics, instead using sealed magnetic reed switches and magnets to take measurements. A voltage must be supplied to each instrument to produce an output. The datasheet for it is available here.

A useful GitHub repository and a YT video explaining the connections and code.

The given code works perfectly using an Arduino Uno (1 analog PIN for wind direction, 1-1 digital for wind speed and rain bucket).

Currently only the sensors connected by a digital pin work, when using the T-Beam.

Arduino/ Bread board Arduino/ Bread board