Book A Demo Now

Smart indoor farming using Bytebeam SDK for Arduino: Analyzing CO2, Temperature, Humidity and Automated lighting systems

Smart indoor farming using Bytebeam SDK for Arduino: Analyzing CO2, Temperature, Humidity and Automated lighting systems


Temperature, CO2, humidity, and light intensity are all important environmental factors that can affect the growth and productivity of plants in an indoor farm. By monitoring and controlling these factors, farmers can create an optimal growing environment that maximizes crop yields and quality.

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:

  1. Setting up the Bytebeam cloud console: We will go through creating an account and setting up a new project on the Bytebeam cloud console.
  2. Setting Up ESP32: We will set up ESP 32 and integrate sensors with it.
  3. Setting up Bytebeam Arduino SDK: We will install the Bytebeam Arduino library from the Arduino library manager.
  4. Provisioning ESP32: We will provision ESP32 using provisioning JSON.
  5. 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.
  6. 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 Specifications
Hardware Specification

Software Specification


Setting Up Bytebeam Cloud

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, as 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.


Setting Up ESP32

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 connection

ESP32 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

Project Setup

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:

To download Bytebeam SDK for Arduino from the Arduino Library manager,

  • Open Arduino IDE and navigate to Sketch-> Include Library -> Manage Libraries
  • In the Library Manager Search for BytebeamArduino. Then click on Install to install the libraries.
  • In the next prompt click on Install All to install all the associated libraries.

Provision ESP32 with device config data

Earlier 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.


Getting Temperature, Humidity and CO2 values

Data Visualization in Bytebeam cloud

  • 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

Conclusion

I hope you gained valuable insights from this comparison summary. As we continue to come up with more interesting tutorials and maker content, we invite you to explore Bytebeam further and see how our platform can empower your projects.

Stay tuned!