Su Myat Mon
Published

Engineering Exploration Project-Smart Door Automation System

Smart security, seamless shopping! Our Theft Alert Automation Door System prevents theft instantly while ensuring smooth experience

BeginnerFull instructions provided99
Engineering Exploration Project-Smart Door Automation System

Things used in this project

Hardware components

M5Stack FIRE IoT Development Kit (PSRAM 2.0)
M5Stack FIRE IoT Development Kit (PSRAM 2.0)
×2
Time-of-Flight (ToF) VL53L0X Laser Ranging Unit (MCP4725/)
M5Stack Time-of-Flight (ToF) VL53L0X Laser Ranging Unit (MCP4725/)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Mini RFID Unit RC522 Module Sensor
M5Stack Mini RFID Unit RC522 Module Sensor
×1
I2C Hub 1 to 6 Expansion TCA9548A Module
M5Stack I2C Hub 1 to 6 Expansion TCA9548A Module
×1
PbHUB Unit
M5Stack PbHUB Unit
×1
RFID sticker tag
×1

Hand tools and fabrication machines

Scissors, Free Fall
Scissors, Free Fall
Tape, Double Sided
Tape, Double Sided
Tape, Clear
Tape, Clear

Story

Read more

Schematics

Block Diagram (Overall)

Flowchart (Main M5Stack)

Flowchart (Secondary M5Stack)

Main M5Stack Blockly Code (Entrance)

Secondary M5Stack Blockly Code (Exit)

Remove remote qrcode block to unsee the QR code display on your UI

QR code to the App

App Display for Exit (Tag not detected)

App Display for Exit (Tag detected)

Code

Main M5Stack Blockly Code (Entrance)

Python
from m5stack import *
from m5ui import *
from uiflow import *
import machine
import time
import unit

setScreenColor(0x222222)
tof_0 = unit.get(unit.TOF, unit.PORTA)


object2 = None
car_distance = None



label1 = M5TextBox(16, 18, "Text", lcd.FONT_DejaVu24, 0xddaf16, rotate=0)
image0 = M5Img(95, 82, "res/smile (1).jpg", True)




PWM0 = machine.PWM(26, freq=50, duty=3, timer=0)
while True:
  object2 = int(((tof_0.distance) / 10))
  label1.setText(str(object2))
  if object2 < 20:
    label1.setText('Welcome to Our Store!')
    rgb.setColorAll(0xffff00)
    image0.show()
    PWM0.duty(12)
    wait(3)
    PWM0.duty(3)
    wait(4)
  elif object2 > 20:
    label1.setText('Object too far!')
    rgb.setColorAll(0xff0000)
    image0.hide()
  else:
    label1.setText('Out of Range!')
  wait_ms(2)

Secondary M5Stack Blockly Code (Exit)

Python
from m5stack import *
from m5ui import *
from uiflow import *
import machine
import time
import unit
import machine
remoteInit()
setScreenColor(0x222222)
rfid_1 = unit.get(unit.RFID, unit.PAHUB1)
pbhub_1 = unit.get(unit.PBHUB, unit.PAHUB4)


rp_label1_data = None



image0 = M5Img(110, 92, "res/default.jpg", True)
label2 = M5TextBox(56, 53, "label2", lcd.FONT_DejaVu24, 0xebd90d, rotate=0)
label0 = M5TextBox(81, 23, "label0", lcd.FONT_DejaVu24, 0xe0d12f, rotate=0)
label3 = M5TextBox(81, 208, "label3", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(139, 208, "label1", lcd.FONT_Default, 0xFFFFFF, rotate=0)






def label_1_callback():
  global rp_label1_data, PWM0, rfid_1, pbhub_1 
  return rp_label1_data
lcd.qrcode('https://flow.m5stack.com/remote?id=undefined', 72, 32, 176)
PWM0 = machine.PWM(26, freq=50, duty=3, timer=0)
while True:
  if pbhub_1.analogRead(0):
    if rfid_1.isCardOn():
      if (rfid_1.readUid()) == '884c71b50':
        rp_label1_data = 'Tag Detected!!'
        label0.setText('Tag Detected!!')
        label3.setText('Tag ID=')
        label1.setText(str(rfid_1.readUid()))
        label2.hide()
        rgb.setColorAll(0xff0000)
        image0.changeImg("res/default.jpg")
        speaker.tone(1800, 200)
    else:
      rp_label1_data = 'Thank You for Shopping with Us'
      label0.setText('Thank You for ')
      label2.setText('Shopping with Us!')
      label3.hide()
      label1.hide()
      rgb.setColorAll(0x33ff33)
      image0.changeImg("res/default.jpg")
      PWM0.duty(12)
      wait(3)
      PWM0.duty(3)
      wait(4)
  else:
    PWM0.duty(3)
    wait(3)
  wait_ms(2)

Credits

Su Myat Mon
1 project • 0 followers

Comments