Main Site Documentation

Hot swapping DS18B20 sensors safe?


#1

I am using USB Type A connectors to connect multiple DS18B20 OneWire sensors to a Cobra II mainboard via a breakout board.

My guess it that it should be safe enough to insert and remove sensors while the system is running but some data corruption may occur if communication was happening at the exact time the sensor is inserted or removed.

Can anyone confirm if it would be safe to hot swap sensors in this way or is there a possibility that I could damage the main board?


#2

Should be alright


#3

Thanks Gus.


#4

Agree, since you’re sourcing current from the mainboard to power the one-wire sensor, unless there’s a chance your plugs can short out V+ to GND then you should be fine.


#5

I agree with Brett. You may want to put a current limiting resistor inline incase of plug shorting. You may also be able to trigger an event when a 1-wire device is plugged in also. I believe all 1-wire devices generate a reset signal upon power up.


#6

As others have said, it will be fine.

In fact, if you think about how the iButton works, it is connected whilst the system is running.


#7

Thanks guys - didn’t think it would be a problem, but wanted to be sure.

Don’t mind if a sensor goes kaput, but don’t want to risk a main board.

@ logictechs

Had not thought of adding current limiting, but as will be in proximity of salt water - not a bad idea. I am unsure on how to calculate a current limiting resistor, any suggestions on a value to use? Cheers.

Have got this from the data sheet:
Input Voltage: 5v
Max Active Current draw per sensor: 1.5mA
Sink Current Draw per sensor: 4mA
Max number of sensors: 8
Min number of sensors: 1

Or perhaps should put an inline fuse instead?

Was planning to add a “Sensor Setup” screen to my app or to manually actively monitor hardware addresses of the sensors with routine polling and prompt for action whenever a sensor appears or disappears.


#8

the last point you make is actually the most important one to manage - because if users can change the devices, you certainly need to be able to handle that, so reacting to new and no-longer-visible devices is critical.