POWERING the DS18B20 September 18, 2011Posted by rik94566 in 1-wire, aquaponic automation, aquaponics, arduino, CEA, Controlled Environment Agriculture, DIY aquaponics, DS18B20, indoor aquaponics, indoor gardens, indoor growing, One-wire, sensor, Sensor Hub, Stainless Steel Temp Probe, Temperature Probe.
Tags: aquaponic automation, aquaponic crop, aquaponics, arduino, arduino sketch, automation, CEA, Controlled Environment Agriculture, DIY aquaponics, DS18B20, indoor aquaponics, indoors aquaponics, microcontroller, rik kretzinger, sensor, Temp Probe, Temperature Probe
Powering a DS18x20
The chip can be powered two ways. One (the “parasitic” option) means that only two wires need go to the chip. The other may, in some cases, give more reliable operation (parasitic often works well), as an extra wire carrying the power for the chip is involved. For getting started, especially if your chip is within 20 feet of your Arduino, the parasitic option is probably fine.
Parasite power mode
When 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) mode
With 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, try something smaller. The ATmega328/168 datasheet indicates starting at 1k6 and a number of users have found smaller to work better on larger networks.