Sam Houston State University (SHSU)
COSC 4347: Embedded System Design and IoT
For our COSC 4347 group project, we're building an occupancy counter that keeps track of people entering and leaving a room or building. The system uses photoelectric sensors to detect people passing through an entrance, updates the current occupancy count, and shows the count on a four-digit seven-segment display.
We also need the two microcontroller boards to communicate wirelessly, with authentication and encryption for the data being sent between them. The project includes a buzzer for entry and exit sounds and a "FULL" indication when the space reaches its maximum capacity.
- Count entries and exits: Use two photoelectric beam sensors, placed about 1 meter apart near a doorway, to detect people entering and another sensor to detect people leaving. Entries add to the count, and exits subtract from it.
- Keep track of occupancy: Combine the entry and exit counts to get the number of people currently inside. The counting logic also needs to account for possible errors when people use the same doorway in both directions (i.e. if the count would drop below zero, that must be prevented).
- Send data wirelessly: Use nRF24L01+ 2.4 GHz radio modules to exchange timestamped counter data between the boards.
- Authenticate and encrypt messages: Use the authentication and encryption code provided by Dr. Rasheed for the required communication protocols, including encrypted data transfer and key exchange. We should mostly be able to integrate it through library functions rather than write the encryption system ourselves. We may make changes later if we run into bugs or decide to add something.
- Display the count: Show the current occupancy on a four-digit seven-segment display. The project calls for a maximum count of 9,999, a
FULLmessage at capacity, and animated directional arrows when nobody is passing through. - Play entry and exit sounds: Use a buzzer with different sounds for entering and leaving.
| Part or tool | What we're using it for |
|---|---|
| NXP LPC1768 Mbed board (Board A) | One of the two microcontrollers |
| STM32 Nucleo-F411RE (Board B) | Second microcontroller, replacing an older LPC1768 |
| nRF24L01+ radio modules | Wireless communication between the boards |
| Photoelectric beam sensors | Detecting people entering and leaving |
| Four-digit seven-segment display | Showing occupancy and status messages |
| Buzzer | Entry and exit sounds |
| Optical isolator / signal conditioning | Connecting the sensors to 3.3 V microcontroller inputs |
| Mbed Studio with Mbed OS 6.17.0 | Writing and building the firmware |
| Tera Term | Viewing serial output for testing and debugging |
| STM32CubeProgrammer | Updating the Nucleo board's interface firmware |
The project originally called for two LPC1768 boards. While testing, we found that the second LPC1768 had an old firmware version (16457) with a known timing issue. Its serial connection wasn't working either. We looked into updating it, but the firmware files we needed were no longer available from the original servers. Dr. Rasheed gave us an STM32 Nucleo-F411RE to use as Board B instead.
These are the things we've worked through or still need to finish:
- Confirmed that we're using Mbed OS 6.17.0.
- Got Board A (LPC1768) running and printing serial output to Tera Term.
- Tracked down the firmware and timing problems on the original second LPC1768.
- Switched Board B to the STM32 Nucleo-F411RE.
- Set the Nucleo's
JP5jumper toU5Vfor USB power and updated its interface firmware. - Tested the Nucleo with a blinking LED program and serial output to Tera Term.
- Get the nRF24L01+ radios communicating between the two boards.
- Set up the seven-segment display and buzzer.
- Connect the photoelectric sensors.
- Write the entry/exit counting logic.
- Integrate and test the professor-provided authentication and encryption code.
- Put everything together and test the full system.
- Document the final results and demo.
We're using Mbed OS 6.17.0, so some older Mbed examples won't compile as written. In particular, the old Serial class gave us trouble. printf() or BufferedSerial works better with our setup.
We also have example nRF24L01+ driver files (nRF24L01P.cpp and nRF24L01P.h) and an example main.cpp to help us get started with radio communication. We'll need to match the pin definitions to whichever board we're testing.
If something breaks or we find a hardware-specific issue, we should add the details here or in the repo so nobody has to troubleshoot the same problem twice.
- Erik Barbieri
- Tyler Byars
- Hudson Boles
- Esra Gurbuz
- Samuel Rubio
We'll use this repo to keep our code, testing notes, and project documentation together. Team members can make their changes on separate branches and merge into main once they've tested them. A second person's approval isn't required, but it's still helpful to leave a quick note about what changed, especially if it involves wiring, pins, or board setup.
The nRF24L01P driver files were originally written by Owen Edwards (2010) and include a GNU GPL v3-or-later license notice. We'll keep the original copyright and license notices with those files if we add them to the repo.