The remote control of Midea Air Conditioner have an UI point of view, the values of the commands on the remote control like Temperature, and Speed Fan are all synchronized with the Air Conditioner when you change some of them, this implies in the following problem: you can't emit only one command! You need to emit all the states on the remote control, even if you only just wanna change the temperature, the only independent command on this remote control is the command to turn off, all the others including the turn on need to be concatenated.
In order to solve this problem, this library provides an object that simulate the interface present on the remote control, making the process of control the Midea Air Conditioner more easier.
How to Use?
To use this library you need to include the traditional IR library and pass the reference of the object irsend in the constructor of the MideaIR class.
IRsend irsend; MideaIR remote_control(&irsend);
Then, you can use the functions to control your air conditioner.
You can use the functions to turnON and turnOFF without the need of call
// To turn the Air Conditioner ON remote_control.turnON(); // and the following to turn the Air Conditioner OFF remote_control.turnOFF();
emit() Is a function used to emit the IR Signal to the Air Conditioner, if you make a change on the mode or temperature, use
emit() to send the signal, if you don't use emit() the air conditioner won't be changed.
There are functions to set Mode, Temperature and Speed Fan:
The function to set temperature (
setTemperature()) receive as paramenter an int with the required temperature, the range accepted is between 17 and 30, if you use more than 30, the class will change this to 30 and if you use less then 17 the class will change this to 17:
The function to set mode (
setMode()) receive a constant as a parameter, if you don't use a correct constant the class with the required mode will change this to the default that is
There are four modes, represented as the following constants:
The function to set speed fan (
setSpeedFan()) receive a constant as a paramenter, like the
setMode() function, if you don't use a correct constant the class will use the default
There are five fan configurations, represented as the following constants:
Like we have said above, set functions just change local variables, if you want to send these to the air conditioner you need to call
emit(). You can set as many operations as you can, before send the signal, and all of them will be synchronized once.
remote_control.setTemperature(25); remote_control.setMode(mode_auto); remote_control.setSpeedFan(fan_speed_3); remote_control.emit();
You can use the following function to retrieve information from the class:
// Get Mode remote_control.getMode(); // Get Speed Fan remote_control.getSpeedFan(); // Get Temperature remote_control.getTemperature(); // Get State ~ ON or OFF ~ true or false remote_control.getState();
You can download the IR library here: Arduino-IRremote
P.S.: Don't forget to use
setState(true) before you emit commands like
setMode(), if you don't set the state to true the air conditioner won't turn on, or change the value. The default value to state is
To improve Infrared Signal we recommend make a amplifier, you can use a simple resistor:
Or, you can use a circuit with capacitor and a transistor NPN:
P.S.: To better range use a super bright LED
Thanks a lot Daniel Veillard (http://veillard.com) @veillard to point how to send the IR signals of Midea AC in the post (http://veillard.com/embedded/midea.html), they help us a lot in the construction of this library, and thanks to Tom Blough for help me (@jefersonla) and @veillard in the proccess of make reverse enginering. Thanks for the contributors of https://github.com/z3t0/Arduino-IRremote too.