Sending PSoC6’s sensor to MQTT (node-red)
Lab Objective:
Building upon the foundational knowledge acquired from the previous lab on MQTT communication via the Mosquitto broker and public key cryptography, participants will now explore the integration of the PSoC 6 microcontroller's sensor data with Node-RED. Through this lab, participants will learn how to set up and configure Node-RED flows to receive, process, and visualize sensor data from the PSoC 6, transmitted via MQTT. The end goal is to enhance participants' proficiency in creating IoT workflows, harnessing the power of MQTT for real-time data communication, and visualizing sensor outputs in an interactive environment using Node-RED.
🔥 Requirements
🚩 Let start
Use the previous lab

Config mqtt_client_config.h:
Open config >> mqtt_client_config.h.\

#define MQTT_PUB_TOPIC "PSoC6Status/temperature,pressure"
#define MQTT_SUB_TOPIC "PSoC6Status/led"

Open publisher_task.c in source.
Copy code from publiser_task.c and past in publisher_task.c

Add sensor-xensiv-dps3xx library

Save the file, Build and Launch the Application
Download and install Nodejs
Set-up node-red
Check node-red version

Run Node-Red by using node-red start

3. Open the Node-Red server: go to http://127.0.0.1:1880/

Import Button control LED PSoC6 nodes:
Go to Import
Copy and Past this json code to create the nodes
Go to Import

You will get this flow of nodes for Button control LED on PSoC6

Open the MQTT Subscriber node and set it up as:
Go to Server and click edit
Upload your client.crt
Upload your client.key
Upload your mosquito.org.crt


Open the MQTT Subscriber node and set it up as:
Topic >> set up as PSoC6Status/temperature,pressure
QoS >> set up as “1”
Result

🎉 Congratulations! You can now complete this lab
Supported toolchains (make variable 'TOOLCHAIN')
GNU Arm® embedded compiler v10.3.1 (
GCC_ARM
) - Default value ofTOOLCHAIN
Arm® compiler v6.16 (
ARM
)IAR C/C++ compiler v9.30.1 (
IAR
)
Supported kits (make variable 'TARGET')
PSoC™ 62S2 Wi-Fi Bluetooth® pioneer kit (
CY8CKIT-062S2-43012
)PSoC™ 62S1 Wi-Fi Bluetooth® pioneer kit (
CYW9P62S1-43438EVB-01
)PSoC™ 62S1 Wi-Fi Bluetooth® pioneer kit (
CYW9P62S1-43012EVB-01
)PSoC™ 62S3 Wi-Fi Bluetooth® prototyping kit (
CY8CPROTO-062S3-4343W
)
Related resources
ModusToolbox™ Software Training
Other resources
Infineon provides a wealth of data at www.infineon.com to help you select the right device, and quickly and effectively integrate it into your design.
Document history
1.0.0
Node-Red Read Sensor PSoC6 vai MQTT
Authors:
Assoc. Prof. Wiroon Sriborrirux
Mr. Sriengchhun Chheang
Mr. Sabol Socare
© BDH Corporation, 2022-2023
Last updated
Was this helpful?