Skip to the content
4 layers36 × 30 mmOccupancy Sensor A, the printed circuit board in 3D

Based on STM's BLEMeshLightingPRFNode example, this project gets data from the ToF and color sensor. Bluetooth functionality has not been fully developed

Size
36 × 30 mm
Copper layers
4
Thickness
1.6 mm
Parts
89
Nets
77
Pads
306
Tracks, vias
491, 105
Pours
23
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
21 Jul 2023
Updated
30 May 2024

Overview

Occupancy Sensor A is an open-source printed circuit board by LESA-RPI, from the LESA-RPI/LESA_OccupancyUnit repository on GitHub, published under the MIT licence. It is a 4-layer board of 36 × 30 mm with 89 parts on 77 nets, routed with 491 tracks and 105 vias.

It is built around the TCS34303, VL53L8CX and ECMF02-2AMX6, with the BSS138 and DMG1012T among its other parts. Its parts include 31 capacitors, 21 resistors, 7 ICs, 6 transistors and 5 inductors. It belongs with the sensors and measurement boards and the STM32 boards of this library.

Main components

5

README

README.md

LESA_OccupancyUnit (BLE_MeshLightingPRFNode)

Tutorials

https://drive.google.com/drive/folders/18Ncf5kQ7dq59xiIikijq2Gq61cseJHMG?usp=sharing

Table of Contents

Folder Navigation

  1. NON-STM32 Project Folder
  2. STM32CubeIDE

Based on STM's BLE_MeshLightingPRFNode example, this project gets data from the ToF and color sensor. Bluetooth functionality has not been fully developed

Flow charts

Current Program Overview (STM32 occupancy detection)

mermaid
graph TD
boot(Initilizaiton of STM32 and task registrations) ---> init(Sensor Init) --wait for init to finish--> standby{Standby};
subgraph Appli_mesh.c & others
standby --sw1 short press--> reply1(BLE color value advertisement);
reply1-->standby
standby --sw1 long press--> reply2(BLE ToF value advertisement);
reply2---> standby
standby --sw2 long press--> base(background set up)---> standby
standby -->change{Color INT}-->sensor(wakes up ToF and data pulling)--No blobs present for long period-->standby
standby --sw2 short press--> loopyloop1(ToF matrix to UART)
loopyloop1--sw2 short press--> standby
end

Project Overview

mermaid
graph LR
subgraph Room
unit1[Server];unit2[Server];unit3[Server];unit4[Server];unit5{Client};
unit1 & unit2 ---- unit3 & unit4
unit5 ---- unit1
end
unit5 ---- building[Building management sys]

Server and Clients are defined by

text
#define ENABLE_SENSOR_MODEL_SERVER                                           (1)
#define ENABLE_SENSOR_MODEL_CLIENT                                           (0)

, where server is the one with sensor running, and client is the one requesting or listening

Conituous ToF matrix pulling configuration

mermaid
graph TD

server[Server]
esp[EPS32]
server <--HTTP--> esp
subgraph Module
stm[STM32] <--UART--> esp
stm <--I2C--> colorsensor[ColorS]
stm <--I2C--> tof[ToF]
end

Wiring Diagram

Some of external resistors are necessary as the diagram above shown since the L8 TOF board does not internal resistors on it.

How to use

In order to use this project you must download this entire repository and open the .project file in the STM32CubeIDE folder:

This is how the files should be placed in the workspace folderOpen the project by clicking the .project file

How it works

How it runs

The example software provided by ST uses a sequencer library for scheduling tasks.

Before using the sequencer it must be initialized by a call to the function :

UTIL_SEQ_Init( void )

A function is registered as a task in the sequencer by

UTIL_SEQ_RegTask( UTIL_SEQ_bm_t TaskId_bm, uint32_t Flags, void (*Task)( void ) )

The first parameter is the task ID and is a 32-bit value where only one bit should be set, i.e. the maximum number of tasks is 32. The second parameter is not used for anything by the library, and the third parameter is a pointer to the function which should be called when it is time for the task to run.

To request a task to be runned, use function

UTIL_SEQ_SetTask( UTIL_SEQ_bm_t TaskId_bm , uint32_t Task_Prio )

Example:

text
UTIL_SEQ_Init( void )
UTIL_SEQ_RegTask((1 << 4), UTIL_SEQ_RFU, my_task_function);
UTIL_SEQ_SetTask((1 << 4), CFG_SEQ_Prio_0);

Bluetooth setting

This project envisioned using BLE mesh to communicate between units. Click here to learn more.

