IOT

Smart AC control from anywhere with your Phone

Let’s construct Smart AC control on our own with Obniz. This project enables you to remotely measure room temperature and operate your air conditioner using your smartphone. This project is really straightforward and requires minimal effort to complete.

obniz-smart-ac-control-diy

Components Required

  • Obniz
  • IR module
  • LM32DZ
  • Smartphone

What is Obniz?

Obniz is a relatively recent IoT development board that is cloud-based. It may be programmed using a web browser using Obniz cloud commands sent over the internet. By connecting Obniz to the cloud via Wi-Fi, customers are able to remotely operate devices that are physically attached to the Obniz board.

The board has 12 I/O and a WiFi-BLE module included. On Obniz’s cloud, it may be operated through REST and WebSocket APIs. In addition to simple IO ON/OFF, Obniz offers UART, I2C, BLE, etc., and these functionalities may be accessed remotely via the internet. Hardware-wise, each IO can drive up to 1A with overcorrection protection. Therefore, allows for the direct connection of high-current-demanding equipment such as motors. On the program, embedded components like switches, OLED displays, and BLE are ready for usage.

Step 1 – Setting up Obniz

All you need to do is to follow three steps.

  • Obniz can be connected to any Wi-Fi hotspot.
  • Connect your devices to Obniz.
  • Scan the Obniz board’s QR code to begin programming.

 The highlighting part is that you do not need to install any software.

Step 2:

Connect the IR module and LM32DZ to Obniz as indicated below, then place it in the room where you wish to measure the air conditioner’s temperature.

smart-ac-control-diy-connection-diagram

Step 3:

Create the program outlined in the program section. You must replace the Obniz ID with your own in the software. By clicking “Save & open,” it is possible to view the room’s temperature.

Step 4:

Each air conditioner is controlled by an IR remote that transmits an encoded IR signal to the AC unit. Since we do not know how encoding was implemented in a certain AC device, we must first record the IR signal supplied from the AC remote. Record the ON/OFF remote signal for your AC. The example code includes commented-out IR receiver code. Remove the comment and record the ON/OFF signal for your air conditioner, as it will be unique for each remote. Your transmission will be logged. Incorporate the array of recorded data into your code and Use it!

Simply open the HTML with your mobile device. You can operate your air conditioner from any location on the planet. Your Smart AC control is now complete.

Code:

<!– HTML Example –>
<html>
<head>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” href=”https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css”>
<script src=”https://obniz.io/js/jquery-3.2.1.min.js”></script>
<script src=”https://unpkg.com/obniz@1.6.1/obniz.js”></script>

</head>
<body>

<div id=”obniz-debug”></div>

<h1 id=”temp”>Measuring…</h1>

<p>
<button id=”on” class=”btn btn-primary btn-block”>Turn ON</button>
</p>
<p>
<button id=”off” class=”btn btn-primary btn-block”>Turn OFF</button>
</p>

<script>

var obniz = new Obniz(“OBNIZ_ID_HERE”);

obniz.onconnect = async function () {

//var sensor = obniz.wired(‘IRSensor’, {vcc:0, gnd:3, output: 2});
//sensor.start(function (arr) {
// console.log(‘detected!!’)
// console.log(JSON.stringify(arr));
//})

// Javascript Example
var tempsens = obniz.wired(“LM35DZ”, { gnd:7 , output:8, vcc:9});
tempsens.onchange = function(temp){
$(“#temp”).text(” + parseInt(temp)+ ‘ degree’)
obniz.display.clear();
obniz.display.font(‘Avenir’, 60)
obniz.display.print(” + parseInt(temp) + ‘℃’)
};

var infraredLed = obniz.wired(‘InfraredLED’, {anode: 1, cathode: 3});

$(“#on”).click(function(){
// your value for ON here.
infraredLed.send([])
})

$(“#off”).click(function(){
// your value for OFF here
infraredLed.send([])
})
}


</script>
</body>
</html>

Conclusion

Hope this blog helps you to understand how to build a Smart AC control from anywhere with your Phone. We, MATHA ELECTRONICS  will come back with more informative blogs.

Leave a Reply

Your email address will not be published.