Remote air conditioner controller

このエントリーをはてなブックマークに追加

What's this

Home IoT Kit Example

Control an air conditioner from your smartphone with obniz!

Put obniz + IR + temp sensor to your home. You can control it from your browser.

Materials

  • obniz * 1
  • power supply for an obniz.
  • IR module (of Home IoT Kit)
  • LM35DZ (of Home IoT Kit)

Steps

Connect like below. And put it on your home

Write a program regarding this example.
Change obniz id in the example.

By Pressing "Save&Open", You can see a temperature.

Record a your air conditioner signal for ON/OFF.

The example contains comment outed code for IR receiver.
Remove the comment out and record your air conditioner's ON/OFF signal. Your signal will be showed in log.

Put it recorded data array into your program.

Use it !

Just open the HTML, You can control your air conditioner from everywhere in the world!

Program

<!-- 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@2.0.2/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>

Run Now

The html will be opened to run a program.

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers

Forum

Visit our developer’s forum to discuss and discover technologies.

Forum

Contact

Feel free to contact out support and technical team.

Contact us