user19013: I have two DS18B20 temperature sensors connected via a OneWire bus to an arduino. I noticed that these sensors get hot, when permanently powered and decided to just turn them on for measurment.
First attempt: Define a pin as output and feed the sensors. Because I received only one value (first sensor on bus), I assumed that the current delivered may not be high enough and utilized a transistor (+resistor) as switch for the main 5V line to feed the sensors from the mains (as before). The result is the same. I only get the value of the first sensor. When I connect the sensors directly, I get both values.
I tried up to 4 seconds delay after switching the bus on and again after reading the values (before switching the bus off again), with no luck. Only the first sensor answers.
Do I have a timing or a current problem here? 
UPDATE
Wiring (working): Two DS18B20 in parrallel with a 4,7k resisor between DATA and VIN. One Arduino pin used, Sensors directly powered by power-supply (same as arduino)
Wiring (not working): Broke the VIN line and added a transistor as switch between power-supply and sensors VIN. Used a second pin and a resistor to power up the line.
The transistor is a TC124E (npn) logic level transistor. I have the feeling, that this boy is not providing enough current to the sensors, which in addidtion have five meter cables attached...
UPDATE II
It is not the current. I replaced the transistor with a mosfet (70T03H) and the result is exactly the same: When switched, only one sensor answers . When I connect the gate directly to a +5V line, I get both values as expected.
Kinda think, that the switching of the pin irritates the bus or the specific device. 
UPDATE III (Solution)
I tracked this down to a mixture of 

Different resolution settings on the sensors 
my code not waiting long enough to get the sensor with the higher resolution to setup (on-to-read time). Giving the bus slightly more time to setup before any reading is accepted, solved my problem.


user313: If you were trying to wire your bus in parasitic mode, here is what I am using:
OneWire Bus in parasitic mode:

+------------+     +5v            +---------+     +---------+
|    MCU     |      |             | DS18b20 |     | DS18b20 |
|            |  R_pu = 4.7K       | g  d +5 |     | g  d +5 |
| Strong-    |      |             +-o--o--o-+     +-o--o--o-+
| Pullup   > o------o               |  |  |         |  |  |
|            |      |               +--|--+         +--|--+
|            |      |               |  |            |  |
|    Data <> o------o---------------|--o------------|--o------ - - -
|            |                      |               |
+------------+                      V               V

I run at least three sensors this way on an approximately 6 meter bus, completely reliably.

19013: <p>I have two DS18B20 temperature sensors connected via a OneWire bus to an arduino. I noticed that these sensors get hot, when permanently powered and decided to just turn them on for measurment.</p>

<p>First attempt: Define a pin as output and feed the sensors. Because I received only one value (first sensor on bus), I assumed that the current delivered may not be high enough and utilized a transistor (+resistor) as switch for the main 5V line to feed the sensors from the mains (as before). The result is the same. I only get the value of the first sensor. When I connect the sensors directly, I get both values.</p>

<p>I tried up to 4 seconds delay after switching the bus on and again after reading the values (before switching the bus off again), with no luck. Only the first sensor answers.</p>

<p>Do I have a timing or a current problem here? </p>

<p><strong>UPDATE</strong></p>

<p>Wiring (working): Two DS18B20 in parrallel with a 4,7k resisor between <code>DATA</code> and <code>VIN</code>. One Arduino pin used, Sensors directly powered by power-supply (same as arduino)</p>

<p>Wiring (not working): Broke the <code>VIN</code> line and added a transistor as switch between power-supply and sensors <code>VIN</code>. Used a second pin and a resistor to power up the line.</p>

<p>The transistor is a <code>TC124E</code> (npn) logic level transistor. I have the feeling, that this boy is not providing enough current to the sensors, which in addidtion have five meter cables attached...</p>

<p><strong>UPDATE II</strong>
It is not the current. I replaced the transistor with a mosfet (70T03H) and the result is exactly the same: When switched, only one sensor answers . When I connect the gate directly to a +5V line, I get both values as expected.</p>

<p>Kinda think, that the switching of the pin irritates the bus or the specific device. </p>

<p><strong>UPDATE III (Solution)</strong></p>

<p>I tracked this down to a mixture of </p>

<ul>
<li>Different resolution settings on the sensors </li>
<li>my code not waiting long enough to get the sensor with the higher resolution to setup (on-to-read time). Giving the bus slightly more time to setup before any reading is accepted, solved my problem.</li>
</ul>
 313: <p>If you were trying to wire your bus in parasitic mode, here is what I am using:</p>

<pre><code>OneWire Bus in parasitic mode:

+------------+     +5v            +---------+     +---------+
|    MCU     |      |             | DS18b20 |     | DS18b20 |
|            |  R_pu = 4.7K       | g  d +5 |     | g  d +5 |
| Strong-    |      |             +-o--o--o-+     +-o--o--o-+
| Pullup   &gt; o------o               |  |  |         |  |  |
|            |      |               +--|--+         +--|--+
|            |      |               |  |            |  |
|    Data &lt;&gt; o------o---------------|--o------------|--o------ - - -
|            |                      |               |
+------------+                      V               V
</code></pre>

<p>I run at least three sensors this way on an approximately 6 meter bus, completely reliably.</p>
