Week 7 – Overcoming Data Challenges: Optimizing Shot Detection & Firebase Integration
- muhammadsirajbilal
- Mar 31
- 3 min read
Updated: Apr 14
Errors, Errors, Errors. We all hate them, don't we? Well, this week presented some of the most complex technical challenges I have faced so far, requiring a deep dive into data optimization, memory management, and ensuring seamless transmission of shot data to Firebase. Despite setbacks, it was a week filled with learning and problem-solving, pushing the iCue project forward.
Class Session: Progress Review & Feedback
The session this week focused on reviewing our progress so far. Sir Roshan conducted a feedback session, checking everyone's blogs to ensure they were up to date and providing constructive feedback. He was particularly impressed with my detailed documentation of iCue’s development, which reassured me that I was on the right track. He then asked me to visit Dr. Judhi to update him on my progress for the week.
Project Progress: Capturing & Storing Shot Data Efficiently
The main challenge this week was to optimise how iCue captures and transmits shot data. The objective was to collect sensor values one second before and after the shot to ensure that the cue stick action was accurately represented. This was done by trial and error. By setting certain thresholds and identifying the rapid acceleration and deceleration measured by the sensor while taking a shot, I was able to identify if a shot was taken or not. While the logic for detecting a shot with acceleration and deceleration thresholds was successfully implemented, sending the collected data to Firebase proved to be a significant challenge.
Key Challenges & Solutions:
Handling Large Data Sets: Each shot generated 240 data points (40 values per axis for X, Y, and Z before and after the shot). Initially, storing these values in a list led to memory overflow, causing system crashes.
Buffer Overflow Issues: The continuous data collection resulted in the list consuming too much memory, leading to a bottleneck when transmitting to Firebase. The system could not efficiently manage the growing buffer, which disrupted the entire process.
Memory Mapping & Optimization: After extensive debugging, I restructured the memory allocation process to ensure proper data segmentation. Adjusting the way values were stored and limiting unnecessary operations significantly improved performance.
Wi-Fi Transmission Optimization: Another challenge was transmitting the large dataset over Wi-Fi in real-time. After several tests, I refined the data transmission method to ensure all values were sent without delays or loss.
Despite these issues, I successfully optimized the data handling process, ensuring that shot values were accurately stored in Firebase. With this key milestone achieved, my next focus will be on app development and integrating it with the hardware in the coming weeks.

Wireframes
To make the mobile application development process smoother, I worked on creating wireframes of the app towards the end of this week, which I will use while developing the app next week.

Reflection & Looking Ahead
This week was a reality check on the complexities of handling real-time sensor data. I had initially expected the implementation to be straightforward, but the errors and debugging took much longer than anticipated. The biggest lesson was understanding how data storage and memory management play a critical role in embedded systems, especially when handling large datasets.
While these challenges pushed the project slightly behind schedule, I chose to see this as an opportunity for deep learning rather than a setback. Debugging the system and seeing it finally work was an incredibly rewarding experience.
Moving forward, I’ll be shifting my focus towards developing the mobile app, ensuring seamless integration between the hardware and software. With the hardware finally done, I am now ready to integrate AI-driven analytics and real-time personalized training recommendations shown through the mobile application. This is just the start of something truly transformative in AI-powered billiards analytics. Onwards and upwards! 🚀















Comments