I have been experimenting with using the Imp with 1-Wire devices. I have been using 1-Wire for years and I am very familiar with them.
I notice that the 1-Wire examples, for example that DS18B20 example, leave the device powered constantly. I am building a battery powered device using the MAX31850 and I want to minimize power consumption. Does anyone have experience with parasite powering the devices using strong pullup or powering them using a GPIO pin?
The power pin of the DS18B20 is drawing 1.6 µA when supplied from the power pin whether the Imp is running or not.
I connected the power lead and pullup resistor to Pin 9 instead of the power pin and added the following code before the first reset:
` //raise pin 9 to supply sensor
hardware.pin9.configure(DIGITAL_OUT)
hardware.pin9.write(1)
`
After readings the sensor:
hardware.pin9.write(0)
Things got weird at that stage. The current between Pin 9 and ground was -100 µA. Pin 1 was supplying 3.3 volts and Pin 2 was showing 0.44 V. The power was feeding back through the resistor. Adding ow.disable after reading the sensor made no difference.
The only way of stopping the power at Pins 1 and 2 was to ad this code:
I have achieved the aim of having no current being drawn when the sensor is not powered. However, it looks pretty inelegant. Does anyone know a better way to do it.