Project: Refrigerator esp8266 Repair

The Story: I have a 10 yr.old fridge at home which after removing it from the kitchen furniture slot for mould cleaning went berserk and started freezing everything - not only in the freezer part but also in the fridge part which resulted in tomatoes that you could drive a nail with. Though that's pretty cool, they're harder to eat and I didn't want to warm The Planet any more as I like it under 24*C outside.

So I localized the thermostat - an analogue unit with a 1,20m long capillary tube which is led from the thermostat compartment by some kind of a plastic/rubber tube that there's no access to except it's one end. The one I took out was eaten by rust so I gave it a proper burial ceremony and proceeded to order a replacement. After installing the new one (I had to push the 1,20m of the capillary down that tube lubricating it with some detergent as suggested in forums) I've happily put my new food in and went to sleep.

To my surprise I had a new set of tomato hammers soon only it took longer than the previous time. After some thought, reading, inspecting and calling smart people I realized that most probably the tip of the capillary had not reached it's destination as most probably the tube for leading the capillary is broken or has been displaced.

I decided that I am not gonna buy a new fridge no matter what - I want to fix this one. So my friend at HS suggested to make my own thermostat with an MCU. I also decided, that I don't want to lead any extra cables across the seals, nor drill in the fridge (as it would result in leaks) or, Gods of Thunder and lambdas forbid, disassemble the fridge as for one it would take ages and secondly there would be little chance to reasemble it back working, sealed and with proper insulation coefficient.

The fridge has a compartment that has mains supply and a return cable for the compressor, two unshielded cables going into the fridge (originally for the light bulb) and a push-button that is triggered by closing the door.

So the way I devised is to have two MCU's:

MCU called the “Engine” as it will be responsible for controlling the engine through a relay, and will have the information on whether the door is open.

MCU called the “Lighthouse” as it will turn the light inside the fridge and will obtain information on current temperature inside.

I also decided that I need OTA (Over The Air) firmware update to be able to better and develop this project without disconnecting everything every time I make a code change.

All of these conditions together with my HS friend's tip pointed me first to Sming framework, but I spend too much time figuring their OTA system out and my other friend suggested MicroPython, I liked the idea, as I have Python queued to learn and at first it looked as if it's webREPL functionality will do instead of OTA.

Turned out doing REST wasn't as obvious as with Platformio framework, so I decided to do it with plain sockets.

Right now I'm at a phase, where everything works except for comunication between the two MCU's xD

As I used blocking sockets I think it strongly interferes with MicroPython's webREPL and my goal at hand is:

ToDo:

1) Change blocking sockets to non-blocking 1.1) Possibly using Peter Hinch'es uasyncio

2) Look for real OTA as webREPL is unfortunately not reliable without having access to the reset button and serial port (re-check after 1.1) as the problems might be generated by my blocking sockets

Regards, Lepi