Blog

Cellular Automated Hydroponics System with Blues& Qubitro - Hackster.io

Add the following snippet to your HTML:

The objective of this project is to develop an Automated Hydroponics system that integrates cellular IoT. Turbine Flowmeter

Cellular Automated Hydroponics System with Blues& Qubitro - Hackster.io

Read up about this project on

The objective of this project is to develop an Automated Hydroponics system that integrates cellular IoT.

An IoT-based hydroponics system is a smart approach to cultivating plants without soil. It relies on sensors and actuators connected to the internet to control water and nutrient delivery. Hydroponics, as an agricultural method, offers numerous advantages, including water conservation, space efficiency, resource optimization, increased crop yield and quality, and a reduction in pests and diseases. Through the use of IoT devices, farmers can remotely monitor and manage their hydroponic farms. They leverage data and analytics to fine-tune the growth environment and automate irrigation and nutrient distribution.

This project will show you how to build a Cellular Controlled Automated Hydroponics system with Blues and Qubitro.

Here is the flow diagram of my hydroponics system.

In this automated hydroponics system, I have employed three distinct controllers for the control system, with one dedicated to the user backend system.

The first controller in use is the Arduino Edge Control hardware. The Edge Control device is designed for monitoring and managing various elements of outdoor environments, including agriculture, irrigation, weather conditions, and more.

It can collect sensor data and send it to the cloud or use artificial intelligence on the edge to make decisions. It can also control actuators like valves, relays, pumps, etc. The Edge Control has built-in Bluetooth and can be connected to other wireless networks by adding Arduino MKR boards. It is powered by a battery that can be recharged by a solar panel or a DC input.

In this hydroponics setup, all of my analog sensors, including those for soil moisture, pH levels, water turbidity, and the water pump, are connected to the Edge Control. For the continuous operation of the hydroponics system, a miniature water pump is required. To ensure an uninterrupted power supply, I have directly connected the water pump to the 5V output of the Edge Control. Consequently, all analog sensor readings are transmitted to the LattePanda 3 Delta via UART.

The next big brain of this hydroponics system is the LattePanda 3 Delta.

The LattePanda 3 Delta is a single-board computer powered by an Intel Celeron N5105 processor, featuring 8GB of RAM and 64GB of eMMC storage. It's a versatile platform capable of running Windows 10, Windows 11, or various Linux operating systems. Additionally, it boasts an integrated Arduino Leonardo co-processor, enabling seamless interaction with sensors and actuators. The LattePanda 3 Delta supports a range of connectivity options, including Wi-Fi 6, Bluetooth 5.2, Gigabit Ethernet, USB 3.2 Gen2, HDMI 2.0b, and DisplayPort.

It comes equipped with an inbuilt Arduino core, which facilitates the connection of the Edge Control to the LattePanda via the Arduino core's UART port. We'll interface digital sensors like the water flow meter and digital temperature sensor, as well as ultrasonic and light sensors, directly with the LattePanda.

All collected data will be locally displayed on the DFRobot's 8.9-inch IPS display, providing real-time insight into the system's status.

Then the LattePanda 3 Delta will collect all the sensor data and will transmit all the data to Blues Notehub via Cellular Notecard.

Next, we can use the Blues Notecard. The Blues Notecard is a compact, energy-efficient, and cost-effective cellular modem designed to connect any device to the internet via cellular networks. Accompanying it is the Blues Notecarrier, a carrier board that offers various power and connectivity options for the Notecard, including USB, battery, solar, and GPIO. Together, they constitute a comprehensive IoT solution, empowering developers to effortlessly and securely transmit data from sensors and devices to the cloud.

Utilizing Blues Notecard and Notecarrier offers numerous advantages:

To establish connectivity, the Notecard can be linked to the LattePanda 3 Delta via a USB port. This enables the transmission of sensor data to the Blues Notehub through the Python client. Blues provides a note-pythonlibrary, streamlining communication with the Notehub via Python.

The next phase is to integrate a live camera that can capture plant growth and send image data via cellular IoT. For this process, I have used Xiao ESP32 Sense.