Tracking Algorithm

Tracking_Algo.h Function declerations and Macro settings for STM32

Tracking_Algo.c Algorithm itself, can be copied into an online C compiler to run and test

TODO:
  • update void link_latest_frame_to_previous(FIFObuffer *fifobuffer) to allow multi-frame traceback
  • update void int find_centers_of_mass(int matrix[N][N], Point *center_of_mass) in FrameInfo parse_frame(int matrix[N][N], float deltaX, float deltaY) to allow track person better

Sensor related files

VL53L8CX (TOF Sensor)
text
app_tof.c  ->  /BLE_MeshLightingPRFNode/Application/Core/app_tof.c

- void MX_TOF_Init(void)

  : Initialize the TOF sensor. Validates whether it is properly connected and starts the sensor

- static void MX_VL53L8CX_SimpleRanging_Process(void)

  : Read and print out the data if the sensor is properly running

- void MX_TOF_ToggleReso(void)

  : A public function that calls toggle_resolution. Change the resolution of TOF sensor

You can change the ranging frequency by modifying "RANGING_FREQUENCY" public variable(Set to 20Hz in the code)

*custom_ranging_sensor.c  ->  /BLE_MeshLightingPRFNode/Application/Core/custom_ranging_sensor.c

- int32_t CUSTOM_RANGING_SENSOR_Start(uint32_t Instance, uint8_t Mode)

  : Start the TOF sensor

- int32_t CUSTOM_RANGING_SENSOR_Stop(uint32_t Instance)

  : Stop the TOF sensor
TCS3430 (Tristimulus Sensor)

https://github.com/IAmiku/LESA_OccupancyUnit/tree/main/NON-STM32%20Project%20Folder/ESP-TCS3430

text
TCS3430.h  ->  /BLE_MeshLightingPRFNode/Drivers/BSP/TCS3430/TCS3430.h

- Includes all the address of the registers of TCS3430

- Includes Prototype of functions

- struct tcs3430_optics_val

    : Has X,Y,Z, and IR values

- struct tcs3430

    reginfo -> data in the registers

    XYZinfo -> Low & High byte of X, Y, Z, and IR1

TCS3430.c  ->  /BLE_MeshLightingPRFNode/Drivers/BSP/TCS3430/TCS3430.c

............

Above two functions are necessary whenever you change the setting of the TOF(such as frequency of configure mode)

Reference:

https://wiki.st.com/stm32mcu/wiki/Connectivity:STM32WB_BLE_MESH_Sensor_Model#/media/File:Connectivity_sensor-demo12.png

Summer Team Contact Information

• link10@rpi.edu

• kims29@rpi.edu

• zhengj8@rpi.edu

Parts

