Smart Garden – When DFRobot meets HomeAssistant (Part 1)

0 45604 Medium

Part2: Link Part3: Link

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.

projectImage

pic 1

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.

projectImage

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.

projectImage

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.

projectImage
projectImage
STEP 1

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.

CODE
$ sudo docker run hello-world
STEP 2

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.


Option 1,

Now we have already installed the docker.

Then we use the following command to pull the home assistant image.

CODE
$ sudo docker pull homeassistant/home-assistant
projectImage

Enter the command to check if the image is pulled correctly.

CODE
$ sudo docker images -a
projectImage

Then create a container base on the HA image by the following command. Change the configuration directory accordingly.

/YOUR _PATH:/config

CODE
$ 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
projectImage

Check the container status,

CODE
$ sudo docker ps -a
projectImage

Start the HA service and test.

CODE
$ sudo docker start home-assistant
projectImage

Test on LattePanda

Open a browser and enter

localhost:8123


Test on other devices in local network,

Open a browser and enter

IP address:8123


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.

projectImage
projectImage

OK, now we have initialized the home assistant. This is how it looks like.

projectImage

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. 


File Download:

https://github.com/xuegangxiao0117/smart_garden_for_exhibition

License
All Rights
Reserved
licensBg
0