This micro clock uses the Pro Mini sandwiched between the LiPo battery undershield and the display shield (that also includes the RTC), both DIY on protoboard.
The LiPo undershield uses a cheap (less than $1 on ebay) USB charger board, which also provides the USB connector for power, since Pro Mini does not have one. The small 180mAh LiPo battery sits on top of the charger, but still allowing the 2 LEDs ("charging" and "charged") to be visible. There is also a switch for turning the battery power on or off. The clock is normally powered from a USB power adapter, but it can also work on battery for about 9 hours (the measured average current draw is around 20mA) when the USB cable is not plugged in. In this latter case, it can be turned on from the power switch to show the time only when needed.
The display shield is oversized to make the clock sit at an angle. This solution also provided enough room to include the RTC chip and the backup battery. Actually, and this will probably be the topic of a future post on DIY miniaturization, I did not have a choice for creating a separate RTC shield. The machined headers I used, not the stacking kind (which would have been disproportionately big), only allowed a top and a bottom shield around the Pro Mini board.
As one can imagine, the sketch is trivial (after reading the excellent Sparkfun tutorial :) and based on the SevenSeg arduino library.
But there is always a little glitch somewhere. In this case, I misinterpreted the datasheet. Normally, digit 1 is the left (most significant) one. My wiring assumed digit 1 is the rightmost (least significant) digit.
I fixed it in software: redefined digit1...digit4, then rotated segments (segA to SegF) 180 degrees.
unsigned long timer;
int displayType = COMMON_CATHODE;
// arduino pins connected to cathodes;
int digit1 = 15; //Pin 1
int digit2 = 13; //Pin 10
int digit3 = 3; //Pin 4
int digit4 = 14; //Pin 6
// arduino pins connected to the segments (anodes);
int segC = 6; //Pin 3
int segE = 4; //Pin 2
int segG = 5; //Pin 7
int segB = 12; //Pin 11
int segD = 8; //Pin 8
int segF = 11; //Pin 9
int segA = 7; //Pin 12
// not connected yet;
int segDP= 10; //Pin 5
int numberOfDigits = 4; // this display has 4 digits;
// initialize the 7-segment display object;
myDisplay.Begin(displayType, numberOfDigits, digit1, digit2, digit3, digit4, segA, segB, segC, segD, segE, segF, segG, segDP);
myDisplay.SetBrightness(100); // 100% brightness
timer = millis();
int minute = rtc[DS1307_MIN];
int hour = rtc[DS1307_HR];
sprintf(timeString, "%02d%02d", hour, minute);
if (millis() - timer >= 1000)
timer = millis();
The next version of the bubble clock should use two displays (8 digits), showing the seconds as well.