Smart Garden – When DFRobot meets HomeAssistant (Part 1)
What if you could grow your plants in your garden and monitor their growing environment when you staying at home.
What if you could monitor your pond water and protect your fish in real-time.
What if you could make your garden smarter and it’s able to make changes itself when you are not home.
Thanks to DFRobot and HomeAssistant, we make them all become true. This smart garden application was also exhibited on the BETT show in the UK. We deployed a local server on the LattePanda Alpha, which’s in charge of the data transferring and provides the HTTP service that allows the users to access the real-time data and control.
pic 2 LattePanda
The acrylic board design was the same as one of our Environment Science Board for micro:bit except the size. To achieve the functions, we use the ESP32 FireBeetle microcontroller as the client, which has both WiFi and Bluetooth modules, to collect the information through various sensors and also perform some actions. All the devices were working under the same local network area.
pic 4 link: Environment Science Board for micro:bit (V1.0)
pick 5 link: FireBeetle ESP32 IoT Microcontroller (Supports Wi-Fi & Bluetooth)
In this project, we used many sensors to monitor the garden environment, such as temperature/humidity sensor, atmospheric pressure sensor, UV sensor, ambient light sensor, and capacitive Soil Moisture Sensor. There are also some waterproof sensors used in the pond, DS18B20 temperature sensor, and TDS sensor. And if you want, you can customize your own smart garden and also choose other water quality sensors as you want. DFRobot provides different types of water quality sensors, like electrical conductivity sensor, PH sensor, Oxidation-Reduction Potential sensor, etc.
LattePanda Alpha 864s (Win10 Pro activated)
FireBeetle ESP32 IOT Microcontroller (soldered with female header) x 2
FireBeetle Covers-Gravity I/O Expansion Shield x 2
Gravity BMP388 Barometric Pressure Sensors
Gravity: Analog UV Sensor (ML8511)
Gravity: Analog Capacitive Soil Moisture Sensor- Corrosion Resistant
Gravity: Analog Ambient Light Sensor For Arduino
Gravity: Analog TDS Sensor/Meter for Arduino
Gravity: Waterproof DS18B20 Sensor Kit
DHT22 Temperature & Humidity Sensor
Gravity: Analog Sound Sensor For Arduino
Gravity: Digital 5A Relay Module
Gravity: Digital LED String Lights (Warm White) For Arduino
Before we get started, please make sure that your LattePanda is installed with the ubuntu OS.
If you don’t know how to install the OS on your LattePanda please follow the instruction:
There are several ways to set up the configuration of Home Assistant. We use docker to do this, which would be much easier than other ways.
First, we install the docker on Ubuntu. The link below is the official documents for installing the docker on Ubuntu: https://docs.docker.com/engine/install/ubuntu/
Running the hello-world image to verify that if the docker is installed correctly.
$ sudo docker run hello-world
After installing the docker, then we can set up the Home Assistant. We have two options to do this.
Option 1, use docker to pull the official HA and configuration step by step.
Option 2, use docker to load the image from a tar archive, in which everything has been set up, just run it and use.
Now we have already installed the docker.
Then we use the following command to pull the home assistant image.
$ sudo docker pull homeassistant/home-assistant
Enter the command to check if the image is pulled correctly.
$ sudo docker images -a
Then create a container base on the HA image by the following command. Change the configuration directory accordingly.
$ sudo docker run --init -d --name="home-assistant" -e "TZ=America/New_York" -v /home/gangxiao/HA_stable:/config --net=host homeassistant/home-assistant:stable
Check the container status,
$ sudo docker ps -a
Start the HA service and test.
$ sudo docker start home-assistant
Test on LattePanda
Open a browser and enter
Test on other devices in local network,
Open a browser and enter
In this case, the IP address of LP is 192.168.9.6, you can use ifconfig to get the IP address. For the first time, you are required to create an account. Just follow the instructions to finish the initial setup.
OK, now we have initialized the home assistant. This is how it looks like.
But if you want to change the UI or add something, like sensor data, switch. You need to edit some configuration files. The configuration files are located in the repository you set previously. And we will talk about this in the next instruction. And we will provide an easier way to set this up.