W5100S-EVB-Pico & DHT11: Real-time data transmission

Forwarding: W5100S-EVB-Pico & amp; DHT11: Real-time Data Transmission

Project Introduction

0. Introduction

This is a tutorial on how to send temperature and humidity data to the Beebotte cloud using a DHT11 sensor with a w5100s-evb-pico board. The tutorial covers importing the necessary libraries, setting the pin number for the DHT11 sensor, and updating the token value for the Beebotte cloud connection. The real-time temperature and humidity data sent by the w5100s-evb-pico development board can be monitored on the dashboard.

1. Hardware

1.1. Required components

  • W5100S-EVB-Pico
  • DHT11
  • Breadboard
  • ethernet cable
  • usb cable

1.2. Hardware wiring

Connect W5100S-EVB-Pico and DHT11 humidity and temperature sensor. Connect the pins as follows. In this example we are connecting the GP22 pin on the board to the data pin on the sensor, but you can use other GPIO pins as well.

W5100S-EVB-Pico | DHT11

3.3V | VCC

GND | GND

GP22 | DATA

After connecting the power and ethernet cables to the board it should look like the picture below.

2. Cloud Settings

2.1. Create a channel

Visit Beebotte Cloud, log in and create a channel. Add a sensor resource under the channel. Register temperature and humidity as numeric types.

Once the channel is created, tokens will be issued. You can use this token to send data to the cloud.

2.2. Create a dashboard

Go to the Dashboard menu, create a new dashboard, and select the Basic Values widget and the Timeline Chart widget. Add a resource from the created channel by selecting the resource and add the widget to the dashboard.

3. Arduino IDE

3.1. Configure the Arduino integrated development environment

Install Arduino IDE on Arduino IDE to use W5100S-EVB-PICO development board.

3.1.1. Add Kanban Manager URL

Go to File – Preferences in Arduino IDE and add the following link to Add-on Board Manager URLS.

https://github.com/WIZnet-ArduinoEthernet/arduino-pico/releases/download/global/package_rp2040-ethernet_index.json

3.1.2. Add Board Manager

Go to Board Manager search for PICO and install Raspberry PI PICO/RP2040 Ethernet via Wiznet.

Enter Tools-Board, you can see that Raspberry PI PICO/RP2040 Ethernet has been added. Now you can use W5100S-EVB-PICO on Arduino IDE.

3.1.3. Installing the library

You need to install 3 libraries. Go to the library manager in the Arduino IDE and install the following:

  • PubSubClient – MQTT Arduino library
  • ArduinoJson – An elegant and efficient JSON library for embedded systems.
  • DHT – Arduino library for DHT11

4. Send data to Beebotte Cloud

4.1. Connecting to Ethernet

Connect the W5100S-EVB-Pico board to your computer using a USB 5-pin cable. Go to Tools – Ports in the Arduino IDE and select the appropriate port for your board.

4.2. Update data and publish

Updates the temperature and humidity data from the DHT11 sensor and publishes it to the Beebotte cloud.

The code is based on the sample files uploaded on beebotte’s github with some modifications. The full code I wrote is uploaded on github.

Import the necessary libraries, set the pin number for the DHT11 sensor, and update the Beebotte cloud connection’s token value with the value obtained earlier.

#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <DHT.h>

#define DHTPIN 22 // Pin which is connected to the DHT sensor.
#define DHTTYPE DHT11 // DHT 11

#define BBT "mqtt.beebotte.com" // Domain name of Beebotte MQTT service
#define TOKEN "token_xxxxxxxxxxxxxxxxxx" // Set your channel token here

#define CHANNEL "W5100SEVBPico" // Replace with your device name
#define TEMP_RESOURCE "temperature" // This is where we will store temperature
#define HUMID_RESOURCE "humidity" // This is where we will store humidity

#define WRITE true // indicate if published data should be persisted or not

// Initialize DHT sensor.
DHT dht(DHTPIN, DHTTYPE);//

//Enter a MAC address of your shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, xxx, xxx, xxx);
IPAddress myDns(xxx, xxx, xxx, xxx);
IPAddress gateway(xxx, xxx, xxx, xxx);
IPAddress subnet(xxx, xxx,, xxx, xxx);

EthernetClient ethClient;
PubSubClient client(ethClient);

The loop() function reads temperature and humidity data from the DHT11 sensor using the dht.readTemperature() and dht.readHumidity() functions. It then checks that the data is valid using the isnan() function. If the data is valid, it updates the data to the Beebotte cloud by posting a JSON payload containing temperature and humidity values. Data is also printed to the serial monitor for debugging purposes. The delay() function is used to add a 5 second delay between data updates.

void loop() {
  // Read data from DHT11 sensor
  float temp = dht. readTemperature();
  float humidity = dht. readHumidity();

  // Check if data is valid
  if (isnan(temp) || isnan(humid)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Update data to Beebotte cloud
  char payload[50];
  snprintf(payload, sizeof(payload), "{"temperature": %.2f, "humidity": %.2f}", temp, humid);
  client.publish(channelResource, payload);
  
  // Print data to Serial Monitor
  Serial. print("Temperature: ");
  Serial. print(temp);
  Serial.print("°C, Humidity: ");
  Serial. print(humid);
  Serial.println("%");

  // Delay for 5 seconds
  delay(5000);
}

5. Beebotte Dashboard monitoring data

After uploading the code to the W5100S-EVB-Pico development board, you can monitor real-time temperature and humidity data on the Beebotte Dashboard.

The basic value widget shows current temperature and humidity values, and the timeline chart widget shows historical data in a graphical format.

That’s it! You have successfully setup and configured the W5100S-EVB-Pico board with DHT11 sensor to send temperature and humidity data to the Beebotte cloud and monitor it on the dashboard.

I hope this tutorial helps you to use DHT11 sensor with W5100S-EVB-Pico board and send data to Beebotte cloud. If you have any questions or need further clarification, please feel free to ask!

The knowledge points of the article match the official knowledge files, and you can further learn relevant knowledge. Network skill treeKnowledge of transmission mediaPhysical layer overview 33183 people are studying systematically