Introduction: Driftwood Binary Clock
Binary clocks have always attracted my attention and here is my version. There are a number of design elements that I believe sets it apart from other variants described on Instructables and other internet sites:
- Addressable RGB LEDs have been mounted on a copper frame that is external to the body that houses the electronics.
- An IR remote is used to set the time / alarm, snooze the alarm, select a display colour.
- The alarm tone is able to be easily personalised.
- Its in a piece of driftwood!!
The use of the external frame to support the LEDs was due to how much I liked the completed look of the display. The original plan was to have it mounted inside a box, behind opaque perspex but this would have been a design crime!
A joking comment from a co-worker led to the incorporation of the MP3 player for the alarm tone. When he found out I was building a binary clock, he made the remark that I "should go full nerd and have a dial up tone for the alarm". He was right and I have a wee laugh everytime that it goes off.
This project has been a learning experience for me and I don't admit to having everything right for either the hardware or software components. That said, hopefully there will be elements that you are able to use, modify and incorporate into your own, unique, timepiece or other project.
Step 1: Tools and Materials
While there is a long list of materials, I sourced all components off ebay at little cost. The disadvantage of the cheap components is that shipping can be very slow, but I had time to wait.
Tools
- Drill
- Soldering iron
- Multimeter
- Hot glue gun
- Chisel
- Pliers
- Sidecutters
Materials
- 2 x Arduino microprocessors
- 20 x WS2812B 5050 RGB LEDs
- 1 x 0.1uF capacitor
- 3 x 1 kohm resistors
- 1 x 470 ohm resistor
- 1 x 820 ohm resistor
- 1 x 10 kohm resistor
- 3 x NPN switching transistors
- 1 x red LED
- 1 x LDR
- 1 x IR sensor
- 1 x IR remote
- 1 x DS3231 RTC
- GDP2846A TF Card MP3 Decoder board
- 1 x 4 ohm speaker
- prototype board
- assorted dupont connectors
- hookup wire
- 18 guage copper wire
- 5v power supply
- driftwood
Step 2: Hardware
The complete circuit is as per the drawing attached above.
Now it is complete, it seems relatively straightforward but as this was the largest project I had attempted to date, the various elements of the design were added and tested as the project progressed. This iterative design cycle allowed new features to be added and tested while limiting the scope of error checking if something whent wrong.
There were a number of stumbling blocks that I will detail over the next couple of step to prevent you going through the same pain.
Step 3: Hardware - LED Array
The LED array is formed by soldering individual LEDs to a copper wire structure. The structure can be modified to suit your particular tastes and could be as large and artistic or minimalistic as you desire.
The wire needs to be thick enought to support the structure but also fine enough to allow it to be soldered to the connection pads on the LEDs. I used a 18 gauge wire.
The frame consists of a continuous circuit attached to GND and individual risers for VCC. A third connection for the signal is then made. The signal connection needs to "daisy chain" the LEDS together, with the chain starting at the LED that will indicate the hours. The tails on the wires have been left long as they will pass though the housing and then be bent over to hold it in place. The VCC wires will be connected together within the housing.
The array was marked out on a piece of scrap wood. The marking needs to account for the fact that you are soldering on the back of the LEDs and is therefore in reverse. I forgot on my first attempt and whilst the error was able to be corrected, the frame wasn't as good as I wanted, so a second version was made.
Holes are drilled into the wood to hold the LEDs in place whilst the copper is soldered on. You will find what works best for you but I constructed the columns individually first and then added the signal connection between them before adding the final frame around the exterior.
Check all connections and inspect closely to ensure no solder bridges exist. At this point I connected the array to an Arduino and wrote a simple programe to test that all LEDs were functional.
Step 4: Hardware - IR Receiver
I initially thought that the IR receiver would be a minor component in the project, I was wrong!
The timings that are used to control the LEDs are very precise and were corrupted by the interrupts used to process the receipt of a IR remote command. This could have been solved by not using a remote to control the clock but I am stubborn and had decided that this what I wanted! A different LED packaging (four wire rather than three) may have also solved the issue but I already had the LEDs and, see above, I am stubborn!
The solution was a separate arduino that recieved the commands from the IR remote and then sent them to the clock Arduino on a serial link. This means that the clock wasn't processing interupts and could action the receipt of a serial message as required within the main loop.
The solution is actually very simple but it took a bit of tinkering to understand why the clock stopped working when the remote functionality was added. This demonstrated the advantage of building and testing each component as the project progressed. As the clock stopped after adding the remote, it was easy to determine that the fault must be related to this.
Wires were soldered to the pins of the IR reciever and heatshrink applied. The dupont connectors were crimped on but not inserted into the housing. This was to allow them to be inserted into the body without requiring too large a hole.
Step 5: Hardware - Audio Module
The additional of an audio module is optional and could be either left out or replaced with a simple piezo buzzer. BUT, what better alarm tone for a binary clock is the dialup modem tone sequence!!!
The GPD2846A TF Card MP3 Decoder Board allows the playback of audio files stored on a micro SD card. It has a built in amplifier so a speaker can be attached directly to the decoder board. The decoder board plays the files on the card in a repetitive loop. This means that the alarm can be started by selecting "next" and the tone will be repeated until the "play/pause" button is selected. The "prev" selection is only required to control the volume via a long press (press length is controlled in the software).
A simple switching circuit with transistors is used to connect the audio module to the Arduino. The instructions provided in this instructable by Jason Smith were used to determine the switch arrangement. Research on the internet showed some people connected a positive voltage to the right switch pads; however, my measurements showed that these were directly connected to ground (which is also why I didn't need to connect a ground lead to these pads). I do not know if I am missing something but I can say that what I have implemented works correctly.
The speaker wire should be cut to length and soldered to the decoder board. Solder wires to the three button inputs and the power connectors. Terminate with a dupont connector. Glue the decoder board to the back of the speaker to minimise the space required for installation.
A 0.1uF capacitor is used across VCC and GND to filter noise. This is very important. Without it, the Arduinos' would reset when the audio started.
Step 6: Hardware - Minor Components
The following describes the other components used in the design. All are relatively simple but are described so that you can follow, repeat and improve what I have done.
Real Time Clock (RTC)
A RTC module (DS3231) is used to ensure the time is maintained even when power is removed from the clock. The DS3231 is claimed to be very accurate and allows both date and time to be tracked. For this project only the time is used but this makes no difference in the connections required.
The headers were removed from the module and replaced with wires. This was to give the unit a smaller footprint which is very important when you are intending of mounting all the electronics within a piece of driftwood! The end of the cable was terminated with a dupont connector.
Dimmer
A light dependant resistor (LDR) is used to measure the ambient light and alter the display brightness. A 10k resistor is used to build a voltage divider circuit that is then read by the arduino and converted to a digital value. This value is then used to calulate the brightness of the LED array. This item is optional and if you decided to remove, the code should be updated to return a static value when the Set_Brightness function is called.
The upper and lower brightness level should be adjusted within the code to suit your situation, I have set the max brightness to a relatively low level as it was found be be very bright even in a well lit room. The display is hard to read if the LEDs are too bright.
Wires were soldered onto the legs of the LDR, heatshrink attached and terminated with a dupont connector.
Alarm Indication
A red LED indicates if the alarm is set. The resistor connected is 820ohm and was chosen to ensure that the LED was relatively dim and didn't focus your attention on it. This can be increased or decreased in value if you wish. This item is optional but without it you would not know the status of the alarm, I recommend that it is included
Wires were soldered onto the legs of the LED, heatshrink attached and terminated with a dupont connector.
Step 7: Hardware - Main Circuit Board
A prototype board was used to mount the Arduinos and other electronic components. This included headers for the connectors of each off-board item.
Take some time to consider where each components should be located to minimise connections required and allow for easy track creation. I ended up with all the connectors at one end of the board with a VCC and GND rail running across the board.
In addition to making connections easy, ensure that the final layout is going to be able to be contained within the housing that you have chosen and that you can still access the USB connectors on the Arduinos to upload any code changes that are required.
The serial connection between the two Arduinos has a plug at one end. This is to allow disconnection during code upload.
Step 8: Software
The code is broken down into two programs, one for the Arduino acting as the IR receiver and the other for the Clock.
IR Receiver
Prior to uploading the IR reciever code, the hex values sent by the remote control need to be determined. The IRremote library comes with example code titled "IRrecvDemo". When uploaded to the Arduino, the hex value of key presses are displayed in the serial monitor of the Arduino IDE.
The value of seven keys needs to be recorded and then entered in the definitions section of "IR Receiver". I am unsure why, but my remote had two codes for each button and the one sent appeared random. The software allows for either code to be sent by the remote.
Buttons required are:
- Up
- Down
- Left
- Right
- Alarm
- Mute
- Time
Binary Clock
Comments are contained within the code and provide an explaination of the implementation.
Once the code has been uploaded, the following instructions are used:
- To set the time: Press Time then Up or Down to set hr, press Right then Up or Down to set min, press Right to return to the clock
- To set the alarm: Press Alarm then Up or Down to set hr, press Right then Up or Down to set min, press Right to return to the clock
- To turn off the alarm (when set): Press Alarm
- To turn on Sleep: Press Sleep
- To set the display color: Press Left or Right to cycle through the color choices
- To set alarm volume: Press Up or Down to raise or lower the volume
- To play the alarm: Press Sleep when the alarm has not been activated.
Step 9: Body
I decided to use a bit of driftwood for the body of the clock. The piece needs to be large enough to allow it to be hollowed out to contain the electronics but not to large to be out of place on a shelf. I think that the choice in body was also an excuse to go wandering along the beach for a few days before the "right" piece was found!
Alternative materials could be used for the body. These range from a block of new wood to a concrete casting. Your imagination is the only thing stopping a truely unique clock being made!
Once you have selected your body, you need to consider where the various components are mounted and where holes need to be drilled.
Start by making a cavity for the hardware. This should be as large as possible to simplify the installation but still retain strength in the wood. My piece was actually a number of intertwined roots so care had to be taken not to knock any completely off. Tool availability was limited so the cavity was made by drilling a number of holes with a large bit and then smoothing it out with a chisel. Test fit the cicuit board as you progress to ensure the cavity is going to be big enough.
Once complete, additional cutouts were made for the speaker to fit into. When doing this consider the interference with the board below and how the various connections will be made.
Holes were then drilled for the various components. The spacing of the LED array leads was measured and actually turned out to be the thickness of a builders pencil. This was used to get the correct spacing of the holes. Aim to have a snug fit for all components to simplify glueing them in place.
Once all holes have been drilled, coat the wood with a spray sealant. I selected a low-gloss product.
Step 10: Final Assembly
After the spray vanish is dry, clean out the holes for the various components.
The LED array was the first component that was installed. The leads were pushed through the holes until the desired height was reached. The GND leads were then bent over so they touched each other and soldered. Wires were attached for VCC, GND and signal. The end of the cable was terminated with a dupont connector. Hot glue was then used to ensure there was no movement in the array.
A static bag was cut up and glued in place to cover the bare copper wires of the display. This was to ensure they did not short on the prototype board when it was inserted. Standoffs could have been used to achieve the same goal but I had the static bag and didn't have any standoffs!
All other components were then fitted in place. Hot glue was used to secure each in place. The dupont housing was installed on the IR sensor cable once the sensor was secured.
The prototype board and the RTC were installed next. Both were held in place with a small screw. All cables were connected at this point and finally the speaker/audio module was put into position and secured.
There was a slight rock in the base, this was corrected by the addition of a couple of rubber feet. The feet also ensure that the speaker screws were not in contact with the table surface.
Step 11: Finished!
If you managed to get this far you will have a complete, and hopefully unique clock. Please post your creations!
There is nothing that I would do to change or improve the design at this time. My sons have suggested that the display should automatically change colours or simply go crazy at random intervals. I like the way they think and might do that soon.