-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dual interlocking relays and 3T valve #8
Comments
Can you give me a link to how the device operates? |
For instance this one: |
Right, understood. Whether the current s/w will cope with that depends on what you want to do. If you want to linearly control the flow so the valve might be sitting at half open for example then the answer is no, I am afraid the current PID algorithm won't cope with that. As the motor drive is itself a free integrator then that knowledge needs to be built into the algorithm, effectively replacing the integral that is currently included in the software. To do that would not be a trivial task and I haven't got any plans to do it at the moment. |
Ok, that's what I was afraid of. Unfortunately treating it as a simple open-closed valve would not work because that valve directly controls the temperature of the water going into the radiators in the house. The hot water tank where it gets its water from is often sitting at 90C. Now if someone were to add valve/shutter control logics with positioning to Tasmota - making it possible to set the output of such a device in 0-100% range. Would that be easier to implement to PID control? |
Yes, if there was s/w given a required valve position in the range 0 to 1 (for example) that moved the valve to that position (or at least, knowing where the current estimated position is, moved it in the right direction for the right time so that the position estimate is the required position) then the existing PID output could be fed directly to that. It would not be as good as building it into the PID algorithm but it could probably be made to work. Of course if the valve had position feedback then it would be much better (and more expensive). |
Ok, that's good news. As a matter of fact, that is exactly how I am using the Node-Red PID controller right now. I scale the 0-1 output up to 0-99 integer values which I feed directly into the Fibaro roller shutter module as position. Works like a charm but I'd prefer to have a contingency plan in place should there be a failure of one of the components. The Fibaro Z-Wave roller shutter module does a great job at estimating the valve position without any feedback. I guess it measures the travel time and then just keeps track of its position based on how long it has been moving in one or the other direction. It also seems to "re-calibrate itself" every time it reaches one of the end switches. I'll look into achieving the same with a Sonoff Dual. |
It shouldn't be two difficult to write a function node in node red to emulate the shutter module. Once that was working then it could be re-coded for the sonoff. I don't have time to look at that at the moment though. |
Looks like @stefanbode has done the heavy lifting already: https://github.com/stefanbode/Sonoff-Tasmota/wiki/Shutter-blinds-working-with-two-relays Are there any plans of pushing the PID control functionality back to the main Tasmota branch at some point? I'm trying to decide on the best course of action. Right now it seems I would need to juggle these three branches into one of my own to get the most up to date version of all components involved. |
Excellent. No there aren't any plans to get it back onto the main branch. I check occasionally that it still works but I don't think it would be worth the effort to continually keep up to date with the latest, it changes too often. Since you don't need the timeprop feature all you need to do is to pick up the two PID files in lib/ProcessControl and the xdrv92 pid file from my branch and add them into your code. My code changes very rarely, I fixed a problem with setting PB to zero recently so it goes into on/off control properly but there is nothing else going on at the moment and I don't know of any issues with it. |
Great! I'll see if I can get all three parts playing nice with each other then. |
Let me know how you get on. It would be worth adding the details to the tasmotta wiki if you get it going. Either as a separate section or added to my bit. |
Ok, so I seem to have both, the shutter and PID code running side by side. However, they are not quite playing nice yet. At first I tried to take the latest Tasmota firmware and add your and @stefanbode's code to it. Unfortunately his was quite extensively changed and I ended up just taking his full code and adding your PID file/library to that. Now I have the shutter part working and I see your PID power value every time there is a temperature report. The only thing I'm not sure on, is how to feed that power value to Stefan's shutter position directly within the sonoff. His code accepts commands like: "Shutterposition xx" I'm thinking rules might be the way to go? I've not used the rules system yet so unsure if that would be the route to take. |
I haven't used the rules either.
if you add above there something like
and then define PID_USE_SHUTTER in your config obviously then it wll call that function each time round. |
Yup, that did it! I was trying to avoid having to make any changes to the actual code on any side of the equation that is why I was looking into Rules. It seems that rules would actually work well for this also. I just could not figure out how to trigger a rule off your Pid_ power report. For now I ended up adding this small snippet:
to where you suggested. |
Excellent. Could you make it PID_USE_SHUTTER so that it is clear what it is for. We want to make sure that all #defines used by the pid code are unique, with it just being USE_SHUTTER the code might get included accidentally if USE_SHUTTER were used for something else. You could imagine someone using shutters with manual control and using the pid control for something different in the same device. |
The USE_SHUTTER is the same variable that enables shutter functionality in Stefan's code. I just reused that. But now that you mention it, it does make sense to have a separate variable to enable/daisble PID control for said shutter. My current solution also does not account for different number of shutters nor can you specify which shutter it would control. This leads me to another question - would it be possible to have multiple instances of the PID control running? So that if I were to hook up 8 relays and 4 temperature sensors, I could have them all working independently? |
Hi gents, |
You can only have one PID as it is currently written. It could be extended to allow multiple instances but I think you might start running out of processor and memory pretty quickly. If I were doing that I would use a Pi with node-red. The same algorithm is available in node-red. Can the shutter code drive multiple shutters? |
Yes up to 4 with 8 relays, but this is also only one configuration. Normally more does not make sense. Theoretically, 16 up to 32 valves should be possible with some minor changes and hardware like the PCF8574 |
Well, I gotta say both you gentlemen have done awesome job with your respective codes. The only thing I would really love at this point is if we could get the PID and shutter codes pushed back into the main Tasmota repo. At the moment it seems that PID is very well isolated and should not require lot of upkeep to stay up to date with main branch changes. If needed, I'm willing to play the man-in-the middle and create a uniform PR for the joint code and help run maintenance in the future should things break with upgrades. I would need some guidance from @stefanbode with his code though. As it contains so much more than just the shutter control. |
I should have thought of the possibility of multiple loops when designing it in the first place. It wouldn't be that difficult to extend but I don't have time at the moment. PRs always welcome :) |
Let me change the Web interface to the new method. Arendst has made it easier do to enhancements also here. My shutter needs the modified INTERLOCK and the SHUTTER module. The changes INSIDE the master code should be ~5-10 smaller ones. My Problem is I do not know github that well that I can do a PR request out of my fork. |
Where do I find your PID enhancements in the code? Just point me to a starting point. |
I have opened an issue on @stefanbode fork to carry on talking about the integration. |
I had not been using the PID function for a while. Mainly because I could not be bothered with making the changes needed when upgrading. Today I decided to try it again, and it's dead easy. Only one modification needed - maybe @colinl could incorporate it into the code? I don't have a development environment set up currently or I'd make a PR Anyways, the added snip is this: right before PID_USE_TIMPROP
And an additional PID configuration parameter is PID_SHUTTER which holds the number of the shutter to use for PID output. And that's it! Works like a charm. I have 6 local DS18B20's hooked up to my 4CH Pro, so I'm using a Rule to capture the correct temp value and issue a pid_pv command. Works like a charm. At this point the Sonoff is a complete standalone heating controller for my house. The ruleset below manages the temperature of the water going into my radiators, turns radiator circulation pump on and off when needed, and also turns on/off my boiler circulation pump depending if the boiler is heating or sitting idle.
|
Created a PR for this |
How do you solve shutter drift issue? I calibrated 3T valve as a shutter precisely as I can but in a week it's going to drift so it will not fully close or fully open, you have to cycle from 0% -to 100% so that the position in Tasmota reflects the reality. Often times it's impossible to cycle it to 100% because 110c water is going to melt my pex pipes. |
I’ve been using a z-wave roller shutter module and node-red to control my central heating for over a year now. I’d like to give sonoff a hard thermostat a go in stead to mitigate any issues when the pc crashes for instance.
I’m not completely sure I can control my 3T valve like that though. It looks like it would require two, mirroring outputs with a dead zone between them. Otherwise the valve would end up constantly either opening or closing. Am I over thinking this?
The text was updated successfully, but these errors were encountered: