Electric Blanket Preheat Control Ideas Wanted

It's that time of year again when jumping into a cold bed will keep you awake for awhile.

I'm looking for suggestions to send a momentary pulse to activate a relay to turn ON the controller. Then after that with a second relay, send 10 pulses to the UP controller button. The pulses would mimic pressing the controller button to set the heat to maximum.

The sequence of ON and 10 pulses would be automated at a certain time each night. Maybe a ESP32 at the controller?

I'm familiar with turning things on and off with NR. Just not sure how to send 10 pulses?

How are you sending one pulse? Do you mean you are turning a hardware pin on and then off?

Yes, one output pin will control the power on relay. A second output pin will control the relay that raises the heat setting.

Think I know what you like to do.

You have a blanket (in my case it is a humidifier) that won’t run when you simply plug it in. It has a microcontroller inside (or along the cord) where you have to select the intensity and/or the duration by sequential button presses. And it looses the setting after time or when it is unplugged.

My solution was to hack into the controller, tap into the push button(s). I would not use a relay here a single transistor and a resistor or two are enough to limit the current and shift the voltage level from 5 to 3.3 if necessary
A Relay only for mains power.
I used a esp8266 to do switching and the pulses (in my case there is a difference between pulse length = long press/short click) with my own firmware.
I don’t know if any of the ready to be used firmware’s like tasmota can do pulse sequencing

If you are looking for a node-red solution I would do it with a function node utilizing the setTimeout function to generate the pulses - but it surely can be with a flow too. I would fear that delays in mqtt transfer could mess up your timing. Relays bounce differently than push buttons so this can mess up your settings too.

To send 10 pulses at a defined rate you can do something like this:
image

[{"id":"0fce1797d353d095","type":"inject","z":"bdd7be38.d3b55","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":2240,"wires":[["0ec51fac643df682"]]},{"id":"0ec51fac643df682","type":"function","z":"bdd7be38.d3b55","name":"Send 10 messages","func":"const numToSend = 10\nfor (let i=0; i<numToSend; i++) {\n    node.send({payload: 1})\n}\nreturn","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":2240,"wires":[["e585b1ed5cb70017"]]},{"id":"e585b1ed5cb70017","type":"delay","z":"bdd7be38.d3b55","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":470,"y":2240,"wires":[["d01d7a7a672205d1"]]},{"id":"d01d7a7a672205d1","type":"trigger","z":"bdd7be38.d3b55","name":"Generate pulse","op1":"0","op2":"1","op1type":"num","op2type":"num","duration":"100","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":240,"y":2340,"wires":[["7f5482dc36d948f3"]]},{"id":"7f5482dc36d948f3","type":"debug","z":"bdd7be38.d3b55","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":2340,"wires":[]}]
1 Like

Your flow is what I was looking for, thank you.
I'm going to use relays since the power button is switching mains power.
Ideally using a wifi linked esp32 controlling the pulses would be preferable. But I'll try NR and mqtt and see if that works? Hoping the timing of the pulses is not too critical. Putting a RPi running NR at my nightstand would really be overkill. (however I do have several older RPis laying around)

Interested if sending the pulses via mqtt works reliable.

If you are looking to code this in c++ on an esp as mentioned before here is something I wrote for myself:

The sequencer stuff could be of interest

I think that would depend on what width pulses were being generated and what hardware the clients and broker are on. Since in this case it is driving physical relays then I should think the relays will be the limiting factor on how fast it can go.

As I understand they should simulate button presses:

As modern Heating blankets don’t start to heat until you select a time and intensity by multiple button presses.
So around 1hz no problem for mqtt. But if you miss one ore over-count due to extensive bouncing of the relay you may end up with wrong settings. So queuing sequences of on and offs may ruin your day (or should I say night).
Perhaps cut of the controller and take over the power switching / limiting completely is an idea but risky. :fire::zap::electric_plug::dizzy_face:

Thanks to all that have replied.
Christian-Me you are correct. The button presses can be very slow and don't all have to be of the same timing. So my first attempt will be using MQTT out to a esp32 controlling a couple of relays.
My plan is to turn on the blanket about 1/2 hour before my "normal" bedtime to maximum. Then when I go to bed, reduce the heat setting to a much lower value for the remainder of the night.

Have fun and let me know how it works out. Take care not to burn yourself. Always default to a safe state (the ESPs tend to perform resets from time to time - due to several reasons) Always good to know everything is turned off if something like this happens. They can even get stuck on reboot from time to time.

I thought I would give a follow-up regarding my project which after 10 days has been working as desired.

When looking for a wifi controlled relay, I found Csongor Varga's you tube video. It uses ESPEasy Flashed onto a 2 relay ESP01 board. I use ESPEasy for many projects and am already comfortable with it.

