Simple temp control

This may have been answered but I have search and I'm probably not using the correct verbiage.
I want to control a valve, (open or close) depending on on actual temp and set temp.
I want to be able to set temp manually, or have presets for 14 days,
I'm using 1 wire temp sensors and I'm using coil relays to work the valves. Any assistance would be great thanks.

OK so what platform will you be running on - how do you intend to connect the 1 wire sensors and coil relays to Node red ?

Have a search for Peter Scargill blog - thermostat - you will get some good ideas to get started there


I'm using a raspberry pi, and node red dash board. I have seen several thermostats, but I think are way more complex then what I need. Just trying to find a way explanation on how to send a high or a low output to valve gpio when the temperature goes over its tolerance

node-red-contrib-ramp-thermostat is awesome for temperature control. even has a schedule..

You can do that easily by using a Switch node to split the flow based on whether the value is above or below the tolerance, and in the two paths set the GPIO high or low. However, consider the situation when the temperature is exactly on the threshold, because of noise in the sensor reading you might find that the value hops up and down around the threshold. For example it might be 21.0 then 21.1 and then back to 20.0 again. In that situation your valve will keep opening and closing. That is why it is common to use hysteresis to prevent such oscillations.

So I do take that in account.

One I use F not C

So my target temp is 68 degrees.

Ill have temp set to 68 but I want cooling to turn on at 68.5

Having a .5 degree tolerance will be good right?

That will depend on the accuracy of your temperature senor and how often you're reading it. 0.5 deg F is a pretty small amount and I'd be concerned that even relatively small air currents could cause that sort change over a short period of time.

What kind of sensor are you using, and how often is it being read?



Nov '18

