bergshav
Posts: 1
Joined: Fri Nov 30, 2012 11:38 pm

1-wire DS18B20 disappears

Sun Dec 09, 2012 6:03 pm

Hello and thank you guys for a fantastic forum!

I have (successfully) connected a DS18B20 1-wire temperature sensor to the Raspberry Pi, and when loading the correct modules

Code: Select all

modprobe w1-gpio
modprobe w1-therm
I am able to read from the sensor via

Code: Select all

cat /sys/bus/w1/devices/-----idOfSensor-----
But my problem is that after some time the ----idOfSensor---- folder disappears and I need to restart my pi to be able to read from the sensor again.
I have not been able to find any logs regarding the w1 kernel module and it's functions, are there any?

Any help would be greatly appreciated!
Regars
Bernt-Johan

markol
Posts: 1
Joined: Sun Mar 10, 2013 8:23 am

Re: 1-wire DS18B20 disappears

Sun Mar 10, 2013 8:32 am

Hi bergshav,
have you already found a solution, I am fightning with the same problem. My "device folders (10-000802....) disappear in periodic intervals, but after 30 seconds up to 1 minute they are back again....

Regards
Martin

tic984
Posts: 1
Joined: Sun Feb 02, 2014 1:24 pm

Re: 1-wire DS18B20 disappears

Sun Feb 02, 2014 1:27 pm

I have the same issue.
Did anyone find out why?

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: 1-wire DS18B20 disappears

Sun Feb 02, 2014 2:54 pm

Hi,

1-wire sensors tend to 'disappear' when the 1-wire network cabling is not satisfactory. Sensors can come and go apparently at random.

Here are some questions about your network
1. What cable are you using - is it Ethernet Cat5 or something else.
2. If you are using a twisted pair cable such as Cat 5, how have you connected the three wires - 3.3v, ground & data.
3 If there are unused wires in your cable are they connected to anything else such as ground and have you doubled up any wires
4. What is the total length of cable used - just approximately!
5. How many sensors are there and if more than 1 are they connected along the length of one cable or are they in a star configuration
6. What value resistor is connected between data and 3.3 volts
7. Are you using 3.3 volts to the sensors or are you using parasite power - if so how have you connected the 3.3 volt wire on the sensors.

Regards

anita2R

sheriff
Posts: 13
Joined: Thu Jul 16, 2015 2:20 pm
Location: Warsaw

Re: 1-wire DS18B20 disappears

Thu Aug 20, 2015 9:47 pm

