IoT Hottub Temperature Controlled Power Switch

From munkjensen.net/wiki
Revision as of 11:26, 17 December 2021 by Admin (talk | contribs)

Shopping list

  1. Buy a TH16.
  2. Buy a temperature sensor that fits TH16 and your needs. I use the Sonoff DS18B20 waterproof temperature sensor.
  3. Buy a 3.3 volt USB to seriel adaptor

Documentation & inspiration pages

Configuration after flashing

You need to do a bit of configureing after your TH16 have been succesfullly flashed. I reccomend keeping the TH16 connected to you computer using the 3.3 volt USB to seriel adaptor untill you are certain it works as you intend. I reccomend this of two reasons.

  1. There is no need to connect it to the mains power before you actually want to use it. This way you are much safer from getting electrical shocks ;-)
  2. You can use PuttY to monitor the activities that your TH16 is performing including errors... and errors will most probably happen unless you are lucky like nobody else.



Rule Set 1

on sensorTemp#temperature do

        // Store current sensor temperature in a dummy variable
    TaskValueSet,varTemp,Dummy,[sensorTemp#temperature]

        // If temperature is above 37 OR the toggleSwitch state is 1
        // then set dummy Switch1 state to 1
    if [varTemp#lastValue]>=37 or [toggleSwitch#state]=1
       TaskValueSet,Switch1,state,1
    else
       TaskValueSet,Switch1,state,0
    endif

        // Set the relay and red LED state to the same state as dummy Switch1 state
    gpio,12,0[Switch1#state]
endon

https://hos.munkjensen.net/vildmarksbad.php