In this project, a system (Figure 1) is developed that utilizes the nRF5340-DK development board, an accelerometer, a Raspberry Pi, a Linux server, and the K-means algorithm. The nRF5340-DK device transmits accelerometer data from the attached sensor to the Raspberry Pi via a Bluetooth connection. The Raspberry Pi forwards the received data to a MySQL database located on a Linux server. The data received by the database is stored in a .csv file, which is then used to develop a Python application utilizing the K-means algorithm to create a neural network.
-
nRF5340-DK: Measurement of accelerometer (GY-61 ADXL335) (Figure 2) data, such as acceleration and orientation, and wireless data transmission to the Raspberry Pi using a 433 MHz Bluetooth connection.
Figure 2. nRF5340-DK and the attached accelerometer (GY-61)
- Raspberry Pi 3 Model B v1.2: Forwards data received from the nRF5340-DK to the school's MySQL server over the network using the HTTP protocol.
- Laptop computer: Used for writing code, monitoring the database, and establishing remote connections to the Raspberry Pi and the Linux server.
- Windows: Windows 11 and 10.
- Linux: Debian-based 32-bit Raspberry Pi OS (latest version).
- GitHub and Git Bash: Used for managing the overall project files.
- Visual Studio Code: Development environment used for writing C and Python code.
- Google Colab: Used for writing the neural network classifier code.
- Python: Program running on the Raspberry Pi that receives sensor data and stores it in the database. Also used for machine learning–related programs.
- SQL: MySQL database used for collecting accelerometer data.
- C: Programming language used on the nRF5340-DK to collect accelerometer data and transmit it to the Raspberry Pi via Bluetooth.
- Linux: Used on both the Raspberry Pi and the Linux server.
- MySQL: A self-created database hosted on one of the Linux server’s addresses.
-
K-means Algorithm: We use the K-means algorithm (Figure 3) to cluster the accelerometer x-, y-, and z-axis data into six cluster centers by calculating the distance to the nearest randomly initialized cluster centroid. A new cluster centroid is computed as the mean of the data points assigned to that cluster. The assignment of data points and recalculation of centroids is repeated until no significant changes are observed in the cluster centers.
-
Neural Network Classifier: Classifies the measurement data into the correct category using two Dense layers by applying the neural network’s weights. The final output consists of probability values for each orientation. This serves as an alternative method for classifying measurement data in addition to the K-means algorithm.
Figure 3. Cluster centroids assigned by the K-means algorithm based on the data points
- Confusion Matrix: The confusion matrix indicates the performance and effectiveness of the classification algorithm.
- Wireshark: An application used to analyze data packets in traffic between devices.
- Git and GitHub: Used for managing the project’s file structure and version control.
- Kanban Board: Used to track completed and ongoing tasks.
- Discord: Used for daily information and file sharing.
- Discord: A Discord channel created by the teacher, along with separate collaboration channels.
- Email:
- Jaakko Lukkari: t3luja00@students.oamk.fi
- Juho Kupila: t3kuju03@students.oamk.fi

