Micro:Bit Alarm Clock
I made the first prototype of this project as a school assignment where we were asked to make your own creation using a Micro:Bit. I thought that this project was a nice fit in this contest, as well as a fun way to re-purpose your Micro:Bit. I made modifications to my original design to improve the usability aspect of the Micro:Bit clock. This clock allows you to set an alarm at some time in the day, as well as showing the time simultaneously.
Supplies
Materials Used:
- Micro:Bit V2
*(V1 would not work due to the size of the code exceeding the memory limit)
For the following 6 parts, similar ones from other brands will also work.
- Keyestudio Micro:bit T Type Shield
- Keyestudio Breadboard
- Keyestudio 4-digit LED Display Module TM1637
- Keyestudio DS1302 Clock Module
- 2x Keyestudio buttons
- Kitronik Encased Piezo Element (PCB Mount)
*The buttons and piezo buzzer are optional if you plan to use the ones on the Micro:Bit.
- Jumper wires
- Cardboard
- Hot glue sticks
*Or other casing materials of your choice.
Handy Tools to Have:
- Scissors
- Ruler
- X-acto Knife
- Hot Glue Gun
Wiring the Circuit
Connect the aforementioned modules to the Micro:Bit on the breadboard according to the wiring diagram. If you are using the onboard buttons and speaker on the Micro:Bit, those parts on the wiring diagram can be ignored.
Calibrating the Clock Module
Your DS1302 module might not output the correct time initially, therefore it is often necessary to calibrate the module before fully assembling the clock. If your clock module is already adjusted to the correct time, you may skip this step. To calibrate the module, go to this link and click edit code. Change the time in the "ds set Date and Time block" to be a couple minutes after your current time. Download the code onto your Micro:Bit and press button A when your current time is the same as the time that you inputted. If the 4 digit display reads your current time, you have calibrated the module.
Download the Alarm Clock Code
To download the code for the alarm clock, go to this link, click edit code and download the code onto your Micro:Bit. You should now also confirm all parts of the code and all of your modules work:
- By default your 4 digit display should show the current time (main menu)
- Holding button A brings you to the alarm menu, and continuously increase the "hours" place by 1, and returns to 0 after 23
- Holding button B brings you to the alarm menu, and continuously increase the "minutes" place by 5, and returns to 0 after 55
- Single pressing button A sets the alarm to the time in the alarm menu and returns you to the main menu
- Single pressing button B clears any alarm set and returns you to the main menu
- Single pressing buttons A+B shows you what time the alarm is set to, if none, it will display the number 61
Making the Clock Casing
This step could vary due to the different sizes of breadboards used and/or the different designs and materials you might use. I made my casing out of cardboard. The bottom plate provides a platform for the breadboard, and the top piece hides most of the jumper wires. The parts are also easily accessible as the top pieces could be lifted up to access the internal and the Micro:Bit can be taken out without disassembling the entire clock.
But your design could be different. For example, you could add a spot to put the battery pack or even 3D-print the casing. Be creative!
Tip: When making the casing, planning where your components will be is very helpful. Here are some questions you might want to think about:
- Where am I placing my display module? Do I need to carve out a spot for it on one side?
- Will all my components be connected? Can I run the wires through?
Using the Clock
I have already stated the inputs of the clock in step 3, but here is the simplified version of it:
- By default your 4 digit display should show the current time (main menu)
- Holding button A brings you to the alarm menu, and changes the "hours"place of your alarm
- Holding button B brings you to the alarm menu, and changes the "minutes" place of your alarm
- Single pressing button A sets the alarm to the time in the alarm menu and returns you to the main menu
- Single pressing button B clears any alarm set and returns you to the main menu
- Single pressing buttons A+B shows you what time the alarm is set to
The Micro:Bit needs to be plugged in order or work, either to a computer or a battery pack. If the Micro:Bit is disconnected and reconnected to power, the time will display as usual, but a pre-set alarm will not work.
I hope you enjoy making this project. Good luck!