Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

kav12ab/sensormodulecode

Repository files navigation

Sensor Module Code

Owner: Kaveesha Abeysundara (SID: 201578163)

Project: Automated Tracking of Assembly Line-Side Flow Rack Parts

School of Mechanical Engineering
University of Leeds
LS2 9JT

Arduino firmware for individual sensor modules in an automated flow rack tracking system, leveraging VL53L1X ToF measurements and ESP-NOW communication.

License: All Rights Reserved

Table of Contents

About

This repository hosts the Arduino sketch (SensorModule.ino) and supporting headers for each sensor node. Sensor modules measure distances to part boxes using a STMicroelectronics VL53L1X time-of-flight sensor, compute part counts in real time with rolling averages and Six Sigma filtering, and transmit results to a rack-level transmitter via ESP-NOW.

Hardware Setup

Connection ESP32 Pin Description
VIN 5V Sensor power (5V rail)
GND GND Common ground
SDA 21 I2C data line
SCL 22 I2C clock line
XSHUT 19 Optional sensor reset control

ESP32-C6 and VL53L1X Wiring Diagram

Ensure all power and ground rails are shared between sensor and ESP32.

Prerequisites

  • Arduino IDE v1.8.10+ with ESP32 board support
  • Adafruit_VL53L1X or Pololu VL53L1X Arduino library
  • ESP32 Arduino libraries for ESP-NOW
  • USB cable and ESP32 development board

Installation

git clone https://github.com/kav12ab/sensormodulecode.git
cd sensormodulecode
  1. Open SensorModule.ino in the Arduino IDE.
  2. Install required libraries via Sketch → Include Library → Manage Libraries.
  3. Configure SensorID and peer MAC addresses in config.h.

Usage

  1. Select ESP32 Dev Module and correct COM port.
  2. Upload SensorModule.ino to each ESP32 sensor node.
  3. Monitor serial output at 115200 baud for status and debug messages.
  4. Verify LED indicators: solid green for normal operation; other colours for sensor errors.

Data Structures & Communication

Sensor modules build a data packet containing:

  • scanID (unique sensor identifier)
  • boxCount (calculated number of boxes)
  • autoMode (bool flag for automatic box size detection)
  • autoBoxSize (measured box size in mm)

These packets are sent via ESP-NOW to the rack transmitter. Retries and callbacks are managed in comms.h.

Repository Structure

sensormodulecode/
├── .vscode/                           # JSON files for VSCODE Arduino Configuration
├── build/                             # Build logs, libraries and other files
├── ESP32_VL53L1X_Wiring_Diagram.png   # Wiring Diagram
├── sensor.ino                         # Main programme
├── .h and .cpp files                  # Custom libraries to support main program functionality
└── README.md                          # This file

Given below is a table with the core code components and their functionalities

File Purpose
Sensor.ino Main programme that schedules, coordinates and calls functions in other header files and handles error logic. Contains an editable global variable section for easy deployment.
Espnowsetup.h Manages wireless communication including initialization, peer addition, data transmission, and handling send status via ESP-NOW.
VL53L1XHandler.h / VL53L1XHandler.cpp Initializes and manages the VL53L1X sensor, processes distance measurements with rolling averages and stability thresholds, and computes the number of boxes in the rack. Also auto-calculates box sizes.
WifiSetup.h Configures the device as a Wi-Fi station to support ESP-NOW transmissions.
LEDControl.h / LEDControl.cpp Provides visual feedback by controlling an RGB LED, indicating success or failure of operations.

License

All rights reserved.

This firmware and documentation are proprietary. No part may be copied, modified, or distributed without permission.

Contact

Author: Kaveesha Abeysundara (SID: 201578163)

Open an issue at sensormodulecode issues.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published