Using Dallas One-Wire ds18b20's in parasitic power mode

Hi, i’m using the OneWire library and i have been able to string numerous DS18B20’s together (like 15) and have had no problems getting readings from them when using the ‘normal’ 3 pin’s.

I adapted the official Onewire library and am using my own class as a thin wrapper.

However, i wish to use parasitic power to power the temperature sensors. So reading the datasheet, my noobie skills tell me that in order to wire this up, i should short the ground and Vdd wires together on the sensor; such that the diagram on the official electric imp onewire page would have the two outer legs both connect to ground, whilst leaving everything the same. i do not use the mosfet as recommended.

So i power up my imp with the temperature sensor in parasitic mode, and my discover() function appears to find the temperature sole sensor… yippee! i think… but then i notice that the temperature reading is always 85C. as soon as i recable the circuit to use the full three wires, the sensor reads the correct temperature.

so i add a function to get the “Read Power Supply” [B4h] of the sensor… but it always seems to return true. what am i doing wrong? have i wired the sensor incorrectly? do i simply need the mosfet? (any recommendations?)

i also know that i’m supposed to “keep a strong pullup on the 1-wire bus” during conversions… how do i do that?

cheers!

I suspect that’s your problem, and it’s something that’d be hard to do - you need to basically nail DQ to VCC in <10us from issuing a convert command.

This type of thing is exactly what the DS2482 helps with.

i ended up putting a 1k3 resistor in and i can now get correct readings from a short piece of wire. :slight_smile:

@Hugo: i wanted to avoid extra circuitry if possible in order to simplify the deployment (i will have 1000+ sensors in this environment). i do have a handful of the DS2482’s in case i can’t get the software only solution to work well.

How many per imp, though? If it’s a small number then yes, a pullup that will allow enough current to power the sensor in 1-wire mode.

The issue with the stronger pullup is more that the DS1820 has to pull down against it. The imp can pull low pretty strongly

Yeah, the more sensors i’m putting per wire, the lower the resistor value, e.g. i’m on 5 sensors at the moment on one uart line, and i’m using a 130ohm resistor. i’m hoping to get this to around 8 or 9 ds18b20’s per line; i suspect a ds2482 might be in order.

The maximum rated sink current for the imp IOs is 4ma, which means you should not use less than a 825Ω resistor at 3.3V if you want to stay in spec. The pins will sink more current than that but there may be impacts to the system and I wouldn’t recommend it.