sohan jakkaThamson PangShiveeshchok_wei_jie
Published

Smart Convenience Store Utilizing Sustainable Technology

Using a m5 stack and various sensors we designed and built a sustainable smart convenience store.

BeginnerShowcase (no instructions)15 hours256
Smart Convenience Store Utilizing Sustainable Technology

Things used in this project

Story

Read more

Schematics

m5stack1 circuit

Circuit for m5stack 1

m5stack2 circuit

circuit for m5stack2

Code

m5stack1 Code

Python
Python code used in UiFlow
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x222222)
rfid_0 = unit.get(unit.RFID, unit.PAHUB0)
servo_0 = unit.get(unit.SERVO, unit.PORTB)
pahub_0 = unit.get(unit.PAHUB, unit.PORTA)
tof_1 = unit.get(unit.TOF, unit.PAHUB1)


distance = None



label0 = M5TextBox(48, 107, "Please place card", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label1 = M5TextBox(107, 184, "Checking Stock", lcd.FONT_Default, 0xFFFFFF, rotate=0)




while True:
  if rfid_0.isCardOn():
    label0.setText('welcome to store!')
    speaker.setVolume(0.5)
    speaker.tone(1800, 100)
    servo_0.write_angle(90)
    wait(2.5)
  else:
    label0.setText('please place card')
    servo_0.write_angle(0)
  distance = tof_1.distance
  if distance <= 50:
    label1.setText('Stock Level is Full')
    rgb.setColorAll(0x66ff99)
  elif distance > 50 and distance <= 70:
    label1.setText('Stock Level is High')
    rgb.setColorAll(0x33ff33)
  elif distance > 70 and distance <= 150:
    label1.setText('Stock Level is Moderate')
    rgb.setColorAll(0xff9900)
  elif distance <= 200:
    label1.setText('Stock Level is Low')
    rgb.setColorAll(0xff0000)
  else:
    label1.setText('There is No Stock')
    rgb.setColorAll(0xff0000)
    wait(0.2)
    rgb.setColorAll(0x000000)
  wait_ms(2)

m5stack2 Code

Python
Python code used in UiFlow
from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
pir_1 = unit.get(unit.PIR, unit.PORTB)
rgb_1 = unit.get(unit.RGB, unit.PORTA)






label0 = M5TextBox(23, 107, "Welcome to our store", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label1 = M5TextBox(23, 69, "Text", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)


while True:
  if (pir_1.state) == 1:
    rgb_1.setColorAll(0xffffff)
    label1.setText('customer detected')
    label0.setText('turning on lights')
  else:
    rgb_1.setColorAll(0x000000)
    label1.setText('customer not detected')
    label0.setText('lights are off')
  wait_ms(2)
  

Credits

sohan jakka
1 project • 1 follower
Thamson Pang
1 project • 0 followers
Shiveesh
1 project • 0 followers
chok_wei_jie
1 project • 0 followers

Comments