General > General Technical Chat
PWM'ing a 250W heater.
paulca:
It's recovering. Turning the heater to point the sensor for an hour fixed it. Humidifier seems to have recovered too.
Managed not to get shocked even moving the heater around.
Fixing the ambient humidity was just a matter of opening the door, the trickier part is drying everything out, but it looks like it's working. I increased the extractor fan rpm to where the heater can't keep up and runs constantly, but when the temp drops too far the extractor shuts off, it warms up, absorbs moisture and then gets vented when the extractor comes back on. I can see on the graphs the heater struggling less and less as the thermal mass goes down as things dry out. The current measured humidity (with compromised reliability) is 78% and falling.
Time lapse:
https://youtu.be/i9Rja644X0M
Ian.M:
Good. I still think adding a backup wet-bulb sensor would be worthwhile. It would let you detect failure of your integrated humidity sensor, and also script recovery from a similar situation, which could occur as a result of any significant power outage or a sudden and severe drop in external ambient temperature such that your heater is insufficient to maintain the target temperature.
paulca:
Second fault. Caught this one fairly quickly. A software bug! Shame on me.
The power bar publishes it's state on a message topic. However to get a snapshot of it's state you need to send it a message on another topic. I had added this of course. So when my controller was run it would send a status request for each of the sockets and that would bring it into consistent state with the device and I don't need to spam, "ON", "ON", "ON", "ON" everytime the temperature changes 0.01 degree. If I "know" it's already ON, just leave it.
The first issue is that I sent the status request before the client connected and it got dropped. So my view of the socket state showed them all "OFF" and so it "left the heater off" as it should be off.
The temperature sored to 30*C.
The second issue is MQTT. It's great, but, like most asynchronous message buses it has it's downsides. Message loss is an issue. Not "over the wire" as TCP should correct packet loss, but in many corner cases messages get dropped, over written in caches, dropped on disconnect etc.
I have been trying to avoid having to wrap my own layer of transactional context on top of MQTT, but this project makes me reconsider that.
I am thinking of using the Promise style pattern. Instead of chucking the command message over the fence with just a "publish( topic, message )" and hoping I get an appropriate action, I should send a request() and get a Promise in return. A Promise is a contract that the component you requested something from WILL give you a response. Not now, but later. It might be a success or an error, but you will get called back. (For old-school folks, it's a async-callback).
The code behind it would publish the command message, but wait for the status topic to reply back with the same state as requested for a short timeout, maybe retry a few times and finally return success or failure in the promise assigned call back.
The end-device does not implement request IDs, so no way to track request-response 1 for 1. Just need to wing it.
In the mean time, I added a timer to republish status requests every minute, just in case.
paulca:
Next challenge, asides checking the calibration on the humidity sensor is to automate the extractor fan speed.
It has a knob controller already. I imagine as it's a 240V 50W fan it will probably be a triac? So all I really need to do is measure the control voltage it produces and mimic that from an analogue MCU pin.... unless it's not a DC controlled Triac of course.
Could I just use a normal 240V dimmer circuit on a mains motor?
Alti:
Do not focus too much on heating, loosing main objective.
And main objective is to not to burn your house down. Make sure that in case of any controller failure the losses are contained. If the failure of some component (fan) brings fire hazard - this is not what you want. If you still need that controller, use some safety rated components, like thermal cut-offs. So peak mains voltage, lowest tolerance heater element, triac dead short and seized fan should not cause havoc there.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version