Temperature monitoring with Dallas DS18B20 sensors and Domoticz
We use the DS18B20 sensors, pre-mounted into a waterproof flange from the BrewPi project. These have RJ11 (6P4C) connectors pre-crimped, which we replace with the more common RJ45 (8P8C) connectors and extend the cable with a standard CAT5e FTP (or STP) cable. The connections are similar to the the common T568B color coding and the follow the 802.3af (Power Over Ethernet / POE) with respect to the DC +/- colors.
|Pin number||RJ11 connector (6p4c)||DS18B20 |
|Pin 1||empty (no contact)|
|Pin 2||not connected|
|Pin 3||Vdd (+3.0V — +5.5V)||Red|
|Pin 4||GND (-)||Black|
|Pin 5||DQ (DATA)||White|
|Pin 6||empty (no contact)|
Part 1: Fixed installation - 8 temperature sensors per ESP
In this part, we want to attach as many DS18B20 on one ESP as possible, with the circumstance, that the sensors are up to 40 meters apart from each other.
GPIO pin assignement
The NodeMCU has it's own designation of pins for the ESP8266, just like the Arduino has for the ATmega328.
We use D0 - D7 as digital inputs for the 1-Wire connection to the DS18B20 temperature sensors. D8 can not be used for 1-Wire devices, because the 1-Wire bus needs a pull-up resistor and the D8 is GPIO15 on the ESP8266, which needs to be LOW at power-on or reset, otherwise the controller will not boot.
Cable length testing
The first sensor with 20 meters CAT5e FTP (unshielded) cable and 8p8c (RJ54) connector and socket (for PCB) works, when connected to ESPeasy.
The PCB was produced in the CNC. The parts were hand-soldered and covered with conformal coating (4 layers of acrylic spray). The PCB was installed in an outdoor rain-proof enclosure, together with a 5V/1A USB power supply.
Part 2: Valve control - 4 Sensors and 4 Relays per ESP
In this part, we need to monitor 4 temperatures and control two valves, which are operated with an electric motor. Each motor is operated by 220V and has an internal end-stop switch, which breaks the circuit at the correct motor/valve position, as well as returns the 220V on a feed-back contact to signal successful operation.
The electric motors can also be energized by manual override buttons, one to open and one to close each valve. The automatic control is done by one SSR (Solid State Relay), which is used for the state of the motor (ACTIVE/INACTIVE) and one electromechanical relay, which is used for the direction (OPEN/CLOSE).