Hi !
I have same issue :(, I have 3x cat 5 cables going down from diff rooms to one patch panel. Cable length is ca 12-20m each. Now on each cable I have two (parallel) connected DS18B20. I have used three wires : orange-white GND, blue DATA, orange VCC. In fact my interface on three next pins is grounded (so 4 in total). So let's say I have 1x1wire, 1xVcc, 4xGND, 2 - nc.
I have tried with 3.3V, 5V using PI2 power pin and external power supply as well - no difference.

So in result Pi2 can see sometimes all 6 DSs, then after few minute just 3, sometimes there are just 2.
I am using DS2482 interface.

Today I tried with PC and other interfaces connected via USB (usb-serial-1wire) and:
- one cable with two DSs works very well, no errors in log
- second cable one DS is ok, other I can see its address and sometimes temp., but there are 50% errors in crc mainly - probably there is something wrong with connection (I need to check, because I dont see resistance between GND and VCC on DS, which I am able to see on other DSs)
- third .. nothing I am not able to see addresses even, but when I check resistance seems to be ok (so it meant that DS is properly connected).
I tried to disconnect this cable with improper connection, but it didn't help.

any ideas why ?

Blindfreddy
Posts: 7
Joined: Sat Apr 20, 2013 8:50 am

Re: 1-wire DS18B20 disappears

Thu Jul 07, 2016 3:20 pm

I am having the same problem, curiously after 2yrs of error-free operation - and to make it more difficult for Sherlock-Holmes, the sensors disappear only at >60C - when the temperature drops below that 'threshold' they magically reappear.

I will run some trials exchanging sensors.

Using Cat6 cable, 3 wire (non-parasitic) mode.

Keep you posted....

yesdog
Posts: 1
Joined: Sun Jul 31, 2016 3:38 pm

Re: 1-wire DS18B20 disappears

Sun Jul 31, 2016 3:54 pm

Also having the exact same issue, including that it seems to be more prevalent during higher temperatures (plus when my digital lighting ballast is on, which can cause some intense RF).

In my case, the sensors never come back on their own, a hard reset is completely required. The fact that a hard reset makes everything normal, but a soft reset doesnt, really makes me thing it has to be a GPIO issue itself or (the w1_gpio module). I believe the only thing that could survive a reset like that is the shared gpiomem between the pi and the io chip. Whatever is affected is definitely not a part of system memory.

The interesting thing is that I've also seen this exact same behavior when I've forgotten the pull-up resistor. Maybe the Pi has somehow enabled a pull-down resistor on that pin? I've also seen on most external w1-master, there's some kind of circuit thats supposed to prevent feedback/echo from the devices (something with a transistor, really cant find that board again).

I think I'm going to switch to an I2C master- I2C seems infinitely more forgiving as far as line quality, plus the chip itself can handle the bit-banging and all the more intense 1-wire related timing. Even better, some of these external boards/chips have a mechanism for resetting power to the devices (even has a 'sleep mode'), so if I end up with the same issues, I'll at least have some way to reset the 1-wire bus itself.

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Wed Dec 20, 2017 11:33 am

I have the same scenarios as you both describe.
On two occations I've had the sensor-files disappear when one of the four sensors were above 60 degrees. It came back after 2 hours when the sensor got below 55 again.
On another box, same setup, it just disappears and I get only a few ranom 00-80000000-type of files. After a hard reset, (power out and back in) I get everything online.

I've tried to use the watchdog and "magic sysrq" to reboot as well as a fork-bomb. the system reboots, but no sensor-directories.

We need to debug the one-wire module somehow or force it to spit out somthing that we can work with.

Powered via 5V with pull-ups, no parasitic mode.

Regards
J

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Mon Jan 08, 2018 11:29 am

I had 6 identical setups running since dec 20 and found now that I have one of the with the issue. No one-wire directories found. Soft-reboot didn't help (sudo reboot) and a harder reboot using a fork bomb and the watchdog didn't help either.

any ideas howto debug the one-wire stack are *very* welcome.

rickrack
Posts: 10
Joined: Mon Jan 08, 2018 2:29 pm

Re: 1-wire DS18B20 disappears

Wed Jan 10, 2018 4:35 pm

Hey guys,

I have a similiar problem and hoped to find a solution here.

I have a few pi setups with 1-wire DS18B20. After a while the sensors start to vanish and you can see random IDs which change sometimes.

tried different setups:
1. Connect the DS18B20 to 5V, Ground an GPIO 7
2. Connect the DS18B20 to 3,3V, Ground and GPIO 7
3. Connect the DS18B20 to GPIO 25, Ground and GPIO 7

Always with a 4K7 resistor between the power and signal pin.
The only way to get it working again was power reset.

in all setups on differnt Pi's the behavor appears but till now i couldn't force it.

In dmesg I get these entries:

Code: Select all

[    4.692892] w1_master_driver w1_bus_master1: w1_search: max_slave_count 64 reached, will continue next search.
[   52.116053] w1_master_driver w1_bus_master1: Family 0 for 00.800000000000.8c is not registered.
Sometimes the ID of the sensor stays, but then I got 0°C as value.

during my research i found some hints the problem could be caused by the device tree of current kernels.

I always set the /boot/config.txt to:

Code: Select all

dtoverlay=w1-gpio
do I still need to activate it in /etc/modules?

I appreciate any help

greetings
rick

davef
Posts: 34
Joined: Wed Feb 20, 2013 8:39 pm

Re: 1-wire DS18B20 disappears

Thu Jan 11, 2018 8:36 am

@rickrack,

Could you post a link to these hints? For the last year I have had to ignore 0C readings in my datalogger.

It would be nice to know what is going wrong.

davef


jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Thu Jan 11, 2018 5:08 pm

I think your setup is just fine Rick.
Either modprobe or dtOverlay will work depending on kernel. The hacks out there are old.

The issue we're discussing is that it works initially and after some time it does not anymore (or sends bad apples in form of zero-values). I've also seen that two sensors suddenly have same value, few seconds later, they differ again. Like if they were swapped.

I think there is something wrong down through the code in the module which nobody seems to have written (or at least interested in helping out finding the issue with). Or even deeper in hardware.

I've tested at one time to disconnect the power and reboot the rpi, didn't help. All sensors still gone. Cutting power for one minute helped. Like if the sensors had capacity stored and kept their faulty states or something.

rickrack
Posts: 10
Joined: Mon Jan 08, 2018 2:29 pm

Re: 1-wire DS18B20 disappears

Fri Jan 12, 2018 8:00 am

jenscollin wrote:The issue we're discussing is that it works initially and after some time it does not anymore (or sends bad apples in form of zero-values).
Exactly... I just thought my setup may be the reason for the missfunction of the 1-wire bus.
jenscollin wrote: I think there is something wrong down through the code in the module which nobody seems to have written (or at least interested in helping out finding the issue with). Or even deeper in hardware.
Well this kinda sucks.... :/

Even more annoying, I cant force that behavior. The last pi with that problem is now working fine for days now.

Currently I am doing further tests on my third setup. If the sensors misbehave, I can turn of the GPIO Pin and power reset the sensors this way, without rebooting the pi. Actually this is a workarround and not a solution.

try to gather some more information...

A bit ot:
Anyone know a module, interface or something to use PT100 / PT1000 sensors with the pi?


greetz
Rick

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Fri Jan 12, 2018 12:16 pm

rickrack wrote: Even more annoying, I cant force that behavior. The last pi with that problem is now working fine for days now.

Currently I am doing further tests on my third setup. If the sensors misbehave, I can turn of the GPIO Pin and power reset the sensors this way, without rebooting the pi. Actually this is a workarround and not a solution.
I'm doing about the same with a mosfet cutting the ground off for a while. But I'd like to find a proper solution that also covers garbage values.
rickrack wrote:
Anyone know a module, interface or something to use PT100 / PT1000 sensors with the pi?
I've been in the same like of thoughts but not found anything simple enough to dig into.

Has any of you guys read into the source code of the one-wire module? Are there any names or updates, patches, etc? Can some debugging be enabled? Unfortunately the internet is all clogged with issues of getting it to run between kernel versions so it's hard to search for.

User avatar
bensimmo
Posts: 2756
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: 1-wire DS18B20 disappears

Fri Jan 12, 2018 2:16 pm

There was a post about the miss-reads you might not noticing you are having,
it may be related (unfortunately cannot remember where in the forum, good chance it is still also on Github for the 1-wire/Pi)

Quick question.
Are you placing the 4k7 resistor at the Pi end or at the sensor end.

danjperron
Posts: 2855
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 1-wire DS18B20 disappears

Fri Jan 12, 2018 2:37 pm

Could be related to the capacitance effect of the cable.
How long is the cable? what type of cable? How many sensors.

I did A raspberry PI B version 1.0 outside for three years and never had issue with 5 DS18B20 sensors.

In a doubt you could try my user mode approach

Connect your sensor the another free GPIO pin which is just I/O ( no SPI,I2c stuff)
and try to run my user mode code;

First install my user mode DS18B20

Code: Select all

cd
git clone https://github.com/danjperron/BitBangingDS18B20
cd BitBangingDS18B20/python
sudo python setup.py install
Then from python read all the sensor. I use GPIO17 (pin 11) on this example

Code: Select all

sudo python
import DS18B20
gpiopin = 17
sensors = DS18B20.scan(gpiopin)
for i in sensors:
  print('{} : {}'.format(i, DS18B20.read(True,gpiopin,i)))

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Sun Jan 14, 2018 5:56 pm

bensimmo wrote:
Fri Jan 12, 2018 2:16 pm
There was a post about the miss-reads you might not noticing you are having,
it may be related (unfortunately cannot remember where in the forum, good chance it is still also on Github for the 1-wire/Pi)

Quick question.
Are you placing the 4k7 resistor at the Pi end or at the sensor end.
I have the resistor on the Pi end, the sensors I'm using a pre-made with 3m cables. 4 tied together at the rpi side.

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Sun Jan 14, 2018 6:03 pm

danjperron wrote:
Fri Jan 12, 2018 2:37 pm
Could be related to the capacitance effect of the cable.
How long is the cable? what type of cable? How many sensors.

In a doubt you could try my user mode approach

Connect your sensor the another free GPIO pin which is just I/O ( no SPI,I2c stuff)
I have 4 sensors with 3m cable on each, all connected at the Rpi side. Cable is nothing special, pre-made.

Didn't know about the BitBangingDS18B20 project. Very Excited!

Code: Select all

>>> import DS18B20
>>> gpiopin = 21
>>> sensors = DS18B20.scan(gpiopin)
>>> for i in sensors:
...   print('{} : {}'.format(i, DS18B20.read(True,gpiopin,i)))
...
28-011632A1A8EE : None
28-01163292D4EE : None
28-0116329842EE : None
28-0116329A2EEE : None

I tried to install it, got the scan() to work, got all my sensor id strings.
But the read gives only "None", tried both the C-version and python module.

The getResolution() gives 12. Looks ok, but when I try: setResolution(9) it just returns (no error).
When calling getResolution() again, I still get 12 as if it does not work to write.

If I run with the kernel module enabled I get readings from it properly. (Not enabled above).

Regards,
JEns

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Sun Jan 14, 2018 6:57 pm

I just had one setup loose all the sensors again. The case looks like this:

The directories from the Kernel module are random, mostly 00-000000080-type of dirs. contain garbage.
Reboot to test, no difference. same directories.
Disabled the kernel module, new reboot.
No directories created (kernel module confirmed disabled)
Installed according to https://github.com/danjperron/BitBangingDS18B20

print(DS18B20.scan(21)) returns:
['28-800000084777', '28-800000262F3F', '28-051673632AFF', '28-0516736557FF']

which is awsome! The sensors respond!
But as my previous post shows, nothing in the calls for temperatures :(

DS18B20.readScratchPad(21, '28-800000262F3F')
[0, 0, 0, 128, 0, 0, 0, 0, 0]

print(DS18B20.read(True, 21,'28-800000262F3F'))
None

Looks like the BitBang-solution can be the game changer here to avoid hardware hacks!
Any tips?

Jens

rickrack
Posts: 10
Joined: Mon Jan 08, 2018 2:29 pm

Re: 1-wire DS18B20 disappears

Mon Jan 15, 2018 8:43 am

Hey guys,

took a weekend off from that problem xD
bensimmo wrote: Quick question.
Are you placing the 4k7 resistor at the Pi end or at the sensor end.
Resistor is placed at the Pi end.
danjperron wrote: Could be related to the capacitance effect of the cable.
How long is the cable? what type of cable? How many sensors.
I use 5m sleeve sensor with a silicon cable. The number of sensor differ between 2 and 4.

One of my test boxes quit working over the weekend again. Still need to look deeper into it, but the first thing I found was the already known message

Code: Select all

[182804.506017] w1_master_driver w1_bus_master1: w1_search: max_slave_count 64 reached, will continue next search.
maybe i find something... :/

after that I will try that BitBangingTool from danjperron

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Mon Jan 15, 2018 8:56 am

Rick, does a reboot of the rpi help in your case?
If not, try disable the one-wire module overlay and try the BitBang-tool, it's a quick test.
Might lead us onto if we're having the same issue.

Jens

rickrack
Posts: 10
Joined: Mon Jan 08, 2018 2:29 pm

Re: 1-wire DS18B20 disappears

Mon Jan 15, 2018 9:45 am

Update...

I have second box which stopped working too..

Got these messeges in dmesg

Code: Select all

[154486.366967] w1_slave_driver 28-800000013d0b: Read failed CRC check
[176835.904716] w1_master_driver w1_bus_master1: w1_search: max_slave_count 64 reached, will continue next search.
When I looked in den /sys/bus/w1/devices folder. The sensors where still there, showing only 0°C values.
Rebooted the pi...
After the reboot I got the 0-00... garbage sensors.

Then I tried the BitBanging Lib as Jens suggested.

First I removed the dtoverlay in the config.txt
-> Reboot again
-> Check folders. No w1 folder. Disabled module confirmed.
-> Donwload and compile the BitBanging Lib from danjperron

This is what I got:

Code: Select all

sudo ./DS18B20Scan -gpio 4 -s
5A80000001172428
8D800000013D0B28
9F800000034AEB28

Code: Select all

sudo ./DS18B20Scan -gpio 4
28-800000011724 : 12 bits  Temperature:   1.94 +/- 0.06 Celsius
28-800000013D0B : 12 bits  Temperature:  54.81 +/- 0.06 Celsius
28-800000034AEB : 12 bits  Temperature:  75.12 +/- 0.06 Celsius

Edit:
after that test I turned the dtoverlay on again.
The sensors are working now fine again.

I think with turning of the dtoverlay we had an power reset of the sensors. Like described in my third setup earlier.
So I am not sure if the BitBang is the solution.
I setup a pi with that configuration and give it another test

danjperron
Posts: 2855
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 1-wire DS18B20 disappears

Mon Jan 15, 2018 1:26 pm

So I am not sure if the BitBang is the solution.

I made the bitbanging application to increase the number of sensors and to increase the number of readings per second. On normal operation the 1-wire dtoverlay should work fine!

Something is odd about your system. I will put an oscilloscope on the signal to figure out what is wrong but I know that not everybody has one. Could be a leakage current, to much capacitance on the line, Is one of the cable go near a power cable. is the wires twisted to limit voltage transient? Cable gauge is also an issue. Too thin wires will create voltage lost and could perturbate normal operation.

jenscollin
Posts: 17
Joined: Sat Dec 31, 2016 11:26 am

Re: 1-wire DS18B20 disappears

Mon Jan 15, 2018 1:56 pm

rickrack wrote:
Mon Jan 15, 2018 9:45 am
...
The sensors are working now fine again.

I think with turning of the dtoverlay we had an power reset of the sensors. Like described in my third setup earlier.
So I am not sure if the BitBang is the solution.
Did you powercycle the raspberry or the command reboot? This does the hole difference for me. A reboot by cutting power 30 seconds solves the issue, a software reboot (setting the dtoverlay on/off) does not help.
danjperron wrote:
Mon Jan 15, 2018 1:26 pm

Something is odd about your system. I will put an oscilloscope on the signal to figure out what is wrong but I know that not everybody has one. Could be a leakage current, to much capacitance on the line, Is one of the cable go near a power cable. is the wires twisted to limit voltage transient? Cable gauge is also an issue. Too thin wires will create voltage lost and could perturbate normal operation.
The thing is that it has run for 2-3 months on some places, then suddenly stopped working. No sensors at all found by kernel-driver. Your BitBang-code finds the ID's which I assume is also communicated somehow on the same link, but no temp values. Can you point me in the direction to figure that out?

I do have a scope but the setup that malfunctioned last time is out of reach. I do have 4 setups here that hasn't showed the issue yet, built the same way.

Jens

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 9 guests