kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.93k stars 491 forks source link

Dry / Wet Bulb feature request #335

Closed eap904 closed 6 years ago

eap904 commented 6 years ago

Is there a way to use 2 temp sensors and designate 1 as a wet bulb, and have it calculate RH?

I've used BME280 and DHT 22 sensors, both of which have trouble recovering from condensing fog which is optimal for mushroom pinning. Simple wet/dry bulb temps should provide an accurate and durable solution.

kizniche commented 6 years ago

I added a BME280 sensor next to my HTU21D-F sensor and its humidity is much closer to the wet-bulb calculated humidity. So, it may be that my HTU21D-F is measuring under what the actual humidity is, or the BME280 and the wet-bulb are high. I have a nice DTH35 humidity probe that was suggesting the more accurate measurement may be on the lower end. I'll test in a more controlled way when I have a chance to turn off the cooling system so I don't have as much temperature variability, so I can determine which digital humidity measurement is more accurate.

screenshot-10 48 44 226-2018-02-14-16-23-39

kizniche commented 6 years ago

BTW, I found wet-bulb wick difficult to source, however there was one vendor that sold a lab sample pack of 1 yard segments of various sizes (among other longer lengths for each size) for $25 USD, at http://pepperell.com/wet-bulb-wick-sample-pack/

I just ordered this for testing and will report back how well it works. This hydrophilic cotton should be substantially better than the hollow nylon braided rope I'm currently using.

zsole2 commented 6 years ago

My testing is somewhat stalled... When I placed the two sensors into the fridge, the temp lines lost their almost perfict parallelism. It appears that the placement of both sensors is crucial (same distance from he backside, same hight, so many variables), so I will play with it next until I get better results. Not that I'm surprised, I expected that the small volume and the temperature fluctuation will not play nicely. Speaking of fluctuation, the recently implemented PID-band feature may also play a role in this, it is set now for a 2 C wide band, and it is followed by a nice sinusiod curve. Maybe I'll have to turn it off.

kizniche commented 6 years ago

Do you have a circulatory fan in the fridge?

eap904 commented 6 years ago

can you have the BME sensor and the DSB180 sensors both hooked up at the same time? When I set mine up the pin I had to use for the DSB sensors was one of the I2C ones required for the BME280

zsole2 commented 6 years ago

@eap904, you can edit /boot/config.txt, and add to the end of the line for the 1-wire interface the BCM pin number you want to connect your DS18 sensor. For me, it looks like this: dtoverlay=w1-gpio,gpiopin=5

zsole2 commented 6 years ago

@kizniche, I have two fans, one at the backside to help defrosting, and one at the front/bottom, to circulate the mist generated by the humidifier. Both of them are constantly ON. I intended to add the wet bulb at the bottom, to the intake side of the fan to have good airflow. Obviously the bottom of the fridge is always colder, it is about 2C degrees for me, so I need to investigate further. The above mentioned fluctuation does not look really bad: image

But looking at the difference is more concerning: image

kizniche commented 6 years ago

can you have the BME sensor and the DSB180 sensors both hooked up at the same time?

Yes. By default, SDA is pin 2, SCL is pin 3, and 1-Wire is pin 4. Unless you created a custom configuration, you should be able to use both of them by merely enabling the I2C and 1-Wire interfaces from the Mycodo Pi Configuration page or with raspi-config from the command line.

But looking at the difference is more concerning

Unfortunately, the small size and the use of a large temperature swing might make the wet-bulb humidity calculation pretty variable.

kizniche commented 6 years ago

I received my lab sample pack of hydrophilic cotton wicks (ref) and fitted the tightest one that fit to my wet-bulb. It appears the accuracy improved, as the calculated humidity is much closer o one of my humidity sensors. Still not validation of the actual humidity, but it seems the sock makes a significant difference.

screenshot-10 48 44 226-2018-02-21-12-26-55

kizniche commented 6 years ago

Here's a comparison of the humidity using my improvised nylon sock to the hydrophilic cotton sock (ref):

Nylon sock

screenshot-10 48 44 226-2018-02-14-16-23-39

Cotton sock

screenshot-10 48 44 226-2018-02-21-12-30-17

Now that I'm looking at these side-by-side, and without any statistics performed, it appears there's a slight improvement.

zsole2 commented 6 years ago

This looks promising. I still have to pick up my new sensors first, and tinker with their placement. And should find similar wicks a little bit closer, or check their shipping costs to Hungary.

kizniche commented 6 years ago

Here are some photos of my test setup. I currently have a standalone humidifier inside my incubator, connected to an internal power strip that's controlled by Mycodo, until I get a replacement circuit board to fix the incubator's humidifier. You can see the digital sensors at the top left and the dry-bulb temperature sensor (DS18B20) sensor at the top right. Under the fan is the wet-bulb temperature sensor (DS18B20) with the hydrophilic cotton sock that's submerged into a 50 ml Falcon tube filled with water.

