Personal tools

Difference between revisions of "1-Wire Hub"

From PhotoVoltaic Logger new generation

Jump to: navigation, search
m (Build)
m (Normal mode)
 
(39 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Abstract ==
+
{{TOCright}}[[Category:1-Wire]][[Category:Hardware]]
 +
I monitor here 3 1-Wire DS18B20<ref>http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf</ref> based temperature sensors.
 +
 
 +
As I looked at commercial solutions and their prices, I decided to construct my own 1-Wire hub.
 +
 
 +
The DS18B20 temperature sensor can be powered by an external supply on the V<sub>DD</sub> pin, or it can operate in "parasite power" mode, which allows the DS18B20 to function without a local external supply<ref>http://openenergymonitor.org/emon/buildingblocks/DS18B20-temperature-sensing</ref>.
 +
 
 +
* In '''normal mode''', each sensor is connected between a power line (V<sub>DD</sub> pin 3) and ground (GND pin 1), and the data output (DQ pin 2) connects to a third, data, line. The data output is a 3-state or open-drain port (DQ pin 2) and a 4.7 kΩ pull-up resistor to the power line is required.
 +
* '''Parasite power mode''' requires both DS18B20 GND (pin 1) and V<sub>DD</sub> (pin 3) to be connected to ground. The DQ pin (pin 2 - the middle pin) is the data/parasite power line. The data line requires also a pull-up resistor of 4.7 kΩ connected to +5 V.
 +
 
 +
If you have long 1-Wire network runs and are having problems with glitches<ref>https://www.digitemp.com/documentation.shtml</ref> you should add a Schottky diode to the end of your network. Typically a 1N5817 diode reverse biased across sensors will achieve this. Solder the side with the stripe to data output (DQ pin 2) and the other side to ground (GND pin 1) of the DS18S20.
 +
 
 +
== Normal mode ==
 +
 
 +
Typical wiring looks like this.
 +
 
 +
 
 +
[[File:1-WireNormal.png]]
 +
 
 +
But Dallas recommends a long wire, so I adapted the wirng to this scheme.
  
I monitor here 3 1-Wire temperature sensors. ([http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf DS18B20 datasheet])
 
  
As I looked at commercial solutions and their prices, I decided to construct my own 1-Wire hub.
+
[[File:1-WireLong.png]]
 +
 
 +
Here are also the recommended resistor and diode included.
 +
 
 +
And here comes the trick to build the recommended long wire bus.
 +
 
 +
 
 +
[[File:1-WireLongStar.png]]
 +
 
 +
With this topology I'm able to build a '''physical''' star wiring from a central hub - but '''electrically''' I have only one long data bus.
 +
 
 +
For the star wires I used a bit thicker telefon wire, e.g. an [https://www.amazon.de/s?k=J-Y%28St%29Y+2x2x0.8mm J-Y(St)Y 2x2x0.8mm²]
 +
 
 +
= Draft =
 +
[[File:DS1820.png|right]]
 +
 
 +
So put all together to get an imagination.
  
== Sensors and network ==
 
  
The DS18B20 temperature sensor can be powered by an external supply on the V<sub>DD</sub> pin, or it can operate in "parasite power" mode, which allows the DS18B20 to function without a local external supply.
+
[[File:1-WireHubDraft.png]]
  
* In normal mode, each sensor is connected between a power line (V<sub>DD</sub> pin 3) and ground (GND pin 1), and the data output (DQ pin 2) connects to a third, data, line. The data output is a 3-state or open-drain port (DQ pin 2) and a 4.7 kΩ pull-up resistor to the power line is required.
 
* Parasite power mode requires both DS18B20 GND (pin 1) and V<sub>DD</sub> (pin 3) to be connected to ground. The DQ pin (pin 2 - the middle pin) is the data/parasite power line. The data line requires also a pull-up resistor of 4.7 kΩ connected to +5 V.
 
  
http://openenergymonitor.org/emon/buildingblocks/DS18B20-temperature-sensing<br />
+
(You can also bridge all not used D+ & D- connection points.)
http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html<br />
 
http://datasheets.maximintegrated.com/en/ds/DS18S20.pdf
 
  
If you have long 1-Wire network runs and are having problems with glitches you should add a Schottky diode to the end of your network. Typically a 1N5817 diode reverse biased across sensors will achieve this. Solder the side with the stripe to data output (DQ pin 2) and the other side to ground (GND pin 1) of the DS18S20.
+
{{Note|The trick to build a linear topology is, that each sensor is connected with 4 wires. The DQ data pin 2 is connected with '''2 wires''' of the cable, to build a single long line.}}
  
== Build ==
+
'''''Please note:''''' Mind the '''diode''' and the '''resistor'''!
  
Therefor I had to decide, how to connect them to the sever.
+
= Build =
  
 +
* As small as possible
 
* Simple to build > breadboard platine
 
* Simple to build > breadboard platine
* Stable > normal mode
+
* Stable > Normal mode
 
* Linear topology (according to [http://www.maximintegrated.com/app-notes/index.mvp/id/148 this guidelines]) > more stable than star topologies
 
* Linear topology (according to [http://www.maximintegrated.com/app-notes/index.mvp/id/148 this guidelines]) > more stable than star topologies
  
 +
Put it all together and minimize.
  
[[File:1-WireHubDraft.png]]
+
Next [[1-Wire_Hub_v2|Version 2]] will fit into a case for a cap rails.
  
  
 
[[File:1-WireHubBreadboard.png]]
 
[[File:1-WireHubBreadboard.png]]
  
Use a bit thicker telephone cable: [http://search.ebay.de/J-Y(St)Y+2x2x0,8 J-Y(St)Y 2x2x0,8]
 
  
[[Category:Hardware]]
+
(View from top, printed circuits and soldering on the bottom)
 +
 
 +
The '''cyan''', '''red''' and '''black''' thick dots are the soldering points for the upstream '''Data''', '''+5V''' and '''GND''' wires.
 +
 
 +
Use a bit thicker telephone cable J-Y(St)Y 2x2x0.8mm for lower loop impedance.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Parts list !! Source of supply !! Price
 +
|-
 +
| Lötbare Schraubklemme, RM 5.0mm || [http://www.conrad.de/ce/de/product/731817 Conrad] || € 0.33
 +
|-
 +
| Lötstreifenrasterplatte || [http://www.conrad.de/ce/de/product/527742 Conrad] || € 2.94
 +
|-
 +
| Schottky-Diode 1N5817RLG<br />alternative: Diode 1N4001 50V/1A || [http://www.conrad.de/ce/de/product/168274 Conrad]<br />[http://www.conrad.de/ce/de/product/162213 Conrad] || € 0.25<br />€ 0.06
 +
|-
 +
| Kohleschicht-Widerstand 4,7 kΩ || [http://www.conrad.de/ce/de/product/403334 Conrad] || € 0.10
 +
|-
 +
| Universal-Gehäuse 120x65x40 BOXE || [http://www.conrad.de/ce/de/product/522615 Conrad] || € 3.98
 +
|-
 +
| Telefoninnenkabel J-Y(ST)Y 2x2x0.8mm || [http://www.conrad.de/ce/de/product/600611 Conrad], [http://search.ebay.de/J-Y(St)Y+2x2x0.8mm eBay] || € 1.19/m
 +
|}
 +
 
 +
= Hub v2 =
 +
 
 +
On the [[1-Wire Hub v2|v2 of this hub]] you can connect 6 sensors.
 +
 
 +
----
 +
<references />

Latest revision as of 06:34, 11 September 2020

I monitor here 3 1-Wire DS18B20[1] based temperature sensors.

As I looked at commercial solutions and their prices, I decided to construct my own 1-Wire hub.

The DS18B20 temperature sensor can be powered by an external supply on the VDD pin, or it can operate in "parasite power" mode, which allows the DS18B20 to function without a local external supply[2].

  • In normal mode, each sensor is connected between a power line (VDD pin 3) and ground (GND pin 1), and the data output (DQ pin 2) connects to a third, data, line. The data output is a 3-state or open-drain port (DQ pin 2) and a 4.7 kΩ pull-up resistor to the power line is required.
  • Parasite power mode requires both DS18B20 GND (pin 1) and VDD (pin 3) to be connected to ground. The DQ pin (pin 2 - the middle pin) is the data/parasite power line. The data line requires also a pull-up resistor of 4.7 kΩ connected to +5 V.

If you have long 1-Wire network runs and are having problems with glitches[3] you should add a Schottky diode to the end of your network. Typically a 1N5817 diode reverse biased across sensors will achieve this. Solder the side with the stripe to data output (DQ pin 2) and the other side to ground (GND pin 1) of the DS18S20.

Normal mode

Typical wiring looks like this.


1-WireNormal.png

But Dallas recommends a long wire, so I adapted the wirng to this scheme.


1-WireLong.png

Here are also the recommended resistor and diode included.

And here comes the trick to build the recommended long wire bus.


1-WireLongStar.png

With this topology I'm able to build a physical star wiring from a central hub - but electrically I have only one long data bus.

For the star wires I used a bit thicker telefon wire, e.g. an J-Y(St)Y 2x2x0.8mm²

Draft

DS1820.png

So put all together to get an imagination.


1-WireHubDraft.png


(You can also bridge all not used D+ & D- connection points.)

The trick to build a linear topology is, that each sensor is connected with 4 wires. The DQ data pin 2 is connected with 2 wires of the cable, to build a single long line.

Please note: Mind the diode and the resistor!

Build

  • As small as possible
  • Simple to build > breadboard platine
  • Stable > Normal mode
  • Linear topology (according to this guidelines) > more stable than star topologies

Put it all together and minimize.

Next Version 2 will fit into a case for a cap rails.


1-WireHubBreadboard.png


(View from top, printed circuits and soldering on the bottom)

The cyan, red and black thick dots are the soldering points for the upstream Data, +5V and GND wires.

Use a bit thicker telephone cable J-Y(St)Y 2x2x0.8mm for lower loop impedance.

Parts list Source of supply Price
Lötbare Schraubklemme, RM 5.0mm Conrad € 0.33
Lötstreifenrasterplatte Conrad € 2.94
Schottky-Diode 1N5817RLG
alternative: Diode 1N4001 50V/1A
Conrad
Conrad
€ 0.25
€ 0.06
Kohleschicht-Widerstand 4,7 kΩ Conrad € 0.10
Universal-Gehäuse 120x65x40 BOXE Conrad € 3.98
Telefoninnenkabel J-Y(ST)Y 2x2x0.8mm Conrad, eBay € 1.19/m

Hub v2

On the v2 of this hub you can connect 6 sensors.