DS18B20 temp sensor disconnecting each time after several ho

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
iNode
 
Posts: 12
Joined: Sat Apr 16, 2016 7:29 pm

DS18B20 temp sensor disconnecting each time after several ho

Post by iNode »

Hi,

I have two DS18B20 temperature sensors that I'm using with a Raspberry Pi 3. I wired and I'm using it at it says so in the guide for using it on a RPi :https://learn.adafruit.com/adafruits-ra ... ng/ds18b20

I did modify the code by a bit to get the readings of two of these DS18B20 sensors.

They both connect fine and I can read the temperature readings just fine but when I leave it running for a few hours and come back I get this error:
IOError: [Errno 2] No such file or directory: '/sys/bus/w1/devices/28-000008e0f6af/w1_slave'
I ran the code several times and it always happens after a couple hours, could this be a power issue that's causing this or anyone know the cause of this problem?

Thanks

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: DS18B20 temp sensor disconnecting each time after severa

Post by adafruit_support_mike »

Are you running a separate VCC line to the sensors, or running them on parasite power?

User avatar
iNode
 
Posts: 12
Joined: Sat Apr 16, 2016 7:29 pm

Re: DS18B20 temp sensor disconnecting each time after severa

Post by iNode »

adafruit_support_mike wrote:Are you running a separate VCC line to the sensors, or running them on parasite power?
I'm running the two DS18B20 temp sensors off the RPi's 3V3 pin. There's also a couple other small i2c chips using the SDA/SCL pins running on 5V.

Is it a power issue? Can I fix this with a simple breadboard powersupply?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: DS18B20 temp sensor disconnecting each time after severa

Post by adafruit_support_mike »

The 3.3v pin should have more than enough power to run the sensors if you run VCC connections to them.

1-Wire gets its name because it's possible to power devices from the DATA pin. Each device has a small capacitor that holds enough energy to keep it running while the DATA line is pulled low. It's called 'parasite power'. Aside from the ground connection, you only need one wire between the microcontroller and the sensor, and since 1-Wire devices can share the same DATA line, you only need one wire for a whole sensor array.

There are some technical issues though. 1-Wire devices running on parasite power tend to be less stable than devices that get power from a separate VCC line.

If you have a separate VCC line, there's a chance that a data transaction is getting messed up by noise in the wiring. That can happen sometimes, especially as wires get longer. You should be able to reset the bus and all devices connected to it by pulling the DATA line low for a couple of milliseconds. Then the devices on the bus will re-register with the RasPi.

User avatar
mikethornac
 
Posts: 1
Joined: Fri Dec 01, 2017 8:27 am

Re: DS18B20 temp sensor disconnecting each time after severa

Post by mikethornac »

Apologies for resurrecting an ancient thread, but I'm having a similar issue to the OP, and I'm powering my DS18B20 from the 3.3V pin.

The only difference from the OP is that my sensor goes offline, without fail, after about five minutes.

I'm using the stock waterproof sensor, and about a 6-inch ribbon cable to connect it. If that's too long, then the 1-wire protocol is truly less stable than I expected, haha.

Since mine goes off so quickly, and so reliably, I'm starting to suspect hardware failure. It would almost seem that the cap isn't holding power during the DATA drop, and for whatever reason it's not pulling power correctly from the VCC pin?? Seems impossible. I do IT for a living...so I know nothing is impossible. Hah.

Any advice would be appreciated. Seems a bit messy to have to do a full bus reset every five minutes?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: DS18B20 temp sensor disconnecting each time after severa

Post by adafruit_support_mike »

1-Wire can definitely handle connections 6” long. It’s spec’d for cable distances up to about a kilometer.

Post a photo showing your hardware and connections and we’ll take a look. 800x600 images usually work best.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”