Creating flow for DS18B20 sensor and relays on RPI with Node-Red

I have tried and tried but do not get it, my knowledge is not enough at the moment. I would be very happy if someone could help me with a flow to control a heater using a DS18B20 sensor and two GPIO controlled relays. Relay number one must be activated for 1 second when the temperature drops to 18 degrees Celsius and activated again for 6 seconds when the temperature reaches 24 degrees Celsius. The second relay should be activated for 1 second for every 4 degrees the temperature increases from 0 degrees Celsius and upwards. Is there anyone on this forum who has the time to help me with this?

Can you explain what the overall purpose is please? It seems a very odd requirement.

Hi, welcome to the forum.

Use a trigger node for this. Send a true or 1 then 1 second later send a false or 0 (read the built in help for GPIO - i forget if its true/false or 1/0)

Use a switch node for this.

For this, you will need to store the value and test against a remembered value. For this, read up on context.


As a new user, I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Hi Colin
This is to be able to control the temperature of a Chinese heater that otherwise works with a timer and no thermostat

Have you looked at node-red-contrib-pid in conjunction with node-red-contrib-timeprop? I am the author of those nodes. One of its prime uses is for the control of heaters to maintain a temperature.