In this project, I've developed an IoT device and an android app. The IoT device should be attached with tree and capable of measuring temperature, moisture level of the soil, weather information. And the android app can connect with the IoT device remotely with the help of Internet or locally using Bluetooth. Users can manually control the watering process by toggling a switch in the app or can set conditional watering based on the sensor values or timing.
The App connects with the IoT Device via Wi-Fi or Bluetooth
- It shows the temperature, moisture level data.
- It also shows weather forecast using Darksky.net API.
- It allows user to turn On or turn Off the water Pump attached to IoT device.
- User can set conditional watering based on the sensor value. For example when soil moisture level is less than a certain threshold or temperature is too high then it may automatically start the water pump.
The IoT Device consist of following things
- Esp-32 Node MCU
- Temperature sensor
- Soil Moisture sensor
- Water Pump
- Android Studio.
- Cloud Database (Firebase).
- Weather forecast API (darksky.net)
- Android Device.
- Arduino IDE.
- ESP-32 Node MCU.
- Soil Moisture Sensor.
- 5V DC Water Pump.
The application can be connected to the device in two ways:
- Local connection via Bluetooth.
- Remote connection via Internet.
In the first setup, after turning on the device, we need to open the application and select “Connect via Bluetooth”. After completing the bluetooth scan, we can see the available device. Then we need to select our desired device. After that we shall see the sensor information on screen. Here the location of the android device will be collected and saved into the IOT device. Now we need to provide the wifi credentials to the IOT device. After that the IOT device will be connected to the wifi. Then we need to set a password into the IOT device which will be needed in remote connection.
After the initial setup, the IOT device will be saved inside the app for easy connection in future.
If the IOT device is already set up and connected with the internet then we can connect to it from the application remotely via “Connect via Internet” option. Device id and password will be required while remote connection.
- Android app
- IOT device
If the app is connected via Bluetooth then it continuously keeps listening to the incoming data via bluetooth and display accordingly. Wifi credentials, remote access password, location, water pump triggering data over the bluetooth connection.
If the app is connected via the Internet then it continuously keeps listening to the cloud database for any changes and display accordingly. It also displays the weather forecast of that area where the tree was planted with the help of weather API. Water pump triggering data can be sent to the cloud database via the internet connection.
The working principle of the IoT device is explained in the following flow chart.