Tank Level control & Drain valve closure - Printable Version +- SIP (https://nosack.com/sipforum) +-- Forum: SIP (Sustainable Irrigation Platform) (https://nosack.com/sipforum/forumdisplay.php?fid=1) +--- Forum: Plugin suggestions (https://nosack.com/sipforum/forumdisplay.php?fid=7) +--- Thread: Tank Level control & Drain valve closure (/showthread.php?tid=138) Pages:
1
2
|
RE: Tank Level control & Drain valve closure - dan - 2018 Nov 28 Hi Ben, It has been a while. I wanted to let you know about some progress I have made with the tank level plugin. I have re-written the code for the ultrasonic distance sensor using the pigpio library. http://abyz.me.uk/rpi/pigpio/ The library is included with the latest full versions of Raspbian OS. If you are using the light version you can install it with: Code: sudo apt-get update and enable it to start at boot up with: Code: sudo systemctl enable pigpiod The new version of the ultrasonic code is much more accurate than the original and has fewer lines of code. The pigpio library uses a C program running in the background and does timing in micro seconds. Here is some output from the new code without averaging multiple measurements: 155.2 155.3 155.2 155.2 155.2 155.2 155.2 If you get a chance, try it out and let me know what you think: Code: #!/usr/bin/python I will be working on the plugin over the next few days. The rainy season has started here and I have time for coding. Dan RE: Tank Level control & Drain valve closure - beno_283 - 2018 Dec 11 Hi Dan, It has been a while but we all get busy that's for sure. I've tested the new code which works perfect until it is left running for after 5 minutes then you get a really low number compared to the rest here and there. The plugin will have to operate for a short period or increase the sampling rate. But once again Dan great work!! RE: Tank Level control & Drain valve closure - dan - 2018 Dec 11 Hmm.. I ran the code for about a half hour and didn't see any great variation in output. Raspbian is not a real-time operating system. It switches between tasks in the background and this may cause occasional problems with timing. I am running the lite version which has fewer background processes than the full version. I added a check in the code that will skip any reading that is much different from the previous one. This should provide a more consistent output than averaging multiple readings if there is an outlier. You can find the updated code on GitHub at: https://gist.github.com/Dan-in-CA/681a1a705cc80330e0a7ed48662492c6 Dan RE: Tank Level control & Drain valve closure - dan - 2018 Dec 12 Ben, I have a question. First, the plugin page will have some fields for user input:
click to enlarge. The water level will be calculated by subtracting (measured distance + sensor offset) from the maximum capacity in cm. When the water level reaches the minimum, do you want SIP to suspend / stop all programs? or Do you want SIP to switch to an alternate water supply? That would involve using 2 master valves, one for the tank and one for the other water supply. SIP already has a master valve option for a single station to be master. We could probably have the plugin select a second station for the alternate supply. The plugin could re-assign which station is the master without making any changes to the core program. If the tank is filled by rain, you would probably want to have the plugin switch back to using water from the tank. That would require an additional input field for a water level that would trigger the switch back to using the tank for irrigation. Let me know. Dan RE: Tank Level control & Drain valve closure - beno_283 - 2019 Mar 16 (2018 Dec 12, 12:04 AM)dan Wrote: Ben,Hi Dan, Sorry for the long delay in replying, this year has just taken off! The Maximum capacity is 180cm, the measured distance from the sensor to the minimum is 160cm minimum level is 10cm. In this instance there is no backup water supply, just the rain. Could we make this all into a plugin where the maximum capacity, offset to the sensor and backup master valve allocation? Cheers Ben RE: Tank Level control & Drain valve closure - dan - 2019 Mar 16 OK, I'll see what I can come up with. will post here when I have something for you to test. It may be a couple of weeks as it is planting time here and there are a couple of other projects I am working on. Dan RE: Tank Level control & Drain valve closure - sobrino - 2020 Oct 23 Hello, I have been using SIP for a few years and now I have started to try to complete and integrate this magnificent system, this plugin would be perfect for my needs and the complement on the website but I see that it has been stopped for a long time and I wanted to ask if it was finished or it was abandoned. thx RE: Tank Level control & Drain valve closure - dan - 2020 Oct 24 It is still on the list of things to do. I may have time to work on it soon. Dan |