img_20180221_155428_2

img_20180221_155451

img_20180221_155536

The new dashboard elements, especially the PID, make it very handy for tuning. Adding the P, I, and D values turned out to be a very good recommendation. Now I can see specifically which value is contributing the most or not enough and adjust the gains and Integrator min/max accordingly. The last tuning parameters on the graph below were Period=30s, Kp=0.1, Ki=0.1, Kd=2, Integrator Min=-100, Integrator Max=100

screenshot-10 48 44 226-2018-02-21-18-02-59

It's also pretty interesting to see the wet- and dry-bulb temperature difference decrease as the humidity rises. It's not wow!-interesting, but interesting nonetheless.

screenshot-10 48 44 226-2018-02-21-16-37-47

kizniche commented 6 years ago

And here's one last screenshot to see what kind of regulation the last tuning produced over the past hour. Note the regulation is using the BME280 sensor's humidity measurement, not the wet-bulb humidity. This was a test to see how the wet-bulb reacts in a humid environment (conclusion: it looks good!).

screenshot-10 48 44 226-2018-02-21-18-41-27

kizniche commented 6 years ago

@zsole2 You may want to design a shroud for your dry-bulb temperature sensor to protect it from direct air current, while still allowing a small amount of airflow for it to be able to homogenize to the environment's temperature quickly. I suspect with your chamber's high humidity, there's slight condensation forming on the dry-bulb sensor, and with such a small environment there may be air currents contacting it and cooling it through evaporation. If you can isolate your dry-bulb sensor enough from the air current, I think your humidity calculation would become more stable.

zsole2 commented 6 years ago

Your setup looks quite nice, and results, as well. The Falcon tube seems to be a good idea, maybe I'll implement it, too. Wonder haw long the water lasts... But probably the wick needs to be replaced regularly, so these can be performed at the same time. Unfortunately, I got some kind of flu, and my new sensors were delivered my workplace, so I'm delayed again.

kizniche commented 6 years ago

I've noticed when my compressor activates and the temperature drops, the humidity also takes a dive. This causes my PID to overcompensate, sending the humidity to 100% before bringing it back down to 90%. I believe a large part of this is the condensation on the cold condenser, which causes the humidity to be removed from the air, followed by that condensation evaporating from the condenser when the AC heat bypass activates (allowing the temperature to start rising again). Here's a graph that includes 3 cooling events, with the last one I modified the PID to use a prolonged period in an attempt to cause the PID to react slower. I still haven't achieved a satisfactory tuning, yet I persist.

screenshot-10 48 44 226-2018-02-22-18-36-09

kizniche commented 6 years ago

I just had an idea how to alleviate my humidity issue. What I need to do is smooth out the humidity measurement by averaging it with the previous measurements. Though, what I'm not sure of is where to implement this feature. Do I make a new Math controller, add it as an Input option, or add it as a PID option?

kizniche commented 6 years ago

It looks like that should work. I'll be able to test tomorrow.

screenshot-192 168 0 10-2018-02-23-01-43-10

zsole2 commented 6 years ago

I can agree with your analysis on the humidity drop. In fact, I can see it in my fridges, the vapor freezing out on the back wall. This is the problem I have been facing since the beginning. Smoothing seems like a good idea to make the graph nicer, but my concern is that it hides the reality that the humidity in the chamber really is decreased due to freezing out.

kizniche commented 6 years ago

My intent isn't to make the graph nicer but to prevent the large dip that quickly comes back up. This dip is what causes the PID to overcompensate and turn the humidifier on longer. I'll see in a few hours.

kizniche commented 6 years ago

So, it appears my new Math controller to average single measurements didn't help much with my humidity oscillation issue. However, I found if I limit the output sufficiently, it can prevent the humidity from reaching 100%. I was able to stop it just at 98% before it started falling again, which is acceptable for my application.

You can see in the graph the first oscillation event isn't limited and has a badly-tuned PID and reaches 100%. The second event is with a better tuning, but isn't being limited, and reaches 98.7%. The last event is with the better tuning and limited to an 8.5 second duration, and only reaches 98%.

screenshot-10 48 44 226-2018-02-23-15-04-43

kizniche commented 6 years ago

This thread is getting needlessly long. I'm going to close it. Feel free to start a new thread if any new issues or questions arise.

kizniche commented 6 years ago

I think I finally have a nice regulation going in my incubator. I received my new humidifier circuit board and transducer, so everything is now operating internally. Here's my test that ran all day.

screenshot-10 48 44 226-2018-03-06-18-42-13

Each dip then spike in humidity is when the cooler turns on and the humidity condenses on the heat exchanger, then evaporates when it turns off and the humidity spikes.

zsole2 commented 6 years ago

Wow, this looks great! But I guess yours is a professional grade cabinet with built-in humidifier. Good to see that the humidity values nicely correspond to each other with the three measurements.