Rain sensor
-
@mbj - Great work and thanks for sharing!
What is the IC beside the atmega? Ftdi?@sundberg84 Thanks. The item is an inverted Schmitt trigger used to get a clean signal. What came from the reed relay was awfully bouncy so readings were not consistent.
-
Is there a chance you can post the code? I'd be interested to see the time to midnight function.
-
Interesting design, but I'm wondering why you don't just send a message every time the bucket tips, and then do all the tallying and midnight rollover stuff on the controller?
@Carywin
That is an alternative way of doing it, and also much simpler to code and also good enough for a rain sensor. It seems I always tend to complicate things :-) so I have tried to design this type of functionality (with counters and alike) to be inside the sensors because if the controller (here OpenHab) is down for any reason the sensor lives its own life and once everything is up again the sensor can report a correct value. I have the same type of functionality for the energy meter sensor which is based on the MySensors Energy Meter.If the sensor has been down it can receive last known value from OpenHab with an incoming message but any readings while down are of course lost. Also a manual set value can be received.
Does it make any sense?
-
Is there a chance you can post the code? I'd be interested to see the time to midnight function.
@Mark-Swift
I have not looked at the code for nearly a year so have no idea if it is usable or not for anybody else. Right now I have no time to take a look at it but will dig it out as soon as I get a chance, hopefully within the coming week. -
@Carywin
That is an alternative way of doing it, and also much simpler to code and also good enough for a rain sensor. It seems I always tend to complicate things :-) so I have tried to design this type of functionality (with counters and alike) to be inside the sensors because if the controller (here OpenHab) is down for any reason the sensor lives its own life and once everything is up again the sensor can report a correct value. I have the same type of functionality for the energy meter sensor which is based on the MySensors Energy Meter.If the sensor has been down it can receive last known value from OpenHab with an incoming message but any readings while down are of course lost. Also a manual set value can be received.
Does it make any sense?
@mbj Yes I see what you're trying to achieve.
I would keep a 16 or 32 bit counter in the rain sensor, and increment it on each bucket tip and send the new value when it changes. Then in the controller take care of tallys and midnight resets, but with some extra logic to handle when the counter value rolls over (that will take a very long time :D) or the sensor restarts. This would also mean you don't miss any pulses when the controller is down because the sensor is still counting, but a sensor restart won't reset your daily tally.
Another idea would be to have a reset command sent by the controller around midnight. There would need to be some logic where the controller waited until the sensor was awake again before sending it commands, but that seems simple enough.
Or just put a RTC on there XDHaving said all that I will look forward to reading your code and seeing the timing solution!
-
@jumping Unfortunately I had no time to look at anything last week and i will not be able to do it the next cople of weeks because of travelling but I promise it will come. I assume that you also have seen the code for a rain sensor at the Mysensors forum but if not take a look there in the meantime. I know this is a different solution but might be of interest anyhow.
-
-
@jumping Unfortunately I had no time to look at anything last week and i will not be able to do it the next cople of weeks because of travelling but I promise it will come. I assume that you also have seen the code for a rain sensor at the Mysensors forum but if not take a look there in the meantime. I know this is a different solution but might be of interest anyhow.
@mbj said in Rain sensor:
@jumping Unfortunately I had no time to look at anything last week and i will not be able to do it the next cople of weeks because of travelling but I promise it will come. I assume that you also have seen the code for a rain sensor at the Mysensors forum but if not take a look there in the meantime. I know this is a different solution but might be of interest anyhow.
No problem :-) thanks