Node-RED control a heater

JINGXI GUO
Mar 18, 2021

--

I design a flow chart using the temperature to control the heater on/off. The temperature coming from a DHT-22 sensor connecting to the internet through the MQTT protocol.

The Node-Red connect to the MQTT broker first, and then the temperature data will be formatted by a function node before logged into the mqtt.log file.

Code in the format log message node.

Another function node is sending MQTT topic to control a heater in the same room, (the heater is not existing in the physical world yet).

Code in Heater Control Node

The new topic will send to the MQTT broker through the MQTT out node and return to this flowchart by the “heater” input node and logging in to the log file.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response