Autor Thema: Bad 1-wire readings  (Gelesen 530 mal)

Offline jacko

  • New Member
  • *
  • Beiträge: 6
Bad 1-wire readings
« am: 29 März 2020, 12:54:01 »
I have just finished implementing my first fhem project - a greenhouse automation project monitoring temperature and controlling watering on a RaspiPi with the Automation HAT. I've learned alot about fhem and am growing to love it.

I have an occasional problem with my temperature readings from the 1-wire D1820 devices interfaced to the GPIO25 pin. About 10 times a day I get a temperature reading of 85 or 127 from any of the 3 sensors. In my logfile post-processing I can easily remove, but for the fhem graphs  I can't get the gplot max:min to work and end up with spikey temperature plots (see attachment).

I have tried resistors on the 1-wire data line but can't eliminate the bad readings.

I am looking for a way within fhem to filter out the bad readings. Can anyone give me some guidance?

Separately I am also confused by the snippets of perl that I see posted. Where do these go? In the fhem.cfg file?

Thanks in advance.

Offline KölnSolar

  • Developer
  • Hero Member
  • ****
  • Beiträge: 4344
Antw:Bad 1-wire readings
« Antwort #1 am: 29 März 2020, 14:01:24 »
welcome to FHEM, Jacko.
Zitat
About 10 times a day I get a temperature reading of 85
That's normally an indicator for problems in the wiring, contact problems.

Zitat
by the snippets of perl that I see posted
Which ? Where do you saw them ?

Zitat
RaspiPi
Zitat
GPIO25 pin
Plase describe your installation a little bit further. Which FHEM-module you are using, no. of sensors, kind of wiring(2 vs. 3 wires, gpio vs. busmaster, star vs. line....)
Regards Markus



RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-CUL868-FS20A4-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty-Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)

Offline jacko

  • New Member
  • *
  • Beiträge: 6
Antw:Bad 1-wire readings
« Antwort #2 am: 31 März 2020, 00:25:36 »
Hi Markus,

Providing answers to your questions (although not in order):

I am running the latest version of Raspian (Buster) on a Rev3B+ Raspberry pi with a Pimoroni Automation HAT.
I have installed the latest version of fhem as of last week, 6.0.
The 1-wire devices, 3x DS18D20 temp sensors are on GPIO/BCM25. To get to work I modified the module 58_GPIO4 and replaced all entries of 4 with 25 to created 58_GPIO25, and then mounted the 1-wire sensors. Everything seems to work OK (apart from then occasional bad reading). I am wondering if something is wrong here that would cause a glitch?

I soldered a header on to the HAT board to access BCM25. I have checked and double checked all the 1-wire wiring. Everything is soldered and the sensors come together on a screw terminal and then plug onto the new HAT header. All pretty solid.

My fhem.cfg sets up multiple devices:
Inputs; PIR (to switch light on) and window opening sensors (reed switches)
Relays: LED light strip + 2x water solenoids for watering
Output: Fan (for cooling Raspberry pi as the greenhouse gets hot in the summer.

I see examples of perl code on, for example, the wiki code snippets pages. I am wondering if I could insert some perl into my .cfg file somehow to mask out the errant readings.

Longer term I am looking to replace another automation system currently based on a "Homevision" system with fhem. This makes use of extensive state machines and I am struggling to understand how to implement on fhem without recourse to perl scripting. This is why I am also asking about the use of perl (perhaps this should be a separate thread?).

Any ideas/guidance would be appreciated.
Jack.

Offline KölnSolar

  • Developer
  • Hero Member
  • ****
  • Beiträge: 4344
Antw:Bad 1-wire readings
« Antwort #3 am: 31 März 2020, 07:03:30 »
Hi Jack,

thats a lot of description now.   ;)

There was no need to change the 58_GPIO4-Modul, because it works on a higher level. It's just reading the corresponding 1w-system-files of the Rpi. No matter which GPIO is used.
You may use my version which is non-blocking.

Zitat
if I could insert some perl into my .cfg file somehow to ....
NO. .cfg ist just the config-file of FHEM. There might be perl-code, but that ist "integrated" in the specific devices, maybe userReadings or within an at/notify.....coded via the front-end of FHEM.
There you may use user specific perl-functions too. You should put the perl code of these functions in your own e.g. 99_myUtils.pm and just call these functions which is more transparent and the functions are reusable.

You didn't answer my question of wiring regarding 2 or 3 wires.(powering of DS18B20). Are the 3 sensors connected as a star or in line ? Which resistor used ? Length of cables. Maybe the problem is the power of the Rpi ? :-\
(I currently don't have the time to investigate on understanding(researching) the general technical problem of 0, 85,127 degrees readings.  :'(;I think there is an explanation in the datasheet)

Zitat
to mask out the errant readings.
I think that's not the way you should solve the problem, because it seems to be a technical problem with 1-wire-installation, sensors, Rpi..... :-\
(Maybe I change "my 58_GPIO4" in the next days to eliminate 0°,°85°,127°(I never saw that so far) managed by an attribute)

Regards
Markus
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-CUL868-FS20A4-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty-Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)

Offline jacko

  • New Member
  • *
  • Beiträge: 6
Antw:Bad 1-wire readings
« Antwort #4 am: 31 März 2020, 19:55:14 »
Hi Markus,

Thanks for the further information on perl scripting - it's starting to become clearer now.

My 1-wire sensors are wired in a star arrangement with hub to sensor spurs of 4m, 2m and 10cm. The hub to GPIO header length is 10cm and a 4K7 resistor is at the hub. I wonder whether I need to try lower values of resistance?

I also note that my unexpected 85C readings are the value provided when the device resets. I am not sure where the other unexpected reading of 127C comes from.

I'll take a look at your 58_GPIO4 module soon.

Reagrds,
Ian.

Offline KölnSolar

  • Developer
  • Hero Member
  • ****
  • Beiträge: 4344
Antw:Bad 1-wire readings
« Antwort #5 am: 01 April 2020, 21:56:56 »
Hi Ian,
I've added a new attribute to omit faulty values for DS18B20. You may specify space-separated values. You'll find the new version here.
Regards
Markus
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-CUL868-FS20A4-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty-Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)

Offline jacko

  • New Member
  • *
  • Beiträge: 6
Antw:Bad 1-wire readings
« Antwort #6 am: 02 April 2020, 10:56:06 »
Thanks Markus, I had started to code something similar but not as elegant as your solution  :)

I am bringing up a dev system to play and learn more. It's problems like this that help me get into understanding a system. Your help is much appreciated.

All the best.

 

decade-submarginal