The document describes SmartECG, a system that uses a heartbeat sensor on an STM32 Nucleo board to detect atrial fibrillation in athletes in real time. The system preprocesses heartbeat data and runs it through a KNN machine learning algorithm to identify fibrillation. If detected, a notification is sent to a mobile app via Bluetooth. The app displays the user's heart rate and any fibrillation notifications to the user. The system is accurate at detecting fibrillation 94-97% of the time.