Ray Xiang
Published

Smart Retail record products stocks

Smart retail uses technology such as RFID and sensors to track and record inventory levels in real-time.

AdvancedFull instructions provided10 hours181
Smart Retail record products stocks

Things used in this project

Story

Read more

Schematics

FlowChart

Block Diagrams

Code

Python

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

setScreenColor(0x222222)
rgb_0 = unit.get(unit.RGB, unit.PORTB)
tof_0 = unit.get(unit.TOF, unit.PAHUB5)
rfid_0 = unit.get(unit.RFID, unit.PAHUB0)
pahub_0 = unit.get(unit.PAHUB, unit.PORTA)


Detector1 = None



label0 = M5TextBox(24, 14, "Text", lcd.FONT_UNICODE, 0xFFFFFF, rotate=0)
label1 = M5TextBox(132, 16, "Text", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
label2 = M5TextBox(76, 128, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)




while True:
  Detector1 = tof_0.distance
  label0.setText(str(tof_0.distance))
  if Detector1 <= 50:
    label1.setText('Stock is full')
    rgb_0.setColorAll(0x33cc00)
  elif Detector1 < 50 and Detector1 <= 70:
    label1.setText('Stock level is high')
    rgb_0.setColorAll(0xffff00)
  elif Detector1 > 70 and Detector1 <= 150:
    label1.setText('Stock level is moderate')
    rgb_0.setColorAll(0xcc9933)
  elif Detector1 > 200:
    label1.setText('Stock level is low')
    rgb_0.setColorAll(0xcc0000)
    speaker.tone(1800, 200)
  else:
    label1.setText('No stock detected')
  if rfid_0.isCardOn():
    rgb.setColorAll(0x33cc00)
    wait(1)
    if (rfid_0.readUid()) == '8ada8b53':
      label0.setText('Hi There!')
      label1.setText(str(rfid_0.readUid()))
      speaker.tone(1800, 200)
      wait(0.25)
  else:
    label2.setText('Please scan your card ID')
    rgb.setColorAll(0x000000)
  wait_ms(2)

Credits

Ray Xiang

Ray Xiang

1 project • 0 followers

Comments