Amaan Javed
Published

M5STACK Touch Less Entry

On hand gesture, you can open the door without touching the handle M5STACK AND NODEMCU USED.

IntermediateFull instructions provided1 hour8
M5STACK Touch Less Entry

Things used in this project

Hardware components

ESP32 Basic Core IoT Development Kit
M5Stack ESP32 Basic Core IoT Development Kit
×1
NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Arduino 4 Relays Shield
Arduino 4 Relays Shield
×1
Jumper wires (generic)
Jumper wires (generic)
×1
6 DOF Sensor - MPU6050
DFRobot 6 DOF Sensor - MPU6050
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

NodeMCU (on board com)

Arduino
//////////////////AMAAN JAVED////////////////////
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Servo.h>
Servo myservo;
const char *ssid = "ESPdoor";
const char *password = "12345678";

ESP8266WebServer server(80);

void handleRoot() {
  server.send(200, "text/html", "<h1>You are connected</h1>");
}

void ope(){
  myservo.write(90); 
  delay(10000);
  myservo.write(0); 
}
void setup() {
  delay(1000);
   myservo.write(0); 
  Serial.begin(115200);
  Serial.println();
  Serial.print("Configuring access point...");
  WiFi.softAP(ssid, password);
  myservo.attach(5);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/ope", ope);
  server.begin();
  Serial.println("HTTP server started");
}
void loop() {
  Serial.println("Waiting for the link");
  server.handleClient();
}
//////////////////AMAAN JAVED////////////////////

M5STACK

Arduino
//////////////////AMAAN JAVED////////////////////
#define M5STACK_MPU6050 
#include <M5Stack.h>
#include <WiFi.h>
#include <HTTPClient.h>
float pitch = 0.0F;
float roll  = 0.0F;
float yaw   = 0.0F;
const char* ssid ="ESPdoor";
const char* password ="12345678";
void setup(){
  M5.begin();  
  M5.Power.begin();   
  M5.IMU.Init();
  for(uint8_t t = 4; t > 0; t--) {
        Serial.printf("[SETUP] WAIT %d...\n", t);
        Serial.flush();
        delay(1000);
    }
      WiFi.mode(WIFI_STA);
      WiFi.disconnect(true);
    WiFi.begin(ssid,password);
    while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    M5.Lcd.print(".");
 
    delay(15000);
    M5.Lcd.println("Connected");
  }
}
void loop() {
   
  M5.IMU.getAhrsData(&pitch,&roll,&yaw);
  if((WiFi.status() == WL_CONNECTED)) {

        HTTPClient http;      
  
  if(roll >= 40){
  M5.Lcd.print("[HTTP] begin...\n");
        
        http.begin("http://192.168.4.1/ope"); 
        M5.Lcd.fillScreen(GREEN);      
        int httpCode = http.GET();

        http.end();
    
    }    
    else{
       M5.Lcd.fillScreen(RED);
      }
  }
    
  delay(1);
}//////AMAAN JAVED/////////////

Credits

Amaan Javed

Amaan Javed

11 projects • 1 follower
Student

Comments

Add projectSign up / Login