For the profiles you could have a dropdown list of profiles to select from and make it so that it reverts to the default profile at the end of the day (or whatever). For manual temp have an Override switch and a temperature select (I use a drop down with 0.5 degree intervals for this, but you could use an up/down selector.

I may need to point out im still a novice with node red.

So im looking at his ramp thermostat.

I see it has profiles I could load for a desired temp.

That looks great since im using to control fermentation of my beer.

I need to be able to control from a dashboard ui.

Will it be simple to select profile in dashboard?

Also what if I want to override a temp profile?

The goal here is to be able to change temps when I need to while not at brewery.

But also be able to control via a profile .

The bigger issue I see is its done via time and days.

I brew at different times.

How can I set schedule to start when I hit start.

Then it can run a temp for 30 hours switch to cooer temp for 8 days(192 hours) then cool down to 38 degrees and hold till turned off.

It’s a little different to running temps in a house.




So read the temperature in - lets say you read it every 10 seconds - feed that into the SMooth node with say 12 samples - so it will average your readings over 2 minutes and that should take into consideration any small variations.

Once you have that happening - send it to a switch node

3 outputs

  1. Temperature to low - open the valve
  2. Temperature just right - leave the valve where it is
  3. Temperature too high - close the valve.

Obviously you will need some form of relay board/driver that you can attach to the RPi to take the GPIo output and scale up to the correct voltage for your valves.

Alternatively you could use a Sonoff device dependant on whether the valves are DC units or AC


1 Like

ok so im using one wire temp sensors.
lets start with how i get my temps.
ill paste the flow in here however the temp will not work because it has my input settings for temp sensor on my system.

[{"id":"91e83857.47b1e8","type":"tab","label":"FERMENTER ROOM","disabled":false,"info":""},{"id":"c39388b2.994e88","type":"ui_gauge","z":"91e83857.47b1e8","name":"WestF","group":"61bbb66b.804988","order":3,"width":4,"height":4,"gtype":"donut","title":"West Fermenter","label":"degrees","format":"{{value}}","min":0,"max":"85","colors":["#0006b3","#37f312","#cb3a3a"],"seg1":"","seg2":"","x":750,"y":200,"wires":[]},{"id":"3e1897b5.ef0f18","type":"debug","z":"91e83857.47b1e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":300,"wires":[]},{"id":"a0a362ba.af638","type":"ds18b20","z":"91e83857.47b1e8","name":"28-3c01d607aaaeast","sensorid":"28-3c01d607ecb7","timer":".05","x":310,"y":200,"wires":[["3e1897b5.ef0f18","8ecd9821.5d7718"]],"outputLabels":["f"]},{"id":"8ecd9821.5d7718","type":"unit-converter","z":"91e83857.47b1e8","category":"temperature","inputUnit":"C","outputUnit":"F","inputField":"payload","outputField":"payload","inputFieldType":"msg","outputFieldType":"msg","roundOutputField":true,"outputFieldDecimals":2,"name":"","x":540,"y":200,"wires":[["c39388b2.994e88"]]},{"id":"6988a5ab.cef6bc","type":"debug","z":"91e83857.47b1e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":500,"wires":[]},{"id":"bc206a2.1be2f98","type":"ds18b20","z":"91e83857.47b1e8","name":"28-3c01d607fd9dwest","sensorid":"28-3c01d607ecb7","timer":".05","x":310,"y":400,"wires":[["6988a5ab.cef6bc","309e34a6.78aedc"]],"outputLabels":["f"]},{"id":"309e34a6.78aedc","type":"unit-converter","z":"91e83857.47b1e8","category":"temperature","inputUnit":"C","outputUnit":"F","inputField":"payload","outputField":"payload","inputFieldType":"msg","outputFieldType":"msg","roundOutputField":true,"outputFieldDecimals":2,"name":"","x":540,"y":400,"wires":[["6b69d984.bea448"]]},{"id":"6b69d984.bea448","type":"ui_gauge","z":"91e83857.47b1e8","name":"EastF","group":"61bbb66b.804988","order":2,"width":4,"height":4,"gtype":"donut","title":"East Fermenter","label":"Degrees","format":"{{value}}","min":0,"max":"85","colors":["#3000b3","#00e682","#ca3838"],"seg1":"","seg2":"","x":750,"y":400,"wires":[]},{"id":"61bbb66b.804988","type":"ui_group","name":"FERMENTERS","tab":"a74ffe3d.4eb73","order":3,"disp":true,"width":9,"collapse":false},{"id":"a74ffe3d.4eb73","type":"ui_tab","name":"Brewery","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

i use the ds18b20 node to retrieve temperature sensor data.
i use unit-converter node to change to Fahrenheit. then i use ui_guage to display the temperature.
how do i connect that data to a thermastat node. so i can change. im ok right now just manually selecting something in dashboard. till i can fully understand how it all works, then i could evolve from there.
biggest part of doing is understanding.
biggest challenge is having the time to mess with it every day so i can learn. i still have to run a household and a business while im trying to evolve the bus.

1 Like

Yes I use a sansmart 8 channel relay with an optoisolator.

I need an active low to trigger the relay.

I need to run them 2 ways

Fermenters I need to open valve (close circuit) to let glycol run through jacket.

( for cooling the fermenter)

On thermostat I need it to actually close a circuit on a solid state relay so it can use 110v to trigger my contactor on a 3 phase heating element.

Bassiclly on the RPI an active low triggers the heating and or cooling .

I went this route to limit power from Rpi and to protect circuits.

OK so everything in Node Red is based on the concept of messages flowing around the system.

A message can be sent to multiple places - so in your case aftr you run through the unit converter node - you have a single link (as the moment) to the UI_Gauge

So what you want to do is put in a smooth node first before the UI_Gauge and use that to average out your readings and stop too much jumping around

From the smooth node you drag one link to the UI Gauge - then your drag another link from the smooth node to your control code - this will start off as a simple switch node as discussed before with 3 tests and then you move on.

You need to watch the videos from the developers of node red that are in the FAQ section as it will make a big difference to how you understand all of this


What you are trying to do is a control loop. I would recommend reading up on PID loops. There is a PID block available which I would look into ( node-red-contrib-pid). However, tuning a PID loop can be a challenge because of the many factors and variables. E.g. size of your fermenter, heating/cooling power just to name a few. There is a lot of material on loop control out there, good luck.

As @UdoUSA says, if you need better control than a simple on/off thermostat control then PID is the way to go. I am the author of node-red-contrib-pid and am happy to help with getting it going if necessary. If on/off control is good enough for you, however, then stick with that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.