Seeing as I have had so much rain recently I thought I would revisit an old shelved project.
The Gauge sender unit has a transmitter that triggers a receiver relay for every 0.2 mm of rain. Simply adding 0.2 or 2/10 eventually gives a rounding error so it no longer is adding an even decimal number. I have seen a solution where the addition is in a whole number of 2, converted to a string which is then split and shifted to the right of a fixed decimal point so it looks divided by 10. I think that is how I remember it!
Could someone please give me an idea of how to do it as my brain is done with searching for it!
Thanks
Rain Gauge
Moderator: Benj
-
- Valued Contributor
- Posts: 618
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 195 times
- Contact:
Re: Rain Gauge
Hi
Have a look at this post, it should give you ideas on displaying numbers divided by ten using strings etc
https://www.matrixtsl.com/mmforums/view ... 76&t=21240
I'm sure you could probably modify to suit your needs.
Medelec (I think?) also posted an extensive article on a 55V meter that if I remember correctly used string manipulation to display the readings using decimal points. That would be worth a forum search for too.
Hope this helps,
Regards
Have a look at this post, it should give you ideas on displaying numbers divided by ten using strings etc
https://www.matrixtsl.com/mmforums/view ... 76&t=21240
I'm sure you could probably modify to suit your needs.
Medelec (I think?) also posted an extensive article on a 55V meter that if I remember correctly used string manipulation to display the readings using decimal points. That would be worth a forum search for too.
Hope this helps,
Regards
Re: Rain Gauge
Nearly there with this.
The closest i can get on the display is:
2.2
4.4
6.6
8.8
1.0
1.2
1.4
1.6
etc to 9.8 then it rolls over to 1.2. Increasing the string length to [2] to get beyond 10 makes the addition much worse.
Is there some way of blanking or converting the double number in the first 4 additions and get to count beyond 10?
I have tried most combinations but this is the best I can get!
Ian
The closest i can get on the display is:
2.2
4.4
6.6
8.8
1.0
1.2
1.4
1.6
etc to 9.8 then it rolls over to 1.2. Increasing the string length to [2] to get beyond 10 makes the addition much worse.
Is there some way of blanking or converting the double number in the first 4 additions and get to count beyond 10?
I have tried most combinations but this is the best I can get!
Ian
- Attachments
-
- rain gauge.fcfx
- (55.55 KiB) Downloaded 120 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Rain Gauge
Hi Ian.
I have started from scratch with the rain gauge, so not all functions are added yet.
Wanted to see if you are liking they way flowchart works first?
Just the top two switches and top LCD are enabled for simulation.
I would recommend the LCD to be changed from port B so the other INT pins can be used.
E.g for changing the day.
LCD spacing are OK for <10.0mm of rain.
If you needed to display 10mm or greater then I would recommend 3 spaces between days, instead of 2
I have started from scratch with the rain gauge, so not all functions are added yet.
Wanted to see if you are liking they way flowchart works first?
Just the top two switches and top LCD are enabled for simulation.
I would recommend the LCD to be changed from port B so the other INT pins can be used.
E.g for changing the day.
LCD spacing are OK for <10.0mm of rain.
If you needed to display 10mm or greater then I would recommend 3 spaces between days, instead of 2
- Attachments
-
- rain gauge Simplified.fcfx
- (24.83 KiB) Downloaded 117 times
Martin
Re: Rain Gauge
Wow Martin! I Wasn't expecting a re write - it must have been bad lol. My methods tend to be quite mechanical whereas you can achieve a result with some slick calculations. I like it and have been studying and changing some of it just to see how it works. Definitely open it up for more than 10mm as that seems to be mere passing shower these days! "Sunday" gets left in caps as the week rolls over so I got it to re write the days as in the start, just to see if I could. I will change the display to the C port I just have to wade through a tangle of wires but its worth doing.
Many thanks
Ian
Many thanks
Ian
- Attachments
-
- rain gauge Simplified2.fcfx
- (26.09 KiB) Downloaded 112 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Rain Gauge
Hi Ian,
you're welcome.
No, not rewrote because I thought it was bad.
I just wanted to show you an alternative way.
I have modified flowchart so will will now work with up to 99.9 mm of rain instead of 9.9.
Its also slightly more efficient when display has to start from day 1.
you're welcome.
No, not rewrote because I thought it was bad.
I just wanted to show you an alternative way.
I have modified flowchart so will will now work with up to 99.9 mm of rain instead of 9.9.
Its also slightly more efficient when display has to start from day 1.
OK ,I have left that for you to do.
- Attachments
-
- rain gauge Simplified3.fcfx
- (25.39 KiB) Downloaded 129 times
Martin
Re: Rain Gauge
Hi Martin
That looks brilliant! There are quite a few changes to digest, its great to see and learn how differently you do it, just the simple things like like the day input triggering a loop that runs until the input drops to 0. I had a long delay because there was minimum of a minute trigger from the time clock.
Ultimately I want to get it so that at the end of the week the daily totals drop down one line.
Short term I will build the hardware onto some veroboard to get it off the breadboard and wire the display to port C but at the moment my receiver is triggering like there is a monsoon outside, only there isn't
Many thanks Martin you have just brought me on 10 years, if you have further inspiration please don't hold back!
Ian
That looks brilliant! There are quite a few changes to digest, its great to see and learn how differently you do it, just the simple things like like the day input triggering a loop that runs until the input drops to 0. I had a long delay because there was minimum of a minute trigger from the time clock.
Ultimately I want to get it so that at the end of the week the daily totals drop down one line.
Short term I will build the hardware onto some veroboard to get it off the breadboard and wire the display to port C but at the moment my receiver is triggering like there is a monsoon outside, only there isn't
Many thanks Martin you have just brought me on 10 years, if you have further inspiration please don't hold back!
Ian
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Rain Gauge
Hi Ian,
You're welcome.
However you want your flowchart to function, there will be help on here.
If you try and implement a function and it does not work then I will take a look at it for you.
You're welcome.
However you want your flowchart to function, there will be help on here.
If you try and implement a function and it does not work then I will take a look at it for you.
Martin