The Seeed Studio XIAO ESP32S3 Sense is a compact development board that seamlessly integrates embedded machine learning and photography capabilities. This versatile board features a camera sensor, a digital microphone, and an SD card slot, making it a powerful tool for various applications. It also offers support for Wi-Fi and Bluetooth wireless communication. By deploying a webcam script on the Xiao ESP32 S3 Sense and utilizing a Python script, we can effortlessly capture images and transmit them to the cloud via the Blues Notecard.

Now, let's tackle the next step - keeping an eye on the environment around our setup. It might seem like a bit of a headache, especially with all the sensors I've already hooked up. But guess what? I stumbled upon a pretty cool solution: the Thingy:91. It's got its own set of environmental sensors built right in. With the Thingy:91, I can send the environmental data over to the LattePanda 3 Delta, making the monitoring job simpler.

All the data from the Blues Notecard will be captured via Blues Notehub. Blues Notehub is a cloud service that helps you connect, manage, and analyze data from your Notecard devices. Notecard is a small, low-power, and low-cost cellular modem that can send data from any sensor or device to the internet.

Blues Notehub acts as a secure proxy that communicates with the Notecard devices and routes their data to your cloud application of choice. It also provides tooling for managing fleets of devices, performing over-the-air firmware updates, setting environment variables, and configuring alerts and actions. You can access Blues Notehub through a web-based dashboard or a RESTful API.

Finally, we will use the Qubitro cloud platform to visualize our hydroponics system’s data.

Qubitro is a platform that helps you connect, manage, and analyze data from your IoT devices. It is designed to make IoT development easy and accessible for everyone. Here are some features and benefits of Qubitro:

Qubitro is used by companies of all sizes and industries, such as smart agriculture, smart city, smart home, smart health, and more. Qubitro aims to democratize IoT development and make it possible for anyone to create IoT applications.

The final part is constructing an image from the Qubitro’s payload. For that, I have used UNIHIKER.

UNIHIKER is a tiny development board that combines embedded machine learning and photography capabilities. It has a camera sensor, a digital microphone, and an SD card slot. It also supports Wi-Fi and Bluetooth wireless communication. You can program UNIHIKER using a browser or various IDEs. You can also control UNIHIKER’s built-in sensors and hundreds of connected sensors and actuators using Python. UNIHIKER has a built-in SIoT service that allows you to store and access data on the device itself. UNIHIKER offers an innovative development experience for learning, coding, and creating.

By using this UNIHIKER, we can capture the live payload from Qubitro using Python and then we can construct the image data.

Edge Control offers a range of features, including analog inputs and latch I/Os. Additionally, it provides relay outputs. Currently, we won't be utilizing latching units, such as valves and solid-state relays. However, it's worth noting that as the project scales up in the future, you might require the ability to control valves and solid-state relays

I have successfully integrated Edge Control into my automated hydroponics system. In this setup, a continuous-running motor circulates water throughout the system. Consequently, there's no need to incorporate additional valves or relays. Instead, I directly connected a mini water pump to the 5V supply of the Edge Control unit. To power the Edge Control, a 12V DC power supply is required.

You can directly connect the solar panel or DC power supply to the +ve and the -ve terminals of the Edge Control.

Then I used 4 (1, 2, 3 and 4) watermark inputs to connect my soil moisture, turbidity, and PH sensor.

Once we have collected all 4-sensor data, we can construct a JSON with that.

Then we can transfer the data to the LattePanda 3 Delta via the serial port. For that, we are going to utilize one of the MKR (MKR2) slots in Edge Control.

Once we enable the MKR2 slot we can transmit the data via that MKR2’s UART terminal.

The MKR2 to LattePanda 3 Delta connection.

Here is the final Arduino IDE serial monitor output.

The LattePanda 3 Delta is a powerful single-board computer, capable of running Windows 10 while featuring an internal Arduino core. This Arduino core is built upon the Arduino Leonardo ATMEGA32U4 microcontroller, offering users the ability to program and manage an array of sensors and actuators using the familiar Arduino IDE. Notably, the LattePanda 3 Delta includes a dedicated pin header designed to seamlessly accommodate most Arduino shields and modules. Users can conveniently interface with the Arduino core via the USB or serial port of the LattePanda 3 Delta.

