What is NerdClock?
It includes a Bluetooth chip, which allows for wireless configuration of the NerdClock via a phone or other blutetooth-capable device. The following parameters are configurable via the bluetooth connection:
NerdClock also comes with an Android companion app that can control all aspects of the NerdClock device.
All settings are saved in the device so that if the device looses power, all settings are automatically re-applied when power is restored.
In addition, the RTC module is powered by a battery so that time can be kept even during power loss. This means that no configuration at all is needed after a power loss - once power is reapplied, the device will keep going as if there had been no power loss in the first place.
Why is NerdClock?
Can my phone run the Android companion app?
Phones it has been tested on:
The best way to know if you can run it is probably to just download the APK and try.
What communication protocol is used for configuring the NerdClock?
There is one thing that might be less obvious, though:
Since the configuration protocol is a binary protocol where 0xff is a perfectly acceptable value in some fields, this means that measures are required to make this reservation of 0xff work.
This has been solved by also reserving the value 0xfe to mean "interpret the next byte in a special way"
This means that if the sender wants to send "0xff" it sends "0xfe 0x01" instead, and if the sender wants to send "0xfe" it sends "0xfe 0x00" instead.
The receiver then also interprets the data in the same way, meaning that when it sees "0xfe 0x00" it is interpreted as just "0xfe" and when it sees "0xfe 0x01" is interpreted as "0xff".
This means that in order to avoid data being lost, special care must be taken when communicating with the device.
All of this communication stuff is of course implemented in the Android companion app.
The firmware for the ATMega has been written in C++11 and the Android companion app is (of course) written in Java.
The main reason to opt for C++ instead of plain C is that I wanted to see how well C++ was supported in the AVR tool chain (and so far I'd say the support is good).
The main reason to go for C++11 specifically is that it introduced a whole bunch of new features not available in older C++ versions, while still being old enough to make me feel confident about compiler support.
When it comes to HW, you need the following stuff to build a NerdClock:
You don't actually need an Arduino Nano for this - all you really need is an ATMega48/88/168/328. The Nano is an excellent bit of kit though and might be the best thing since sliced bread.
Just take a look at some of the features it offers:
I²C RTC (Real-Time Clock) module. Used (obviously) to actually keep track of the current time.
Bluetooth module. Connected via UART and works as a bluetooth UART bridge. Used for configuration purposes (current time/LED colours/...).
PWM/LED driver chip. Each chip can drive 16 independent PWM channels (and each RGB LED uses 3 of those channels).
Common Anode RGB LEDs
I chose large (10mm) and bright LEDs but you can of course use whatever you want. It is important that they are common anode though (common cathode won't work with the TLC5940).
Android companion app
Note that the Android companion app especially could use some more love. It's a bit lacking in the UI design/implementation department. One example of that is that the UI is not scrollable. At all. So if the entire UI doesn't fit on your screen, there's no way to actually see everything...
The zip file(s) contains a schematic of the hardware and source code for the firmware and Android companion app.
Self-signed APK file for the NerdClock companion app.
NerdClock is released under the MIT License.
/Olof Holmgren [email@example.com]