Smart Retail record products stocks
2023-02-08 | By M5Stack
License: General Public License Bluetooth / BLE Wifi Arduino
* Thanks for the source code and project information provided by @Ray Xiang
Things used in this project
Hardware components
M5Stack FIRE IoT Development Kit (PSRAM 2.0) x 1
M5Stack Time-of-Flight (ToF) VL53L0X Laser Ranging Unit (MCP4725/) × 1
M5Stack I2C Hub 1 to 6 Expansion TCA9548A Module ×1
M5Stack RGB Unit with NeoPixel RGB LED (SK6812) × 1
M5Stack Mini RFID Unit RC522 Module Sensor × 1
We have started this effort to assist employees be more efficient. So, first and foremost, we used five components: M5Stack, RGB, I2C Hub, TOF, and RFID. TOF motion is sensed by distance sensing; after it exceeds 200, a red led appears at RGB, indicating that the item is out of stock. When the suppliers load up the supplies and tap into the RFID, it will record who has stocked it up. Smart retail stocks give customers and managers the ability to have visibility over inventory as it moves out of the warehouse as traditional warehouses have trouble keeping track of the records of stock. Retailers provide customers with goods from the manufacturer. Retailers reduce the costs of goods sold for manufacturers.
Block Diagrams
Code
Python
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)
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum