My Arduino fun projects: Part3: (full code and schematics): Be in control, forget the remote and use your smart phone
I work very hard during the week…mostly doing research and development. Weekends I prefer to rest and wake up a bit late. I have a 4 years old daughter who likes to wake up early in the morning, then opens the curtains and tells me “its beautiful outside…wake up”. Then I know I have to switch on the TV, find a movie with cartoons and prepare her favorite cereal. Only then I can go back to sleep.
Let’s admit that a lot if inventions came from being lazy…even that TV remote itself…laziness to get off the couch and change the channels.
Image credit Similar design.
I then decided to design a mobile app with Bluetooth that controls a circuit with Infrared transmit to control the TV, decoder and Hifi…well still that does not solve the issue of preparing a cereal, still need to find an automated system for that....maybe I must design a "bot".
I will breakdown the project into fewer parts and conclude by combining all the parts as a final design.
Parts to be discussed:
Temperature sensor(LM35)
- Operates at −55 °C to +150 °C range
- Requires 4 to 30 volts
- +/-0.4 °C at room temperature
Well for me accuracy was not the biggest issue but just to get the concept working. LM35 is cheap and easy to connect with no external calibrations. To test it just use a basic analogue to digital conversion sketch: temp_reading = analogRead(LM35_Pin);
Image credit
For high accuracy well DH22 which is a Digital Humidity and Temperature sensor may do the job.
Arduino UNO
For more details about Arduino kindly refer back to My Arduino fun projects: Part2 and Part 3
Recording remote signal/RAW code
Image credit
Kindly note the Infrared receiver and transmitter must match and modules I choose are modulate at frequency of 38 Khz which is ideal for most of the appliances we use at home. There are different protocols like the “sirc” for SONY Infrared Remote Code, which decodes signals that are using SONY remote protocol. I will rather not discuss the protocols which might be confusing...rather discuss how to record the RAW signal/code which is used by the IR transmitter to control appliances. But if you really want to know more about the protocols I suggest you download IR Protocol Analyser v1.1
Image credit
IR Receiver Module
Image credit
Connect the IR reciever to the arduino as shown above and compile below sketch.
Sketch on Github
I will rather not explain the sketch but rather explain what is the results to copy and save as a RAW signal/code. Note I used the IRremote Library which is available on Github but I have done some modification on it.
Aircon Power ON RAW code:
Above is the results I get when pressing the aircon ON button while the remote is facing the IR receiver. It is import for the transmitting sketch...just simply copy it.
Transmitting
Digital IR Transmitter module
Image credit
What is important to note on the sketch is:
- Declare the RAW signal/code copied previously during the recording as an integer.
- To transmit simply use this line: irsend.sendRaw(airconpoweron,228,38); //code from array, bits, frequency in KHz
Sketch on Github
Note if you want to transmit more buttons I suggest using an Arduino Mega as the Uno will freeze because of memory, the RAW codes are too long.
Bluetooth interfacing
For more details about Bluetooth interfacing kindly refer back to Android phone accelerometer controlled Remote Car
Future modifications
Replacing the Bluetooth with WIFI module (ESP8266) connected to the internet (IoT) then being able to control and monitor the aircon (even all the appliances) from anywhere in the world.
Final design:
Final bluetooth mobile App
Click here to open on a new page and zoom
The mobile app allows:
- Switching ON/OFF of the aircon
- Adjusting temperature UP/DOWN
- Changing the speed of the fan
- Changing the MODE of the aircon
- To view the indoor temperature
The full Arduino sketch and editable MIT app I uploaded it on Github
Crazy complicated stuff we can come up with!
Thanks @mokluc!
Thanks @papa-pepper