89
QtyValueFootprintReferences
9100nCapacitor_SMD:C_0402_1005MetricC2, C4, C9, C16, C17, C18, C20, C21, C22
747KResistor_SMD:R_0402_1005MetricR3, R5, R6, R7, R9, R10, R12
61uCapacitor_SMD:C_0402_1005MetricC3, C5, C6, C7, C8, C10
62.2KResistor_SMD:R_0402_1005MetricR14, R16, R17, R18, R19, R20
5BSS138Package_TO_SOT_SMD:SOT-23Q1, Q2, Q3, Q4, Q7
41KResistor_SMD:R_0402_1005MetricR8, R13, R15, R21
44.7uCapacitor_SMD:C_0402_1005MetricC1, C13, C15, C19
310nCapacitor_SMD:C_0402_1005MetricC11, C26, C31
3~Capacitor_SMD:C_0402_1005MetricC27, C28, C29
210pCapacitor_SMD:C_0402_1005MetricC12, C14
240.2KResistor_SMD:R_0402_1005MetricR4, R11
25.1KResistor_SMD:R_0402_1005MetricR1, R2
10.3pCapacitor_SMD:C_0402_1005MetricC25
10.8pCapacitor_SMD:C_0402_1005MetricC24
10RResistor_SMD:R_0603_1608MetricL4
11.2pCapacitor_SMD:C_0402_1005MetricC30
1100pCapacitor_SMD:C_0402_1005MetricC23
110nInductor_SMD:L_0402_1005MetricL2
110uInductor_SMD:L_0805_2012MetricL1
12.7nInductor_SMD:L_0402_1005MetricL3
13.6nInductor_SMD:L_0402_1005MetricL5
15VTestPoint:TestPoint_Pad_D2.0mmTP1
1AntennaOccupancy_Sensor_Custom_Footprints:AN3359_Meander_AntennaAE1
1BATTJumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP1
1BOOTOccupancy_Sensor_Custom_Footprints:EVQ-P7A01PSW1
1Conn_02x05_Odd_EvenConnector_PinHeader_1.27mm:PinHeader_2x05_P1.27mm_Vertical_SMDJ2
1Conn_CoaxialOccupancy_Sensor_Custom_Footprints:CONUFL001-SMD-TJ3
1DEA162450BT-1295A1 Occupancy_Sensor_Custom_Footprints:DEA162450BT-1295A1U8
1DMG1012TPackage_TO_SOT_SMD:SOT-523Q6
1ECMF02-2AMX6Package_DFN_QFN:ST_UQFN-6L_1.5x1.7mm_P0.5mmU3
1GNDTestPoint:TestPoint_Pad_D2.0mmTP2
1INTCTestPoint:TestPoint_Pad_D1.0mmTP7
1INTTTestPoint:TestPoint_Pad_D1.0mmTP5
1LOGOOccupancy_Sensor_Custom_Footprints:LESA_8x4mmG***
1NX2012_32K768Occupancy_Sensor_Custom_Footprints:NX2012_32K768Y3
1NX2016SA_32MOccupancy_Sensor_Custom_Footprints:NX2016SA_32MY2
1PWRLED_SMD:LED_0603_1608MetricD1
1RSTOccupancy_Sensor_Custom_Footprints:EVQ-P7A01PSW2
1SCLTestPoint:TestPoint_Pad_D1.0mmTP3
1SDATestPoint:TestPoint_Pad_D1.0mmTP4
1STATLED_SMD:LED_0603_1608MetricD2
1STM32WB55CGUxPackage_DFN_QFN:QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mmU6
1TCS3430Occupancy_Sensor_Custom_Footprints:TCS3430U5
1TPS7A0318PDBVRPackage_TO_SOT_SMD:SOT-23-5U4
1TPS7A0333PDBVRPackage_TO_SOT_SMD:SOT-23-5U1
1USBJumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mmJP2
1USB_C_ReceptacleOccupancy_Sensor_Custom_Footprints:USB4120-03-CJ4
1VL53L8CXOccupancy_Sensor_Custom_Footprints:VL53L8CXU2

Similar boards

  • 2 layers22 × 18 mmRabbit tof, the printed circuit board in 3D

    Rabbit tof

    seralexeev/rabbit

    rabbit source code

    22 parts1
  • 4 layers100 × 50 mmController, the printed circuit board in 3D

    Controller

    usbalbin/hw-half-bridge

    226 parts
  • 2 layers55 × 40 mmDesign1, the printed circuit board in 3D

    Design1

    beauforr/UAV-charging-demo

    Hardware demo based on UAV-Based Charging Solution.

    107 parts
  • 4 layers165 × 125 mmVersaTerm, the printed circuit board in 3D

    VersaTerm

    Synthron/VersaTerm

    Adaptation of https://github.com/dhansel/VersaTerm/tree/main

    125 parts
  • 6 layers50.2 × 77.2 mmMeko, the printed circuit board in 3D

    Meko

    KOEGlike/meko

    A linux music player with ddr3, a 70hz e-paper display and a haptic touchpad

    274 parts90GPL-3.0
  • 4 layers85 × 56.5 mmHATv2.0, the printed circuit board in 3D

    HATv2.0

    taroz/mosaicHAT-Station

    mosaicHAT+ GNSS antenna + Raspberry Pi + Touch display + Battery + Case

    51 parts34
  • 4 layers190.8 × 12.1 mmWARBL2 5.1, the printed circuit board in 3D

    WARBL2 5.1

    amowry/WARBL2

    WARBL2 Code and design files

    94 parts33GPL-3.0
  • 4 layers60 × 100 mmMIDAS MK1, the printed circuit board in 3D

    MIDAS MK1

    ISSUIUC/ISS-PCB

    Building custom flight computers

    221 parts33

Questions

How big is the Occupancy Sensor A PCB?

It measures 36 × 30 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Occupancy Sensor A use?

89 parts, built around the TCS34303, VL53L8CX, ECMF02-2AMX6 and BSS138. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Occupancy Sensor A KiCad files?

From the LESA-RPI/LESA_OccupancyUnit repository on GitHub, at the commit this page was made from: the board is Hardware/PCBA/-A/Occupancy_Sensor-A/Occupancy_Sensor-A.kicad_pcb and its schematic Hardware/PCBA/-A/Occupancy_Sensor-A/Antenna.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Occupancy Sensor A design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).