Introduction: Wake-up With Colors
I have been playing with Arduino and ledstrips for a while now, and was searching for a new little project involving Arduino, ledstrips and 3D-printing.
So came the idea of building a very custom alarm clock.
The electronics is built as a lego, using standalone electronic modules (see schematic in next chapter).
The PCB is a protoboard, and all the electronics is enclosed in a custom 3D-printed casing, so that the final result should be a little bit attractive.
The user interact with the clock by the way of 3 push buttons, a red LED, and a 7-segments display.
The system is fed with a 5V regulated USB power adapter.
See it here in action:
Step 1: Bill of Materials
Here is the list of components that are used in this instructable:
- 3 push buttons
- 1 red LED
The cabling is quite straight forward. Just follow the schematic.
Perhaps will it be necessary to put a 1K pull-up resistor on the 3 push button lines, between 5V and the 3 input pins. In my case this was working without it (the 3 inputs are configured with internal pull-up's), but I know that in certain circumstances, the absence of pull-up resistor can cause the input signal to be fuzzy.
Step 2: Construction of the Motherboard
The motherboard is a simple proto-board, cut in two parts.
The 2 boards are electrically linked by using simple wires, that are inserted at both ends into 2,54" female headers.
The 7-segment LCD display has only 4 wires to connect. I have chosen to explicitly show these 4 wires, and make it a kind of "design". In the final view, the LCD is slightly coming out of the box.
These 4 wires are thin steel rigid wires, which I bent to give them the good form. The 5th wire is there only to sustain the LCD display, to avoid it to fall.
Step 3: Construction of the Casing
The casing has been designed by me, and is 3D-printed.
I made it with the OpenSCAD tool. This is a marvelous (free) tool that generates .stl file from building scripts. You can modelize your final object, and use variables, loops and primitives, exactly like a programing language.
The source file is named "ClockProject.scad" and given in this instructable.
I printed the two parts on an Ultimaker Original +. It took about 3 hours to print the 2 parts.
I have used Cura as slicer, to generate the G-code from my 2 .stl files, to drive the 3D printer.
I configured Cura to generated support materials every where when needed (not only on the basement).
As the front piece had no sufficient contacts with the printing floor, I had to choose "raft" mode in the Cura configuration to enhance the stability of the printed object. You can see on one of my pictures the stability raft added by the slicer. This was very easily removed from the printed object, with the use of a little knife, or by hand.
Step 4: How to Use This Clock
Push shortly on B1 to cycle through the following states:
- display clock as HH:MM
- display alarm as HH:MM
- display temperature as DD (The DS3231 contains a temperature register)
Push long on B1 to leave clock mode and enter configuration mode,
then push shortly on B1 to cycle through following states:
- MM is blinking on the clock display. Use B2 to decrease value, and B3 to increase value.
- HH is blinking on the clock display. Use B2 to decrease value, and B3 to increase value.
- MM is blinking on the alarm display. Use B2 to decrease value, and B3 to increase value.
- HH is blinking on the alarm display. Use B2 to decrease value, and B3 to increase value.
- Use B2 and B3 to cycle through following alarm status: ALOn (alarm active), ALOf (alarm inactive).
- BRGH is shown on the display. Use B2 to decrease brightness, and B3 to increase brightness.
- Use B2 and B3 to cycle through the following alarm modes: BEEP, LED1, LED2, LED3.
BEEP: only a beep is output by the clock on alarm event.
LED1: a random RBG value is chosen. Brightness is then cycling from 0 to eeprom register value, then back to 0.
LED2: this is a rainbow RGB cycling test taken from Adafruit ledstrip code.
LED3: this mode is identical to LED1 mode, except that there is no brightness fading-in -out. In place, the RBG color is slowly moving to the next random one, by passing through all colors in-between.
Stopping the alarm:
When one of the 4 alarm modes is active, you may interrupt it and go back to clock mode whenever you want by pressing one of the 3 buttons.
Shutting display OFF:
When in clock mode, push shortly on B2 to shut the display OFF.
Push shortly on B3 to put display ON.
LED testing mode:
Push long on B2 (B3) to enter LED3 (LED2) test mode. The amount of time that you press B2 (B3) influence the brightness of the Ledstrip.
The brightness value that you configure by the way of this testing mode is saved in an eeprom register (another feature of the DS3231 board). This brightness value is then used by the clock to drive the Ledstrip when an alarm occurs.
To leave one of both testing mode, just push on one of the buttons.
Step 5: Firmware and Files
The ClockProject.zip file contains all needed files to made this project yours.
Have a good DIY time.