The basic idea to reach my goals was to make and android service that would run in a background and monitor the phone; it would detect phone calls, messages, alarm and communicate to another device that would turn on LED strips around my couch. And that is exactly what I built.
For the LED controller I used simple and cheap components:
- Some mosfets I found laying around
- Step down buck converter from ebay
- 12V power brik from ebay
- HC-06 bluetooth module from ebay
- stm32f103c8t6 mini development board from ebay
And here are they together:
Software I made for it, is pretty simple. Three PWM channels drive red green and blue parts of the LED strips. Bluetooth module is hooked up to UART, which allows simple serial communication. I implemented custom protocol on top of the UART, allowing messages that turn the LEDs to specific color. There's also a function for timeout, to make sure the LEDs do not remain on, if no communication is received in a while.
Next step was to make an android service. It has two main functions. First, it constantly looks for the bluetooth module in the vicinity and when detected, tells it what color the LEDs should be, including 0x000000 if they should be off. Second, it uses android NotificationListenerService to monitor the notifications present on the notification bar. When a specific notification is posted, the service tells the LEDs to turn on a specific color over the bluetooth. When the notification is removed, it tells the LEDs to turn off. So far it detects these notifications:
- Alarm ringing
- Phone call incoming/missed
- SMS received
- Facebook message received
- Skype message received
- Skype call incoming/missed
- Email received
Of course, I did not wish the LEDs lighting up in the middle of the night if somebody wrote me a message. Therefore, I added limits to only activate the LEDs during specific time of the day for specific notifications. Only the alarm notification can activate lights at any time.
Moreover, I assigned notifications priorities to handle scenarios when there is more than one notification active at the same time.
Finally, I made an app to spin up the service. I am quite proud of the user interface:
Here's couple of videos demonstrating everything in action. Sorry for potato quality, I was using the only phone with a good camera for the demonstration it self.