Difference between revisions of "Temperature monitoring with Dallas DS18B20 sensors and Domoticz"

From CommonsLab
Jump to navigation Jump to search
(20m test successful.)
(→‎Sensor Pinouts: Add ADC and I2C pins)
 
(5 intermediate revisions by the same user not shown)
Line 5: Line 5:
  
 
=== Sensor Pinouts ===
 
=== Sensor Pinouts ===
 +
[[File:Rj45plug-8p8c.png|200px|thumbnail|right|Pin numbers on an 8P8C (RJ54) plug.]]
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 14: Line 15:
 
|-
 
|-
 
! Pin 1
 
! Pin 1
| [[Image:Wire white orange stripe.svg|60px|Pair 2 Tip]]<br/> White/orange&nbsp;stripe
+
| [[File:Wire white orange stripe.svg|60px|Pair 2 Tip]]<br/> White/orange&nbsp;stripe
 
| Rx + ||  
 
| Rx + ||  
| not connected
+
| NC (I2C SCL)
 
|  
 
|  
 
|-
 
|-
 
! Pin 2
 
! Pin 2
| [[Image:Wire orange.svg|60px|Pair 2 Ring]]<br/> Orange solid
+
| [[File:Wire orange.svg|60px|Pair 2 Ring]]<br/> Orange solid
 
| Rx − ||
 
| Rx − ||
| not connected
+
| NC (Analog)
 +
|
 
|-
 
|-
 
! Pin 3
 
! Pin 3
| [[Image:Wire white green stripe.svg|60px|Pair 3 Tip]]<br/> White/green&nbsp;stripe
+
| [[File:Wire white green stripe.svg|60px|Pair 3 Tip]]<br/> White/green&nbsp;stripe
 
| Tx + ||
 
| Tx + ||
| DATA
+
| DATA (I2C SDA)
| [[Image:Wire white.svg|60px]]<br/> White
+
| [[File:Wire white.svg|60px]]<br/> White
 
|-
 
|-
 
! Pin 4
 
! Pin 4
| [[Image:Wire blue.svg|60px|Pair 1 Ring]]<br/> Blue solid
+
| [[File:Wire blue.svg|60px|Pair 1 Ring]]<br/> Blue solid
 
|  || DC +
 
|  || DC +
 
| +3.3V
 
| +3.3V
| [[Image:Wire red.svg|60px]]<br/> Red
+
| [[File:Wire red.svg|60px]]<br/> Red
 
|-
 
|-
 
! Pin 5
 
! Pin 5
| [[Image:Wire white blue stripe.svg|60px|Pair 1 Tip]]<br/> White/blue&nbsp;stripe
+
| [[File:Wire white blue stripe.svg|60px|Pair 1 Tip]]<br/> White/blue&nbsp;stripe
 
| || DC +
 
| || DC +
 
| +3.3V
 
| +3.3V
| [[Image:Wire red.svg|60px]]<br/> Red
+
| [[File:Wire red.svg|60px]]<br/> Red
 
|-
 
|-
 
! Pin 6
 
! Pin 6
| [[Image:Wire green.svg|60px|Pair 3 Ring]]<br/>Green solid
+
| [[File:Wire green.svg|60px|Pair 3 Ring]]<br/>Green solid
 
| Tx − ||
 
| Tx − ||
 
| GND (- for data)
 
| GND (- for data)
| [[Image:Wire black.svg|60px]]<br/> Black
+
| [[File:Wire black.svg|60px]]<br/> Black
 
|-
 
|-
 
! Pin 7
 
! Pin 7
| [[Image:Wire white brown stripe.svg|60px|Pair 4 Tip]]<br/> White/brown&nbsp;stripe
+
| [[File:Wire white brown stripe.svg|60px|Pair 4 Tip]]<br/> White/brown&nbsp;stripe
 
| || DC −
 
| || DC −
 
| DC - (for power)
 
| DC - (for power)
| [[Image:Wire black.svg|60px]]<br/> Black
+
| [[File:Wire black.svg|60px]]<br/> Black
 
|-
 
|-
 
! Pin 8
 
! Pin 8
| [[Image:Wire brown.svg|60px|Pair 4 Ring]]<br/> Brown solid
+
| [[File:Wire brown.svg|60px|Pair 4 Ring]]<br/> Brown solid
 
