Davis Vantage Rainmeter and ESP32 - Solved ghost interrupt

Moderator: leecollings

Post Reply
benp
Posts: 52
Joined: Saturday 21 May 2016 20:12
Target OS: NAS (Synology & others)
Domoticz version: V4.10717
Location: France
Contact:

Davis Vantage Rainmeter and ESP32 - Solved ghost interrupt

Post by benp »

This is an update of my Davis+FGBS222 zwave configuration on the french forum:
https://easydomoticz.com/forum/viewtopic.php?t=13278
I have no question because my project is supposed to be fully functional according to my test "water in the boottle" but only true rain will tell me...
Comments are welcome!

I thought I had a problem with zwave so I did the migration from zwave to ESP32 but in fact the rainmeter was dirty. I just clean it...

Anyway: I was not very happy with the zwave solution because data received in domoticz were not very clean so I had to clean it inside domoticz: data from the reed switch are sometime received in the bad order so I had to filter, FGBS is sometime on a bad state on switch on... I had to filter all that in the dz vents script...

Before the Davis rainmeter, I tried other solutions:
  • 433 MHz Oregon PCR800: not so bad but last only one or 2 years and not anymore manufactured
  • Zwave Popp Z-Rain: not reliable for 80€ : values are sometime eratic. https://www.domoticz.com/forum/viewtopic.php?t=36292
  • 433 Mhz TFA 30.3233.01 +RFXcom : not really better but only 27€
Warning: always use a manual rainmeter to know if your values are valid or not!

Materials:
  • Davis 6464M rainmeter: 149€
  • RJ11 Breakout BOB-14021 at sparkfun $2.10
  • RJ11 6-Pin Connector PRT-00132 at sparkfun $1.50
  • ESP32 DFR0478 at DFRobot (any other ESP32 should work): $8.90
  • Micro USB power supply
Why such an expensive rainmeter: because this is the only reliable rainmeter according to the members of infoclimat forum.
The rainmeter is a part of the vantage pro 2 weather station at more than 1000€ not including ethernet gateways annual service charge...

Wiring:
Connect 4 & 5 from RJ11 to GND and IO25/D2 of ESP32: wire can be reversed because connected to the reed switch inside the rainmeter
2024-04-19_15-36-08.jpg
2024-04-19_15-36-08.jpg (61.32 KiB) Viewed 845 times
Note: ESP32 and RJ11 are inside house and rainmeter outside
_MG_4906bd.jpg
_MG_4906bd.jpg (85.32 KiB) Viewed 845 times
IMG_20230613_193521r.jpg
IMG_20230613_193521r.jpg (18.25 KiB) Viewed 845 times
RJ11 connection between rainmeter and ESP32

To do in domoticz:
Add a rainmeter and an alert as virtual devices. Look at the idx: rainmeter is 100 and alert 101 in my arduino program

Install arduino and the firebeetle board according to the dfrobot tutorials:
https://www.dfrobot.com/blog-1578.html

The arduino program:
Before you use and try to understand this program, things you must know:
  • The rainmeter is not easy to de-bounce because the reed switch is only closed from 119ms to 141 ms
  • Interrupt are used because http connection can last more than 150ms
  • ESP32 is a 2 core microcontroller with multitask capabilities. Conflict are possible when you try to read/write the same variable in interrupt/main process. portENTER_CRITICAL_ISR(&mux); must be used
  • You must change ssid + password + IP address + port + idx in my program
  • The program autoreconnect on disconnect
  • The alarm log reconnect and http error (once reliable communication is back)
  • There is too much alert because the program is in test waiting for the next rain this night according to the forecast...
  • Nothing to do in domoticz because eveything is done with Domoticz API/JSON URL
The code is 225 lines against 45 lines for the zwave version...

[Update 23/04/2024] the new code with no ghost interrupt is in the Arduino forum:
https://forum.arduino.cc/t/stange-ghost ... /1250942/3
Last edited by benp on Tuesday 23 April 2024 12:45, edited 1 time in total.
Domoticz V2024.7
benp
Posts: 52
Joined: Saturday 21 May 2016 20:12
Target OS: NAS (Synology & others)
Domoticz version: V4.10717
Location: France
Contact:

Re: Davis Vantage Rainmeter and ESP32

Post by benp »

Bad new: the ESP32 detect false rainmeter bucket
The TFA
tfaR.png
tfaR.png (6.4 KiB) Viewed 823 times
The ESP32
davis3R.png
davis3R.png (4.13 KiB) Viewed 823 times
Maybe the pullup resistor is too high: around 50kohms according to ESP32 users. The wire to the rainmeter is 15 meters long.
I tried to add a 1000 ohms resistor as pullup.
IMG_20240420_111112bd.jpg
IMG_20240420_111112bd.jpg (67.99 KiB) Viewed 823 times
But no luck: I had 3 false bucket during this post writing (10 minutes).
Domoticz V2024.7
mgugu
Posts: 208
Joined: Friday 04 November 2016 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Davis Vantage Rainmeter and ESP32

Post by mgugu »

This may be an electromagnetic interference problem (15 meters is a lot), several checks possible:
- Shorter wire
- Shielded wire
- Use 2 pull up inside and outside
- Small capacitor at the reception (47 pf)
- Optocouplers
- ...
But definitely it is not a Domoticz problem but an electronic one
benp
Posts: 52
Joined: Saturday 21 May 2016 20:12
Target OS: NAS (Synology & others)
Domoticz version: V4.10717
Location: France
Contact:

Re: Davis Vantage Rainmeter and ESP32

Post by benp »

mgugu wrote: Saturday 20 April 2024 19:06 This may be an electromagnetic interference problem (15 meters is a lot), several checks possible:
Thank you. I simplified the wiring: nothing plugged to the ESP32. Only the INPUT_PULLUP: I still have the problem: the interrupt fire 3 times per hour up to one time per 8 hours.
mgugu wrote: Saturday 20 April 2024 19:06 But definitely it is not a Domoticz problem but an electronic one
According to this experiment: that's not a Domoticz problem neither an electronic problem but an Arduino/ESP32 problem.
I will post to the Arduino forum: link coming soon here.
Domoticz V2024.7
benp
Posts: 52
Joined: Saturday 21 May 2016 20:12
Target OS: NAS (Synology & others)
Domoticz version: V4.10717
Location: France
Contact:

Re: Davis Vantage Rainmeter and ESP32

Post by benp »

Here is the link to the arduino forum:
https://forum.arduino.cc/t/stange-ghost ... cz/1250942
Domoticz V2024.7
benp
Posts: 52
Joined: Saturday 21 May 2016 20:12
Target OS: NAS (Synology & others)
Domoticz version: V4.10717
Location: France
Contact:

Re: Davis Vantage Rainmeter and ESP32

Post by benp »

The link to the Arduino forum:
https://forum.arduino.cc/t/stange-ghost ... cz/1250942

The ghost interrupt problem is SOLVED: this is an ESP32 bug.

Ghost interrupt can occur with wifi sleep so wifi sleep must be disable!
I will update the first post with link to working code.
Domoticz V2024.7
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests