GabrielPlusTen NiamTashin Rohan
Published

Vending Machine Warehouse Speed Restocker

This will be a restocking system which can be restocked by alerting user when it is low or out of items to restock by playing a sound.

BeginnerShowcase (no instructions)10 hours115
Vending Machine Warehouse Speed Restocker

Things used in this project

Hardware components

M5Stack FIRE IoT Development Kit (PSRAM 2.0)
M5Stack FIRE IoT Development Kit (PSRAM 2.0)
×1
Time-of-Flight (ToF) VL53L0X Laser Ranging Unit (MCP4725/)
M5Stack Time-of-Flight (ToF) VL53L0X Laser Ranging Unit (MCP4725/)
×1

Hand tools and fabrication machines

3 Minute Maid Orange Cans
2 Baskets (item collector, item restocker)

Story

Read more

Schematics

Block Diagram (Main M5Stack)

Flowchart (Main M5Stack)

Main M5Stack Blockly Code

Code

Main M5Stack Code

Python
The complete code for the vending machine warehouse restocker code.
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

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


Can1 = None
Can2 = None
Can3 = None
Detector1 = None



label0 = M5TextBox(22, 23, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(22, 131, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(22, 78, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)




Can1 = 0
Can2 = 0
Can3 = 0
while True:
  Detector1 = tof_1.distance
  label0.setText(str(tof_1.distance))
  if Detector1 <= 75:
    label0.setText(str(tof_1.distance))
    label1.setText('Stock is Full')
    label2.setText('Cans Remaining: 3')
    rgb.setColorAll(0x3333ff)
    wait(1)
    Can1 = 0
    Can2 = 0
    Can3 = 0
  elif Detector1 > 75 and Detector1 <= 120:
    label0.setText(str(tof_1.distance))
    label1.setText('Stock is Moderate')
    label2.setText('Cans Remaining: 2')
    rgb.setColorAll(0x33ff33)
    if Can1 == 0:
      speaker.sing(220, 2)
      wait(3)
      Can1 = 1
      Can2 = 0
      Can3 = 0
  elif Detector1 > 120 and Detector1 <= 185:
    label0.setText(str(tof_1.distance))
    label1.setText('Stock is Low')
    label2.setText('Cans Remaining: 1')
    rgb.setColorAll(0xff9900)
    if Can2 == 0:
      speaker.sing(448, 1)
      wait(3)
      Can1 = 0
      Can2 = 1
      Can3 = 0
  elif Detector1 > 185:
    label0.setText(str(tof_1.distance))
    label1.setText('0 cans remaining')
    label2.setText('Please Restock')
    rgb.setColorAll(0xff0000)
    speaker.sing(889, 4)
  wait_ms(2)

Credits

GabrielPlusTen Niam
1 project • 0 followers
Contact
Tashin Rohan
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.