DIY wind sensor with xiaomi door contact

Hello,

I am going to build a diy anemometer with an attached xiaomi door contact. I wanted to use it for my sprinkler system to not let it start, when it is too windy.

Giving it a little more thinking, the idea with the door sensor that is opening and closing with the rotating anemometer has some flaws… building the hardware is not the issue.

First of all, how long does the battery last, when I open and close it like 50 times a minute? Does that reduce the life span?

My second issue is, that each opening and closing an event gets triggered and logged in the log files. I dont want to have that traffic on my system. Is there any way to deactivate the logging for a single item? Or can like 50 events bundled and only 1 gets reported in the logs every couple minutes.

Thanks in advance!
DZ

EDIT: the sensor will be a xiaomi door contact that is connected via zigbee2mqtt. Another idea: can i maybe reduce the traffic already in the mqtt broker or so before it is used by openhab? Just an idea…

Battery could be an issue with any design. I love this idea!

I would be inclined though to use and esp with a mag switch. Issue there would definitely be battery life. But with esp maybe you could only turn Wifi on once every few hours. Or only turn on within one hour of running sprinklers.

Other option maybe use the weather binding and read the wind out of it. This might be good enough. No hardware required. Of course in the nature of tinkering hardware is cool!!

I guess the life span is a trial and error…
I will maybe build a little gear where the sensor and the magnet only once in a while pass by each other. But that would be still pretty frequent im thinking.

Can I maybe also turn on the zigbee Sensor temporarily? Or maybe i could jam the propeller in the time i dont need it spinning. Any recommendation for a device that moves a little pin out?

The forecast is not good enough, therefor i am also going to build a rain sensor. Also based the same way with a xiaomi door contact. That should be as frequent as the wind sensor. And here i dont see that issue.

I don’t think you will be satisfied with the xiaomi door contact for this. It’s designed to be a door contract that activates a few times a day, not 50 times in a minute.

One you added in all the tinkering you are talking about in order to make the sensor work you may as well just build something from scratch using an ESP and a $2 Reed sensor. There are tons and tons of diy esp weather station tutorials it there and dozens of tutorials for how to get them to last months to years on 4 AA batteries.

Finally, I’m a really big proponent of putting the “smarts” as close to the device as possible. It really shouldn’t be OH’s job to calculate the wind speed bad based on the time differential between Reed sensor readings. It will be far more accurate and reliable and consume far fewer resources if that’s handled at the sensor instead and the sensor reports the wind speed at some acceptable frequency that balances timely reporting with the battery life of the sensor. A xiaomi door sensor is never going to let you do this.

1 Like

Rich has the right idea here. I haven’t measured the minimum cycle time of that device, but I suspect it won’t be fast enough. A reed switch would work, as would a magnet and hall effect sensor (also dirt cheap).

An important point; like most PIRs this sensor would surely apply “pulse stretching” as a debounce mechanism. Very desirable in the intended usage.

Also wonder how well zigbee network handles devices spamming a hundred messages a minute.

Yep. Much better to have a local microcontroller (e.g. ESP8266) watching for interrupts on a hall effect sensor and processing those raw events into a useful wind speed over some interval…30s or whatever. Then send that over MQTT.

1 Like

Thanks for all your input!

I put the wind sensor off for now. But I still built a rain water sensor with a xiaomi door contact. That works actually really fine!

It tipps as soon as the little spoon gets full of water and closes the contact for a moment. I can count how many closings i had and tell my sprinkler routine not to start when i tiped more than 10 times. I could also calculate the rain amount per square meter, but for my purpose thats not necessary.

With a normal rain it tips maybe 10-15 times per day. My record was 84 tips (but on that day it rained more than cats and dogs).

3 Likes