Intro
A long time ago I wanted to make a Bluetooth connected pill reminder. A device that goes on the bottle cap of a pill bottle. Goal was to make a device that can detect if a pill bottle was opened and also trigger an alarm (visually on the bottle but also in an app on the phone) if too much time has elapsed since the last opening. I made a PCB and derived a firmware from the TI example project but struggled with the phone (Android) app. I somehow forgot about it and always searched for an excuse to finish it. This Spring Challenge looked like it was just the right time to do it.
PCB
The board is based on the CC2640R2F and is simplified variant of the LAUNCHXL-CC2640R2 evaluation board (no SPI, one button) plus an accelerometer. I don’t have much to say here other than the Tag connect pinout was wrong and only one bodge wire was needed. The balun seemed to work ok for a beginner in RF design.




Firmware
The firmware is a lightly modified Project Zero test firmware from TI. So light that I even repurposed the existing services (also to be able to keep using the original TI app). Just added an RTC service to keep accurate time.
Functions:
- Keep a down counter of remaining time
- Reset the time when pressing the button
- Blink green when still in time
- Blink red when time has elapsed
- Send counter every 10 minutes to the app
App
The app was my challenge in the past but now it has worked much better also with the use of AI LLMs. Still was not easy and somehow had to find the hard way that the Android BLE stack does not work well with Samsung phones and the nRF stack is much better. But in the end, it got the job done and works pretty well. I’m quite impressed.
Functions:
- Connect to the BLE device (and keep reconnecting in the background in case the connection is lost)
- Show remaining time
- Trigger an alarm when time elapses, even if the app is in the background.
Future plans
Solder the accelerometer (not an easy task) and add it to the logic to better discriminate a real opening of the pill bottle.
3D print a housing that would attach to the bottle cap.
https://www.youtube.com/shorts/qc-gqtDjpjY better video in case the uploaded one fails.