Considering that Edge Control exclusively offers analog input units, we have chosen to leverage the capabilities of the LattePanda 3 Delta to connect our digital sensors. These sensors include the Dallas waterproof temperature sensor, water flow sensor, light sensor, and ultrasonic sensors.

Since we have already connected our Edge Controller to the LatteaPanda3 Delta we need to decode the Edge Control data. Use the Arduino snippet below to decode the input JSON.

Once we decode the input JSON, we need to connect the water flow sensors to digital pin7, the Light sensor to analog pin a0, and the Dallas temperature sensors to digital pins 6 and 7 of the LattePanda 3 Delta. Connect all the power pins to +5 and GND pins to the GND of the LattePanda 3 delta.

Here is the complete Arduino sketch.

And here is the final serial monitor result which collects all the data from the Edge Controller and the sensors. Then it will print it in a serial console.

In order to monitor the data locally, I have used a DFRobots 8.5-inch IPS Touch Screen Display. To use this display, you need to connect it via the HDMI port.

The final hardware setup before the cultivation:

Thingy:91 is one of the best products from Nordic Semiconductor. It features internal environmental sensors. We are going to use that feature to monitor our control systems via this Thingy:91. First, install the nRF development environment with VS Code. Follow the instructions and set up the environment.

Once you are done with the installation, open the VS Code via nRF connect.

Then click on Create New Application and open the BME860 sample Zephyr.

Next, build the project for Thingy:91.

Once you finish the build, navigate to the project root folder and navigate to the zephyr folder, then copy the app_signed.hex file.

Next, open the nRF programmer and connect the Thingty:91(Press the boot button while connecting)

Then, add the hex file that we copied from the build.

and wait for the writing to finish.

Next, open any serial monitor software and select the Thingy:91 device with a baud rate of 115200.

Now we should have all our Thingy:91’s environmental data. We can decode this data via Python. Note: You can view the hex file in the GitHub repo.

We are going to use the Xiao ESP32 S3 Sense to capture live images from our hydroponics system over Wi-Fi and then they will be saved in the LattePanda 3 Delta using Python script. You can refer to the following documentation to learn more about the Xiao ESP32S3 Sense.

Below is the sketch that helps you to transmit the live video footage via the local Wi-Fi network. Navigate to the Xiao ESP32 S3’s default examples and open the Camerawebserver example code.

Select the camera model as Xiao ESP32 S3.

Change the WiFi credentials. Next, upload the code to the Xiao ESP32 S3 Sense.

Look for the serial monitor output. It will show you the local IP address.

Open that IP address in the browser. You should see the following control panel.

Set the desired resolution and then stop the streaming. Add the following port [ :81/stream ] in the camera web server URL. It will directly show you the live feed without the control panel.

Now we can use opencv to capture and save the image in LattePanda 3 Delta.

In this Python script, we have four main parts. Part 1 will capture the serial monitor results from the LattePanda’s Arduino core which already has the Edge Controle’s data. For that, we are going to use the `pyserial` library.

Part 2 captures the Thingy:91 live environmental data via the serial port. Part 3 captures and saves the image data from Xiao ESP32 S3 Sense. And Part 4 transmits all of the data to Blues Notehub via the Blues Notecard.

Let’s see each part individually:

Part 1: LattePanda Arduino Core to PySerial.

We have used LattePanda 3 Delta’s Arduino Core 2 to read our sensor data. Now we need to capture the serial port data and transfer it to Notehub. To do that, we can use this Python code snippet to get and decode the data.

Part 2: Thingy:91 data to PySerial

Like the previous section, we will capture the serial port data and construct the JSON. Then add it to the payload.

Here are the terminal results from the Python script.

Part 3: Xiao ESP32 S3 Sense Image to Base64.

