Indoor farming is a very often talked about topic nowadays as it critically affects plant growth and productivity of plants.
Increasing demands for high-quality produce and limited availability of arable land has forced people to rethink agriculture practices. People are exploring new areas of agriculture like indoor farming, hydroponic and aeroponic.
In indoor farming, a farmer needs to maintain an artificial environment for plant growth which has led to advancements in technology in indoor farming.
There is some critical parameter that can affect the growth productivity of plants in an indoor farm like temperature, humidity, CO2 and light intensity. By monitoring and controlling these factors, farmers can create an optimal growing environment that maximizes crop yields and quality.
- Temperature: Different plants have different temperature requirements for optimal growth. Generally, most plants grow well in temperatures between 65°F to 80°F (18°C to 27°C).
- CO2: Carbon dioxide is essential for photosynthesis, the process by which plants produce energy from sunlight. Increasing CO2 levels can enhance plant growth and productivity.
- Humidity: Humidity levels affect plant growth and can impact the spread of pests and diseases. Too high humidity can cause mould and mildew, while too low humidity can dry the plants.
- Light intensity: Light is essential for photosynthesis, and plants require different amounts of light depending on their growth stage. Indoor farmers can use artificial lighting systems, such as LED or fluorescent lights, to provide the necessary light.
Keeping in mind all the factors affecting plant yield of plant in an indoor farm. we will be going through a step-by-step guide to creating an IoT solution for indoor farms to analyze temperature, Humidity and CO2 using Bytebeam Arduino SDK and Bytebeam Cloud. In this blog, we will be demonstrating the following:
- Setting up the Bytebeam cloud console: We will go through creating an account and setting up a new project on the Bytebeam cloud console.
- Setting Up ESP32: We will set up ESP 32 and integrate sensors with it.
- Setting up Bytebeam Arduino SDK: We will install the Bytebeam Arduino library from the Arduino library manager.
- Provisioning ESP32: We will provision ESP32 using provisioning JSON.
- Connecting an ESP32 to the Bytebeam platform: We will learn how to connect an ESP32 to the Bytebeam platform and how to send data from the device to the cloud.
- Data visualization on the Bytebeam cloud console: We will explore the data visualization tools by Bytebeam and learn how to view and analyze data from the connected Arduino device in real time.
So Let's get started.
Hardware and Software SpecificationsHardware Specification- ESP32
- SCD4x CO2 Sensor
- SHT31 Temperature and Humidity Sensor
- 2 Channel Relay.
- Bytebeam cloud platform account
- Arduino IDE
- Bytebeam Arduino SDK
- SHT31 Arduino Library
- SDC4x Arduino Library
- Indoor Farm Arduino application
Bytebeam is a fully managed cloud platform. Which serves all cloud needs from device management to dashboard, Handling actions and notification to OTA updates. It provides the following features
- Device Registry
- Over Air Updates
- Configuration Management
- Device to the mobile communication
- Web Dashboard
- Role-based Access controls
If you are new to the Bytebeam IoT cloud platform. Go through the getting started with bytebeam tutorial to deep dive into the concepts of Bytebeam. I hope you found the getting started guide useful and are aware of the concepts of Bytebeam Cloud.
- First, create a new device for that got to the Device Management panel and click on Create device
- As you hit submit in the prompt. A new JSON file will be downloaded which contains the authentication certificate, broker, device_id, and project id. You need to save this file in the ESP file system. We will talk about this in a later section.
- The JSON will look like this.
{
"project_id": "****",
"broker": "******",
"port": 8883,
"device_id": "**",
"authentication": {
"ca_certificate":*"*********",
"device_certificate": "**********",
"device_private_key": "***********"
}
}
- Next, we are using temperature, humidity and CO2 parameters. We need to configure the stream according to our project in the Bytebeam cloud console. For that go to Admin -> Streams and add temperature, humidity and co2in the column name with their respective data type.
This guide assumes that you are familiar with Arduino and had your ESP32 setup on Arduino IDE. The next steps will guide you through the project setup and hardware connection
Hardware connectionESP32 uses GPIO 21 and GPIO 22 pins for I2C. The SDA pin is connected to GPIO 21 and SCL pin is connected to GPIO 22.
- SCD41 CO2 sensor comes with I2C connection. Connect the SDA Pin of SCD41 with GPIO21 of ESP32 and the SCL Pin with GPIO 22 of ESP32.
- SHT31 Temperature and Humidity Sensor come with an I2C connection. Connect the SDA Pin of ESP32 with GPIO21 of ESP32 and the SCL Pin with GPIO 22 of ESP32.
- Connect 2 Channel 5V SSD Relay with GPIO 4 and GPIO 15
Firstly to get started with Bytebeam SDK for Arduino, you need to install the Bytebeam Arduino library. This can be downloaded from the Arduino library manager. To get more understanding of Bytebeam Arduino installation, setup and its features go through our 3-part tutorial series:
check out this guide to go through the next steps.
Provision ESP32 with device config dataEarlier in this guide, we had provisioned a new device in the bytebeam cloud console and downloaded a JSON file. We need to flash this file to the ESP32 file system called SPIFFS to connect our device to the cloud.
- To provision your ESP32 device, Open Arduino and navigate to File->Examples->BytebeamArduino->Provisioning->SPIFFSProvisioning. For the scope of this guide, we will do SPIFFS provisioning
- Now copy the content of your downloaded JSON and paste it into the code at deviceConfigWriteStr
- Now upload your example
- Next Open Arduino Serial Monitor
- In the Serial monitor, you can see that device has been successfully provisioned.
- After the Successful connection of ESP32 with Bytebeam cloud. We can see the recent device shadow and heartbeat on the cloud console.
- Now let’s create a dashboard to visualise our data. Follow the Data visualization Getting Started guide to create Dashboards and visualization of your choice.
- You can create your visualization in the form of charts, gauges, histograms, last values and many more
I hope you find this tutorial useful. We will come up with other interesting use cases using ByteBeam.Stay in touch to get information on many other interesting IoT projects.
Comments