This article covers the development of an Arduino controlled air conditioning system. It converts an old school, in-window, air conditioner (AC) which was in a very hard to reach spot to an automatic system which can be activated and monitored from MegunoLink Pro at your desk. The system consists of an Arduino Uno, a servo driven mechanism to active the AC, a DS18B20 temperature sensor, and MegunoLink Pro to plot the temperature and control the set points.
Being an old-school air conditioner, there was no clear way of controlling the system digitally. Instead, a mechanical actuator was designed which simply fit over the rotary switch and a simple servo controls the switches position. Either off, in fan mode, or in low or high power cooling.
The structure for the actuator was printed on and UP! Plus 3D printer using ABS plastic. The design is fairly custom, but if you think it will work on your system then grab the STL files below.
Bracket used along with servo to actuate the AC setting knob.
|Date:||January 6, 2016|
The Brain (Arduino Uno)
This project is controlled by an Arduino Uno microcontroller. The temperature is measured using a DS18B20 temperature probe and the actuator is driven using a Tower Pro MG995 servo. Because the servo draws a significant amount of current when starting up a 4700uF capacitor was placed on the power bus to help reduce the voltage drop and keep the microcontroller running smoothly.
The DS18B20 temperature probe’s signal line is connected to pin 10 on the Arduino UNO. It also requires a connection to ground and 5V with a 4.7K pull up resistor between the signal line and 5V. The servo is also connected to the 5V and ground lines but the control signal is connected to pin 9 of the Arduino.
The program which runs on the Arduino UNO is fairly simple. The temperature sensor is read and if the current temperature is above the target set-point (plus a hysteresis value) then the servo is adjusted to the on (low) position. Once the temperature falls below the set-point (minus a hysteresis value) then the servo is adjusted to the off position. The hysteresis values are used to prevent noise in the temperature value from falsely changing the controllers state and repeatedly adjusting the servo.
As well as the basic temperature controlling functionality a command handler is used to receive commands and arguments (numbers etc) from MegunoLink. These commands are used to configure various settings such as the temperature set points, hysteresis, servo locations, and servo delay. These settings are saved in the EEPROM of the Arduino so it remembers it’s state even when the power is disrupted.
To configure the temperature controllers set points and servo positions a custom interface was built using MegunoLink’s Interface Panel visualiser. The figure below shows the interface early in its development (left) and the completed version on the right. Each button is configured to set a specific message to the Arduino changing one of its settings.
For example: if you click the Set Temperature button in the current interface it will send, over the serial channel, !SetTemperature 23\r\n. The Arduino will receive this command and allow you to use the arguement (23) to set a new target temperature.
As well as controlling and configuring the Arduino, MegunoLink can respond to commands it receives. An example of this is the play and pause symbols. These indicate if the controller is enabled or not. If the controller is enabled then the Arduino will send MegunoLink a message like this:
These commands will make the DisabledIndicatorPicture (pause symbol) disappear and the EnabledIndicatorPicture (play symbol) appear.
Setting Servo Positions
Before the controller will operate correctly the servo positions need to be configured. On the second tab in the interface panel we have a number of buttons and number controls which allow you to set the servo position for each of the AC systems settings. Clicking each of the set buttons also moves to that position. This makes it easy to fine tune and when you’re done these settings are stored in the Arduino’s EEPROM. The AC system used in this project had four settings each with a different button position, Off, Fan, Low, and High.
The last setting is the list is Servo Delay, this setting adds a delay between each step in the servo so that it smoothly and more importantly quietly shifts states. Without this delay the servo makes a very loud noise and quickly shifts to the new set point.
The final component to the system is some feedback on how the temperature controller is going. For this the controller uses MegunoLinks Time Plot and Table visualisers to display the current and historical temperature values as well as the current set points. This is achieved by sending targeted messages over the serial port which MegunoLink detects and responds to. For example to send a value to the table a message like this is sent:
For plotting data the messages look like this:
Of course we have a library for the Arduino which makes sending these messages easy.
Download and Get Started
- OneWire for the DS18B20 temperature sensor.
- DallasTemperature for the DS18B20 temperature sensor.
- MegunoLink for sending messages to and from MegunoLink Pro.
|Date:||January 6, 2016|
Do you have an old air conditioner you would like to modernizse? If you decide to give it a go let us know how it goes.
Leave a comment down below! or if you need help jump over to our forums.
Thanks for reading.