Gunpreet Singh
Published © GPL3+

Door Remote Control and Monitoring using Bolt-IoT Platform

Have you Left for work or are laying in bed and Wondering is that Door Closed? No Worries now, You can Remotely Control the Door with this..

IntermediateFull instructions provided2 hours1,211
Door Remote Control and Monitoring using Bolt-IoT Platform

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Arduino Nano R3
Arduino Nano R3
×1
8*32 LED Matrix MAX72xx
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

Arduino IDE
Arduino IDE
Bolt Cloud
Bolt IoT Bolt Cloud
Bolt IoT Android App
Bolt IoT Android App

Story

Read more

Schematics

Circuit Diagram

Code

HTML code for Bolt Cloud Platform

HTML
Upload it on Bolt Iot Cloud Platform. Feel Completely free to modify it.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Control Center</title>
<style>
 html, body {
     height: 100%;
    }
      .button {
  background-color:  #9bdf46;
  border: none;
  color: white;
  padding: 42px 52px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 18px;
  margin: 2px 2px;
  cursor: pointer;
  border-radius: 15%;
}
.button_div {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  height: 30px;
  width: 200px;
  left: 50%;
  top: 25%;
  margin-top: -15px;   /* = -height / 2   */
  margin-left: -100px; /* = -width / 2    */
  position: fixed;     /* Fixed is better */
}
</style>
     <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
        <script>
        setKey('Your_API_KEY','YOUR_BOLT_DEVICE');
        </script>
</head>
<body>
    <center>
         <div class="button_div">
        <div><h1>Status:</h1></div>
        <div id="show"><h1>...</h1></div>
        <br>
        <button class='button' onclick='opendoor()'>open</button><br><br>  
        <button class='button' onclick='closedoor()'>close</button>
        </div>
    </center>
<script>
    function opendoor(){
            serialWrite("OPEN");
            document.getElementById("show").innerHTML="<h1>Door Open</h1>";
    }
    function closedoor(){
            serialWrite("CLOSE");
            document.getElementById("show").innerHTML="<h1>Door Close</h1>";
    }
</script>    
</body>
</html>

C Code For Arduino

C/C++
Upload it on Arduino via Arduino IDE. Feel Free to Modify it.
#include <BoltDeviceCredentials.h>
#include <BoltIoT-Arduino-Helper.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <Servo.h>

#define API_KEY   "YOUR_API_KEY"
#define DEVICE_ID "YOUR_DEVICE_ID"

#define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW
#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10
#define Door 4

MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
Servo myservo;

String stat="";
String command = "";
char buf[30];

String opendoor(String *data) {
  int pos;
  for (pos = 0; pos <= 190; pos += 1) {
    myservo.write(pos);                                    
  }
  delay(10);
  P.displayClear();
  stat="Door Open";
  return "Success:open";
}

String closedoor(String *data) {
  int pos;
  
  for (pos = 180; pos >= 0; pos -= 1) {
     myservo.write(pos);                                   
  }
  delay(10);
  P.displayClear();
  stat="Door Close";
  return "Success:close";
}

void setup(void)
{
  myservo.attach(Door); 
  boltiot.begin(Serial);
  boltiot.setCommandString("OPEN",opendoor);
  boltiot.setCommandString("CLOSE",closedoor);
  P.begin();
  P.displayClear();
  P.displayScroll(buf, PA_LEFT, PA_SCROLL_LEFT, 25);
//  P.print(stat);
}

void loop(void)
{
   stat.toCharArray(buf,stat.length()+1);
   boltiot.handleCommand();
    if(P.displayAnimate()){
    P.displayReset();}
}

Credits

Gunpreet Singh
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.