Wiznet makers

Hannah

Published September 20, 2023 ©

33 UCC

5 WCC

1 VAR

0 Contests

0 Followers

0 Following

W5100S Weather-Based Playlist Recommendations

Created a project using a W5100S-EVB-PICO board with a DHT11 sensor to collect weather data. Utilized MQTT communication to recommend playlists based on weather

COMPONENTS Hardware components

WIZnet - W5100S-EVB-Pico

x 1


DFRobot - Gravity: DHT11 Temperature Humidity Sensor For Arduino

x 1


PROJECT DESCRIPTION

Created a project using a W5100S-EVB-PICO board with a DHT11 sensor to collect weather data. Utilized MQTT communication to recommend playlists based on weather conditions. Integrated YouTube Music API for playlist recommendations.

This project was done in collaboration with Theo from Wiznet. He handled the DHT11 sensor control, while I focused on MQTT communication control. I will provide an explanation focusing on the MQTT communication control aspects.

Get Started

I created the code based on the Wiznet GitHub example for the W5100S-EVB-PICO board, integrating it with MQTT. 

I used the YouTube Data API to recommend playlists based on weather conditions. When you input weather information into the following link, it retrieves recommended playlist data.

 

Connect the DHT11 temperature and humidity sensor to the pins configured on the W5100S Pico

 

Set the values of MQTT_CLIENT_ID, MQTT_USERNAME, MQTT_PASSWORD, MQTT_PUBLISH_TOPIC, and the MQTT broker IP in the variable g_mqtt_broker_ip.

/* Port */
#define PORT_MQTT 1883

/* MQTT */

#define MQTT_CLIENT_ID "rpi-pico"
#define MQTT_USERNAME "wiznet"
#define MQTT_PASSWORD "0123456789"
#define MQTT_PUBLISH_TOPIC "publish_topic"

static uint8_t g_mqtt_broker_ip[4] = {192, 168, 11, 229};

 

Create broker using Mosquitto by executing the following command. If the broker is created normally, the broker's IP is the current IP of your desktop or laptop, and the port is 1883 by default.

mosquitto -c mosquitto.conf -v

 

Install a mobile application that supports MQTT communication on your smartphone.

Enter the configured IP, client ID, username, and other settings, and then press 'Connect.'

 Subscribe to the specified topic to receive MQTT data for temperature and humidity as well as playlist recommendations.

 

Code

The entire code, including each basic code, can be referenced at the Github link below.

Documents
  • W5100S-MQTT-DHT11

Comments Write