Midea Air Conditioner TimerOverviewDiscovery Theory of Operation Applicability Construction The Finished Product Project Sources
Overview I originally envisioned this as having an elaborate real time clock and entering the current time and a turn-on time via a serial interface. I finally decided just to turn the unit on at 5:00pm before going home and have it just count 14.5 hours to start up at 7:30am. I'll have it re-issue the start command every 10 minutes or so between 7:30 and my arrival at 8:30 just in case someone sees the AC running in an unoccupied office and turns the AC unit off.
Discovery
I then hooked up a IR receiver module of the correct carrier frequency to a logic analyzer to determine the actual data transmitted by pressing the "ON" button. The Midea remote command signal consists of 3 bytes of information. Each byte was first transmitted normal and then inverted for a total of 48 bits of data. This was followed by what appeared to be a single "0" stop bit followed by 4.5ms space (8T). This entire command including the AGC pulse and stop pulse was then immediately transmitted again. Here's the Midea remote control output partially deciphered:
Theory of Operation The internal RC clock is not very accurate. We can minimize the error from this by turning the unit off and back on every day at 5:00pm to reset it. We can also measure the actual length of our 8 second timer tick at the µC/temperature/supply voltage/clock frequency we will operate at and adjust the target tick points accordingly. The IR carrier frequency we generate is also dependant on the internal RC clock so we will also need to measure the actual carrier frequency generated and adjust it as well. The device needs to transmit one command for heating during the winter, and a different command for cooling during the summer. To keep from having to reprogram the chip for each season, and to minimize the user interface on the device, a simple season select is implemented using the power switch. Seasons are denoted by the color of the heartbeat LED. Red for winter (heating mode) and green for Summer (cooling). If the device is switched off during the first 8 seconds, it will start back up in the next "season". If the startup season is correct and the device is allowed to run longer than 8 seconds, then the next startup will be the same as the current season. Season information is stored in non-volatile EEPROM. Assuming the device is started twice per day (worst case when changing seasons), then four EEPROM writes occur per day. With a life of 100,000 write/erase cycles, that gives us a 70 year life span for the EEPROM memory. Season mode changing is a little tricky because of sleeping in power-down mode. The processor is using very little power so there is enough power stored in the filter capacitors to execute a few cycles after waking even if the power was switched off long ago. Therefore, when changing modes, be sure to leave the power off at least 8 seconds (1 timer tick). That way, the processor will awaken and then attempt to flash the heartbeat LED effectively draining the stored energy, and preventing the mode toggle from executing unexpectedly. Be sure to enable Brown Out Detection in the fuses to get reliable shutdowns. Much more in the source code comments!
Applicability
Construction The µController portion is very simple. A bypass cap and weak pullup are attached to the chip reset line to prevent inadvertent resets from occurring. The IR LED operates at 100ma - too high to run directly from one of the Tiny's output pins, so we use a common 2N2222 transistor to buffer the current. The "heartbeat" LED is a 3mm bi-color 2-lead red/green LED. If we pull I/O pin PB1 low, and set PB2 high, we get green light. Pulling PB2 low and setting PB1 high generates red light. That's it for the hardware, other than a two cell AA battery case with an integral on-off switch which we house everything in.
It's a little bit more trouble to make a double-sided PCB using toner-transfer, but certainly doable. Briefly, here's how: Clean one side of the board, iron on the image. Apply clear packing tape to the other side to protect it in the etch tank and go ahead and etch the first side. After etching, remove the packing tape then pre-drill two of the holes in the board slightly larger than a straight pin. Clean the other side of the board, and using pins to align the artwork, iron-on the second side. Apply tape to cover the already etched first side, and then etch the second side. Remove the tape after etching, then drill and trim the board.
Start by installing the lowest components first, usually the SMD devices. Then work you way up to the tallest items. Think about what needs to be soldered on each part, especially on the top of the board, to make sure you don't put something in the way of soldering a connection later. I like to clean the flux of the board a couple of times as I go since the top gets pretty hard to clean as the taller components start going on.
The Finished Product |
|
Disclaimer and License
It worked for me so it should work for you, but no guarantees. Feel free to use the schematics and information on this page as you see fit, but a little attribution would be appreciated. |
|
Project Sources
|
|
Questions about, or problems with this site?
Contact the Webmaster
|