https://www.youtube.com/watch?v=i_CnBcQgdGk&t=627s

The relay contacts are soldered on the blanket control circuit board in parallel so full function of the stock blanket controller remain.

The NR flow uses mqtt to send commands to the relay board at 9:00PM every night. First sending a single on pulse to turn on the controller. Then 9 pulses on the second relay to increase the temperature setting to maximum. This preheats the bed so that when I enter the bedroom, I manually push the temperature decrease button on the stock blanket controller to the desired setting for the remained of the night. The following morning I press the on/off button on the same controller to turn the blanket off.

[{"id":"bbd45368.49251","type":"mqtt out","z":"6c477aef.3be934","name":"","topic":"/BlanketE/cmd","qos":"0","retain":"false","broker":"5358698d.462448","x":1040,"y":360,"wires":[]},{"id":"9a4eb49c.219f38","type":"inject","z":"6c477aef.3be934","name":"Relay 0 Off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":"","x":480,"y":240,"wires":[["90626fa3.1c445"]]},{"id":"ae324bf9.fec598","type":"inject","z":"6c477aef.3be934","name":"Relay 0 On","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":"","x":480,"y":280,"wires":[["fc27e722.e37268"]]},{"id":"bc1e6f4d.e6d9e","type":"inject","z":"6c477aef.3be934","name":"Relay 1 Off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":"","x":480,"y":340,"wires":[["c119fb5a.f77188"]]},{"id":"fd2a732c.9075f","type":"inject","z":"6c477aef.3be934","name":"Relay 1 On","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":"","x":480,"y":380,"wires":[["72f200a0.25129"]]},{"id":"90626fa3.1c445","type":"change","z":"6c477aef.3be934","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"relay,0,0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":240,"wires":[["bbd45368.49251"]]},{"id":"fc27e722.e37268","type":"change","z":"6c477aef.3be934","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"relay,0,1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":280,"wires":[["bbd45368.49251"]]},{"id":"c119fb5a.f77188","type":"change","z":"6c477aef.3be934","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"relay,1,0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":340,"wires":[["bbd45368.49251"]]},{"id":"72f200a0.25129","type":"change","z":"6c477aef.3be934","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"relay,1,1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":380,"wires":[["bbd45368.49251"]]},{"id":"fcc6aaa5.9907a8","type":"inject","z":"6c477aef.3be934","name":"","topic":"","payload":"9","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":290,"y":260,"wires":[["3ff14e1d.dfb462"]]},{"id":"3ff14e1d.dfb462","type":"function","z":"6c477aef.3be934","name":"BLINK n","func":"\nvar o = false;\nfor (var i=0; i<(msg.payload*2); i++) {\n    node.send( {payload:+(o=!o)} )\n}\n\nreturn null;","outputs":1,"x":320,"y":180,"wires":[["dbd81232.03562"]]},{"id":"dbd81232.03562","type":"delay","z":"6c477aef.3be934","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":180,"wires":[["90626fa3.1c445","fc27e722.e37268"]]},{"id":"ebd65e4e.13a31","type":"timerswitch","z":"6c477aef.3be934","name":"Heat Increase Timer","ontopic":"","offtopic":"","onpayload":"9","offpayload":"","disabled":false,"schedules":[{"on_h":"21","on_m":"00","on_s":"15","off_h":"21","off_m":"01","off_s":"00","valid":true}],"x":140,"y":160,"wires":[["3ff14e1d.dfb462"]]},{"id":"62b6b6aa.51b6d8","type":"inject","z":"6c477aef.3be934","name":"","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":290,"y":360,"wires":[["9aa74f9a.bc0da"]]},{"id":"9aa74f9a.bc0da","type":"function","z":"6c477aef.3be934","name":"BLINK n","func":"\nvar o = false;\nfor (var i=0; i<(msg.payload*2); i++) {\n    node.send( {payload:+(o=!o)} )\n}\n\nreturn null;","outputs":1,"x":320,"y":440,"wires":[["673e873e.f6c5b8"]]},{"id":"673e873e.f6c5b8","type":"delay","z":"6c477aef.3be934","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":440,"wires":[["c119fb5a.f77188","72f200a0.25129"]]},{"id":"ba98628e.49119","type":"timerswitch","z":"6c477aef.3be934","name":"Pwr ON Timer","ontopic":"","offtopic":"","onpayload":"1","offpayload":"","disabled":false,"schedules":[{"on_h":"21","on_m":"00","on_s":"00","off_h":"21","off_m":"00","off_s":"05","valid":true}],"x":140,"y":440,"wires":[["9aa74f9a.bc0da"]]},{"id":"70545a4e.e746d4","type":"comment","z":"6c477aef.3be934","name":"Manual Test Buttons","info":"","x":290,"y":300,"wires":[]},{"id":"5358698d.462448","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.42","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]
2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.