In this part, we are going to capture the live video feed from the Xiao Esp32 S3 Sense. Using opencv we are going to capture and save the image then the captured image will be converted into a Base64 string via Python.

Here is the terminal result from the Python script.

Note: Before going to part 4, we need to create a new project with Blues Notehub.

Navigate to the Blues Notehub and create a new project. Then copy the product UID, which we will use in Part 4,

Part 4: Python to Blues Notehub communication.

In this final part, all the captured data will be compressed into JSON data and those JSONs will be forwarded to the Blues Notehub. Change the product UID that you copied from the Notehub.

Here is a simple Arduino sketch to transfer the binary payload.

Follow this guide to learn how to send large binary payloads to Notehub. Sending and Receiving Large Binary Objects - Blues Developers

In my case, my payload size is limited, so I can work directly with my Python script to send the binary payload.

Run the complete Python script.

Next, open the Blues Notehub project page. You can see all our data in Notehub. The first payload is my base64 image data and the next payload is my sensor data.

Once the data reaches Notehub we are going to use Qubitro to visualize and make an alert function based on the received data.

Qubitro simplifies the IoT development process by providing tools, services, and infrastructure that enable users to connect their devices, store and visualize their data, and build robust applications without coding. Qubitro supports various IoT protocols and platforms, such as LoRaWAN, MQTT, and The Things Stack.

Navigate to the Qubitro Portal and create a new project.

Then, select MQTT as the data source.

Next, enter all the input details as needed.

Then, open the created MQTT source and select the connection details. It will show you all the credentials. We need these credentials to transfer our data to Qubitro.

Let’s move on to the Blues Notehub’s route page. Here, we have to create a new MQTT route and change the username and password according to your Qubitro credentials.

At the bottom, define which data should move to Qubitro.

After the payload successfully transfers to Qubitro, open the Qubitro portal to monitor the incoming data.

To create a dashboard, navigate to the Qubitro portal click on the device that you want to use for the dashboard, and then click on the Data tab. You should see a table with the data that the device is sending, such as topic, payload, timestamp, etc.

Now go to the Dashboards section and click on the Create Dashboard button. You will be asked to enter a name and a description for your dashboard. For this example, we will name it "Cellular Hydroponics" and enter the description. Then click on the Create button.

You will be taken to the dashboard editor, where you can add widgets to display your data. A widget is a graphical element that shows a specific type of data, such as a chart, a gauge, a table, etc.

To add a widget, click on the Add Widget button and select the type of widget that you want to use.

For this example, we will use two-line charts: one for Moisture 1 and one for Moisture 2.

After selecting the widget type, you will see a configuration panel where you can customize the widget settings, such as title, size, color, data source, etc. For the temperature chart, we will set the title to "Mositure1", the size to "Mositure2", and the color to "Red".

Finally, we will click on the Save button. Now, we can repeat the same process for all our data. We can drag and drop them to arrange them as we like.

The last step is to save our dashboard by clicking on the Save Dashboard button. We can also preview our dashboard by clicking on the Preview Dashboard button. We should see our dashboard with live data from our device.

To reconstruct the image from base64 data, we are going to use UNIHIKER with a Python script, and it will automatically show the live image payload from the Qubitro cloud. First, change the Qubitro credentials in the Python sketch below and run the script in UNIHIKER.

It will get the base64 and construct the image and it will show.

This project aimed to design and implement a smart hydroponics system that uses cellular IoT technology to monitor and control the growth of plants. The system consisted of a microcontroller, sensors, a cellular module, and a cloud platform. The system was able to measure the temperature, humidity, pH, and water level of the hydroponic solution. The system also provided real-time data visualization and remote control via a web application.

The project demonstrated the feasibility and benefits of using cellular IoT for smart agriculture applications. The project also identified some challenges and limitations of the current technology, such as power consumption, network coverage, and security issues. It suggested some improvements and future work, such as integrating solar panels, adding more sensors and actuators, and implementing encryption and authentication mechanisms.

Cellular Automated Hydroponics System with Blues& Qubitro - Hackster.io

Turbine Flowmeter Hackster.io, an Avnet Community © 2023