Aimed to detect the angle of a spinning top using ESP32 and wireless communication for debugging the results. The implementation involved developing an algorithm to accurately determine the right timing for turning LEDs on in several angles.

The project introduce an advanced system for angle detection, employing a gyroscope, LEDs, Laser ToF sensor (LiDAR), a beacon for angle correction, and a microcontroller.
The microcontroller, sensors, and beacon worked collaboratively to calculate the top’s orientation. Using the Wi-Fi feature, real-time debugging and monitoring the top’s behavior was possible. Three more debug methods were used during the process: serial monitor, sensors’ readings analysis graphs and LEDs lightings. Using each method helped in identifying and resolving different issues, whether in sensors’ readings of the algorithm.
The current angle was calculated in iterations using the angular velocity that was calculated by the gyroscope. The angle 0 was defined by the beacon, so the angle was corrected when the beacon was first sensed in the cycle. Several potential sources of error could affect the accuracy of the gyroscope’s readings such as: noise, temperature sensitivity, power supply, communication protocols and vibrations.
Taking in mind the surrounding environment, velocity of the spin, the current angle and delay time between the lightings, a cursor was displayed in the desires angles:0, 90 and -90. Proving the correctness of our algorithm.
The goals of the project were achieved successfully, the sensors’ readings were debugged in real-time, the implemented algorithm worked properly and the LEDs were lit in the right angles 0,90 and -90.