06/10Electronics

Intelligent Garden

Protection against unwanted guests & control devices in garden.

  • smart garden
  • MQTT
  • microcontrollers
Intelligent Garden — preview

Idea

The idea for the smart garden actually came from a mundane reason. In the winter, my garden was broken into, so I decided to quickly create a simple alarm. However, as is often the case with my projects, it didn't end with just a basic security system.

In the garden, I installed colorful lights on the tree that create a fairytale atmosphere, with the main lighting attached to the gazebo (providing a beam of light in three directions) and additional lighting in the form of two lanterns. It was necessary to dig up half of the ground to hide the electrical wires in it.

The main assumption of the application was simplicity. The garden is used by elderly people who have trouble with technology.

Technology stack

09
  • Arduino
  • C++
  • Vue.js
  • JavaScript
  • Sass
  • MQTT
  • Eagle
  • GitLab
  • FreeBSD

The application, due to its multiple layers, had to be divided into: a central unit - located at the target site, a client application - for managing the state of the central unit, and an MQTT server - necessary for the communication between the previous two layers. The brain of the central unit is an 8-bit microcontroller from Atmel (ATMega328P). It is equipped with a GSM module essential for internet connection to the server, four 230V network relays, a siren that emits sound in case of detecting an unwanted guest, and a PIR sensor that detects moving differences in heat.

Detection of a break-in attempt

When the alarm detects a moving temperature difference within its range, the system activates all the lights in the garden one by one, then sends text messages to the numbers assigned as administrators in the controller, and emits sound through a 30W siren. The sound consists of a voice message and predefined tones. Then turns off and waits for further commands from the administrators.

Next release

The idea for the second version of the system is based on a 32-bit ESP32 microcontroller from Espressif. To automate the process of disabling the security system (disarming the alarm), the microcontroller operates as a WiFi Access Point to which devices from a whitelist connect. In this way, when approaching the garden gate, the alarm switches to sleep mode. This also allows for monitoring who is present in the garden area. Currently, the only option for controlling the devices is a client application on a phone. In the future, I plan to add a TFT touchscreen display that will enable control directly from the control panel. I am also considering installing cameras and live video streaming to the app.

Summary

In summary, as of today (i.e., the year 2025), the project has been running continuously for 2 years. The connection stability is very good. In a funny incident, one winter night the alarm went on exactly at 2:15 AM. The garden is 1.5 km away, so I quickly got dressed, jumped in the car, and a few minutes later I arrived on site. In the middle of the property sat a quite fat white cat. I had to raise the sensor a bit so that it wouldn't detect him anymore. Fortunately, the cat was friendly and there was no fight :)