| || DC −
 
| || DC −
 
| DC - (for power)
 
| DC - (for power)
| [[Image:Wire black.svg|60px]]<br/> Black
+
| [[File:Wire black.svg|60px]]<br/> Black
 
|}
 
|}
  
Line 73: Line 75:
 
! Pin 2
 
! Pin 2
 
| not connected
 
| not connected
 +
|
 
|-
 
|-
 
! Pin 3
 
! Pin 3
 
| Vdd (+3.0V — +5.5V)
 
| Vdd (+3.0V — +5.5V)
| [[Image:Wire red.svg|60px|Pair 2 Ring]] Red
+
| [[Image:Wire red.svg|60px]] Red
 
|-
 
|-
 
! Pin 4
 
! Pin 4
 
| GND (-)
 
| GND (-)
| [[Image:Wire black.svg|60px|Pair 2 Ring]] Black
+
| [[Image:Wire black.svg|60px]] Black
 
|-
 
|-
 
! Pin 5
 
! Pin 5
 
| DQ (DATA)
 
| DQ (DATA)
| [[Image:Wire white.svg|60px|Pair 2 Ring]] White
+
| [[Image:Wire white.svg|60px]] White
 
|-
 
|-
 
! Pin 6
 
! Pin 6
Line 92: Line 95:
 
|}
 
|}
  
 +
== Development Progress ==
 +
=== 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 [https://raw.githubusercontent.com/nodemcu/nodemcu-devkit-v1.0/master/Documents/NODEMCU%20DEVKIT%20V1.0%20PINMAP.png 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 ====
 +
[[Image:ESPeasy-DS18B20-flanged-20m-test.jpg|thumb|100px|right]]
 +
The first sensor with 20 meters CAT5e FTP (unshielded) cable and 8p8c (RJ54) connector and socket (for PCB) works, when connected to ESPeasy.
 +
 +
==== Production ====
 +
 +
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.
  
== Development Progress ==
+
 
The first sensor with 20 meters CAT5e FTP (unshielded) cable and 8p8c (RJ54) connector and socket (for PCB) works, when connected to ESPeasy:
+
=== Part 2: Valve control - 4 Sensors and 4 Relays per ESP ===
[[File:ESPeasy-DS18B20-flanged-20m-test.jpg|800px]]
+
 
 +
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.
 +
 
 +
==== 220V circuit ====
 +
[[File:Valve_controller_220V_circuit.png|thumb|100px|right]]
 +
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).

Latest revision as of 15:03, 11 October 2018


Sensors

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.

Sensor Pinouts

Pin numbers on an 8P8C (RJ54) plug.
Pin number T568B color 10/100 mode B,
DC on spares
RJ45 connector (8p8c) DS18B20
flange-cable color
Pin 1 Pair 2 Tip
White/orange stripe
Rx + NC (I2C SCL)
Pin 2 Pair 2 Ring
Orange solid
Rx − NC (Analog)
Pin 3 Pair 3 Tip
White/green stripe
Tx + DATA (I2C SDA) Wire white.svg
White
Pin 4 Pair 1 Ring
Blue solid
DC + +3.3V Wire red.svg
Red
Pin 5 Pair 1 Tip
White/blue stripe
DC + +3.3V Wire red.svg
Red
Pin 6 Pair 3 Ring
Green solid
Tx − GND (- for data) Wire black.svg
Black
Pin 7 Pair 4 Tip
White/brown stripe
DC − DC - (for power) Wire black.svg
Black
Pin 8 Pair 4 Ring
Brown solid
DC − DC - (for power) Wire black.svg
Black
Pin number RJ11 connector (6p4c) DS18B20
flange-cable color
Pin 1 empty (no contact)
Pin 2 not connected
Pin 3 Vdd (+3.0V — +5.5V) Wire red.svg Red
Pin 4 GND (-) Wire black.svg Black
Pin 5 DQ (DATA) Wire white.svg White
Pin 6 empty (no contact)

Development Progress

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

ESPeasy-DS18B20-flanged-20m-test.jpg

The first sensor with 20 meters CAT5e FTP (unshielded) cable and 8p8c (RJ54) connector and socket (for PCB) works, when connected to ESPeasy.

Production

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.

220V circuit

Valve controller 220V circuit.png

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).