Benedict
Published

Smart Retail System

Automated retail system using RFID and sensors for seamless shopping experiences.

ExpertFull instructions provided69 days94
Smart Retail System

Things used in this project

Story

Read more

Schematics

First M5Stack Blocky Code

Second M5Stack Blocky Code

First M5Stack Circuit Picture

Second M5Stack Circuit Picture

Code

First M5Stack

Python
from m5stack import *
from m5ui import *
from uiflow import *
from servo import Servo
import time
import unit

setScreenColor(0x222222)
servo_0 = unit.get(unit.SERVO, unit.PORTC)
tof_0 = unit.get(unit.TOF, unit.PAHUB5)
rfid_0 = unit.get(unit.RFID, unit.PAHUB0)
tof_1 = unit.get(unit.TOF, unit.PAHUB1)
env2_0 = unit.get(unit.ENV2, unit.PAHUB4)






label2 = M5TextBox(15, 100, "Next customer please!", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label3 = M5TextBox(101, 80, "Welcome", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label4 = M5TextBox(21, 129, "Please tap credit card", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label0 = M5TextBox(209, 200, "Temp:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(93, 200, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label5 = M5TextBox(19, 200, "Humidity:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label6 = M5TextBox(262, 200, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label7 = M5TextBox(11, 60, "Thanks for the puchase!", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)


label2.hide()
label3.hide()
label4.hide()
label7.hide()
servo0 = Servo(26,50,500,2500,180)
servo_0.write_angle(0)
while True:
  label6.setText(str(env2_0.temperature))
  label1.setText(str(env2_0.humidity))
  if (rfid_0.isCardOn()) == True and (tof_0.distance) <= 80:
    servo_0.write_angle(90)
    rgb.setColorFrom(6 , 10 ,0x33ff33)
    rgb.setColorFrom(1 , 5 ,0xff0000)
    label2.hide()
    label3.show()
    label4.hide()
    label7.hide()
    label3.setText('welcome!')
  elif (rfid_0.isCardOn()) == False and (tof_0.distance) <= 80:
    servo_0.write_angle(0)
    label4.show()
    label2.hide()
    label3.hide()
    label7.hide()
    for count in range(10):
      rgb.setColorAll(0xcc0000)
      rgb.setColorAll(0xffcccc)
      speaker.setVolume(1)
      speaker.sing(220, 1/4)
      speaker.setVolume(0)
      wait_ms(30)
  elif (tof_1.distance) >= 80 and (tof_0.distance) >= 80:
    rgb.setColorAll(0xffff66)
    servo_0.write_angle(0)
    label4.hide()
    label7.hide()
    label2.setText('Next customer please')
    label3.hide()
    label2.show()
  elif (tof_1.distance) <= 80:
    label7.show()
    label4.hide()
    label2.hide()
    label3.hide()
    servo_0.write_angle(90)
    rgb.setColorFrom(6 , 10 ,0xff0000)
    rgb.setColorFrom(1 , 5 ,0x33ff33)
  wait_ms(2)

Second M5STack

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

setScreenColor(0x222222)
pir_1 = unit.get(unit.PIR, unit.PORTA)
light_2 = unit.get(unit.LIGHT, unit.PORTB)






label1 = M5TextBox(113, 82, "Item removed", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(103, 102, "[Item Discription]", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label3 = M5TextBox(107, 64, "Item purchased", lcd.FONT_Default, 0xFFFFFF, rotate=0)


label1.setText('item removed')
label3.hide()
while True:
  if (pir_1.state) == 1:
    if (light_2.analogValue) <= 200:
      label1.hide()
      rgb.setColorAll(0x33cc00)
    else:
      label1.show()
      rgb.setColorAll(0xff0000)
      wait(20)
      if (light_2.analogValue) > 200:
        label3.show()
        rgb.setColorAll(0xffff66)
  else:
    rgb.setColorAll(0x33cc00)
    label1.hide()
  wait_ms(2)

Credits

Benedict
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.