Parasite power modeWhen operating in parasite power mode, only two wires are required: one data wire, and ground. At the master, a 4.7k pull-up resistor must be connected to the 1-wire bus. When the line is in a "high" state, the device pulls current to charge an internal capacitor.This current is usually very small, but may go as high as 1.5 mA when doing a temperature conversion or writing EEPROM. When a slave device is performing one these operations, the bus master must keep the bus pulled high to provide power until the operation completes; a delay of 750ms is required for a DS18S20 temperature conversion. The master can't do anything during this time, like issuing commands to other devices, or polling for the slave's operation to be completed. To support this, the OneWire library makes it possible to have the bus held high after the data is written.
Normal (external supply) modeWith an external supply, three wires are required: the bus wire, ground, and power. The 4.7k pull-up resistor is still required on the bus wire. As the bus is free for data transfer, the microcontroller can continually poll the state of a device doing a conversion. This way, a conversion request can finish as soon as the device reports being done, as opposed to having to wait 750ms in "parasite" power mode.Note on resistors:For larger networks, you can try smaller resistors.The ATmega328/168 datasheet indicates starting at 1k6 and a number of users have found smaller to work better on larger networks.
Note on resistors:For larger networks, you can try smaller resistors.The ATmega328/168 datasheet indicates starting at 1k6 and a number of users have found smaller to work better on larger networks.
devicecount = sensors.getDeviceCount();
for(n=0;n< devicecount; n++) sensors.getAddress(addresses[n], n);