Skip to content

Occupancy Monitoring Embedded System Code: Source code for Raspberry Pi Pico W units and Arduino in a project to monitor library occupancy. Includes MicroPython and Arduino scripts for data collection and communication. Part of the "Project with Embedded Systems 2DT304" academic course.

Notifications You must be signed in to change notification settings

sw0rdd/occupancyMonitoringES

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Real-Time Occupancy Monitoring System for University Library

This repository is part of an academic project focused on monitoring occupancy levels in a library across different floors and zones using Raspberry Pi Pico W units with ultrasonic sensors and an Arduino board. The data collected by the Pico units is sent to a central Arduino, which then posts the information to a local web server. The server runs on Node.js and stores occupancy data in MongoDB.
This project is made for the course "Project with Embedded Systems 2DT304".
This Repository contains the source code for the webserver.

Project Demo Video

Contributers

Seif-Alamir Yousef & Ludvig Svensson

Academic Report

This Academic Report contains detailed information about the project.

Raspberry Pi Pico - MicroPython Code

Inside the /pico_Micropython directory, you will find three distinct files corresponding to the different zones in the library:

  • pico_one.py: Code for the entrance zone.
  • pico_two.py: Code for the second and third floor zone.
  • pico_three.py: Code for the ground floor zone.

These scripts are written in MicroPython and are responsible for measuring entries and exits using ultrasonic sensors attached to each Raspberry Pi Pico as well as handling Bluetooth communication.

The directory also contains the following file

  • trying_threads.py: This file contains our try to use multithreading which didn't work out as we hoped. More on this can be found in the report.

Arduino - C++ Code

The /Arduino directory contains two versions of the code for the Arduino UNO R4 Wifi:

  • ArduinoCode.ino: This script does not utilize FreeRTOS. It's designed to collect data from the three Picos and communicate with a local server via POST requests, updating the occupancy status accordingly.

  • ArduinoFreeRTOS.ino: This version incorporates FreeRTOS to manage multitasking. However, due to the multitasking complexity, it is currently limited to connecting and collecting data from only two Picos.

Use only one of them on the Arduino

Installation and Usage

To deploy the code on your microcontrollers, follow these steps:

  1. Raspberry Pi Pico:

    • Ensure each Pico is running MicroPython. Instructions can be found on the official Raspberry Pi website.
    • Upload the respective .py files to each Pico device using Thonny or any other preferred MicroPython IDE.
  2. Arduino UNO Rev 4:

    • Open the desired .ino file in the Arduino IDE.
    • Compile and upload the code to your Arduino UNO Rev 4.

Configuring Arduino

Ensure the Arduino is programmed with the IP address of the device running the web server and the matching API_KEY for successful POST requests to the server. Also, make sure the Arduino and the server are on the same network.

About

Occupancy Monitoring Embedded System Code: Source code for Raspberry Pi Pico W units and Arduino in a project to monitor library occupancy. Includes MicroPython and Arduino scripts for data collection and communication. Part of the "Project with Embedded Systems 2DT304" academic course.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published