Introduction: Binary Marble Clock
This is a simple clock that shows the time (hours/minutes) in binary using leds hidden beneath glass marbles.
For an average person it looks just like a bunch of lights, but you will be able to tell the time by just a quick glance at this clock. It might take you a couple of days to get up to speed on the esoteric art of fast binary counting, but you'll be able to tell the time right away, just a bit slower in the beginning.
Here's a instructable of counting in binary Binary counting.
Step 1: What You Need
- One Atmel Tiny2313 microcontroller
- One 0.1 uF capacitor
- Eleven resistors - 120 ohm
- Eleven high brightness leds. I used 6 white and 5 yellow
- One 10 MHz crystal
- Two 20 pF capacitors
- One small pushbutton
- Eleven glass marbles
- A nice piece of wood to mount it all on
Step 2: Preparing the Base
I took a a piece of wood( 3x2 cm , 50 cm long) that I found in a closet and used that as a base for the clock.
I started by drilling eleven 5 mm holes straight through for the leds. On the top I then used a 12 mm drill and drilled down like 7 mm at each 5 mm hole to get an indentation for the marbles to be put into. On the bottom I used an even wider drill and drilled out a huge chunk of wood over each led hole and then I chiseled a trench between the holes so the cables can be put there.
In the middle between the hour- and minute-leds I drilled and chiseled out a huge crater to put the electronics into.
After sanding it a bit and painted it all with a dark brown color.
Step 3: Soldering the Leds & Resistors
The leds have one short lead (minus) and a long led (plus). Insert all leds turned in the same direction and then solder all the short leads together.
Solder the 120 ohm resistors on the long leads.
Solder a wire long enough to reach the middle of the clock to each resistor.
Step 4: The CPU & Crystal
I didn't bother to make a circuit board for this project, it's easier to just solder it all together in dead bug style. (Actually I would rather call this a squashed bug because the chip is not turned upside down, but it's flattened out/squashed... ;-)
Begin by flashing the software into the chip (ATtiny2313) and test it to make sure that it works.
Then flatten the chip by angling all the leads outwards.
Solder the crystal to pin 4 & 5 on the chip. I ran the leads of the crystal on the bottom of the chip to get them out of my way.
Solder the 20 Kohm resistor between pin 1 (reset) and pin 20 (plus).
Solder the two 20 pF capactitors to pin 4 & 5 and then solder them both to pin 10 (minus).
Solder the 100 nF capacitor between pin 10 (minus) and pin 20 (plus).
Step 5: The Button
Chisel out an indentation for the button in the wood and connect the button to the wire that are connected to all the leds. Then solder another wire long enough to reach the microcontroller to the other pin of the button
Step 6: Wires
Solder the wires coming from the leds and the button to the microcontroller.
The led first led (the led farthest down) is the Minute-1 led up to the led for Minute-32 that should be just beneath the microcontroller. Above the microcontroller is the Hour-1 led.
Don't forget the wire coming from the button, solder that to pin 11 on the microcontroller.
End with soldering the power wires to pin 20 (plus) and pin 10 (minus) on the CPU. And yes, there's one final wire to do - solder a wire between the pin 10 on the microcontroller to the long wire connecting all the leds (and the button).
Finish it off by using hotglue to hold down all the wires into the trenches in a neat and orderly fashion.
Step 7: Schematic
The schematic is so simple and there's no circuit board so only made a handdrawn schematic.
Step 8: The Software
The software is written in C for the Atmel using GCC.
There are really nothing special about the software. Timer0 is used to generate interrupts every 1638.4 uS and the Bresenham algorithm is used to make sure that the clock ticks at average every second.
After power on the the clock displays a dot that flashed up & down to indicate that the time must be set.
By pressing the button the time advances as a slow rate for 15 seconds and then speeds up. If the button is just pressed momentarily (0.1-0.5 seconds) the time is decremented by one minute for easy adjustment.
Step 9: The Finished Clock
Glue the marbles by using a dab of hotglue and it's done!
Apply 5 volt to it and bask in its glory.... :-)
67 Comments
12 years ago on Introduction
This is cool! I'm gonna make one. Btw, just wondering where do you normally source for parts? Around KL/PJ or online?
P/S: Are you by any chance the same guy who came up with that QuaterK shield? Love that too :)
Reply 12 years ago on Introduction
Sometime I go to Jalan Pasar in the Pudu area, but usually I just order from Farnell/Element14. They have free next day delivery so it's quite convenient.
Since I travel to Bangkok twice a month I get a lot of stuff from the shops in the Ban Mo area there. I get standard components in bulk from there like 1000 packs of 0.1uF decoupling caps.
For the 200 QuarterK kits I did a while ago I got almost everything from the Chinese merchants on Taobao.com. The prices there is less than 50% than the already cheap Ban Mo-prices. But you have to wait for the shipping a bit longer and also use a shipping agent that will repack your stuff and send it to you since the merchants don't ship overseas and usually don't understand English.
/mats
13 years ago on Introduction
Hi!
Very nice instructable! I've built the clock, but I had no 10 MHz crystal so i used a 20 MHz one instead. I've been fiddling around with the code to compensate for this but have, so far, been unsuccessful. Without changes to the code one minute on the clock equals exactly 10 minutes in reality. What parameters should i change to make it run correctly?
14 years ago on Step 2
Why do you have 5 hour lights instead of 4? Are you doing military time, 24 hours rather than 12?
Very nice clock, BTW. I want to do something similar as a watch, but I can't find the chip already programmed for a reasonable price, and I don't want to invest in the equipment to do it myself for a single project.
14 years ago on Introduction
I finished my clock, but it runs way to slow! i made the time 23:29 last night and then went to sleep. at about 09:45 the clock said it was just after midnight! what is wrong?
Reply 14 years ago on Introduction
i got it working, i did the math, rewrote line 65 into
ticks-=169756,4444444444444444444444444443;
and now it works pretty exact, still got to find out how exact over a week, going to try that now :)
14 years ago on Introduction
u need to change ur handdrawn diagram,it says pin17 controls H16, but in the code it says pin16 controls H16, and its kinda odd to skip a led. also, how can i make the time improvement of the button go faster and the minus 1 minute go earlyer? its now bout 5 seconds for a minute (after that 15 second speed increase) and half a second for decrease of minute. i would like something that goes 1 minute increase every second after the speed increase, and 1 minute increase every 2 seconds before, and right after i push i should be able to release for a decrease of 1 minute. how do i alter the code? il upload some pictures in a slideshow when i get it all done, now its kind of messy with the wiring... also, i used a protoboard and a socket for the IC, seemed handyer to me.
14 years ago on Introduction
you need to change ur handdrawn diagram,it says pin17 controls H16, but in the code it says pin16 controls H16, and its kinda odd to skip a led. also, how can I make the time improvement of the button go faster and the minus 1 minute go earlier? its now bout 5 seconds for a minute (after that 15 second speed increase) and half a second for decrease of minute. i would like something that goes 1 minute increase every second after the speed increase, and 1 minute increase every 2 seconds before, and right after i push i should be able to release for a decrease of 1 minute. how do i alter the code? il upload some pictures in a slideshow when i get it all done, now its kind of messy with the wiring... also, i used a protoboard and a socket for the IC, seemed handyer to me.
14 years ago on Introduction
is there anyway you could help me figure out how to do this out of an old alarm clock? it uses an mm5387AA "controller" i guess its called... this clock is pretty old, at least 15 years or so, so i figured it may be easier to use this controller...
14 years ago on Introduction
1000=1
0100=2
1100=3
0010=4
1010=5
0110=6
1110=7
0001=8
1001=9
0101=10
1101=11
0011=12
How do you tell minutes? I think I did the binary right.
Never mind, I saw more than 4 marbles on a different step. That is a very good idea, but I don't have time to make one now. Do people sell these? I can picture a computer teacher buying one, or me if they were not very expensive. I am going to favorite this.
Reply 14 years ago on Introduction
you can buy them on thinkgeek.com i think, but i know you can buy wrist watch versions
Reply 14 years ago on Introduction
Flip all of the binary numbers around. You read it from right to left.
Reply 14 years ago on Introduction
Thanks! I guess my Dad taught me wrong. Oh well, I got the basic concept.
14 years ago on Introduction
A micro-controller? Bah. That's cheating my friend. There's no challenge in that ;) Although I have to admit that this is a good implementation...
14 years ago on Introduction
are there any screensavers that do this?
14 years ago on Introduction
Can you explain the time algorithm in more detail. I really don't understand it.
14 years ago on Introduction
How do you get the leds to change. Do you use a +1 to the port since it runs on binary already. like PORTD = minute
minute equals 0111010 which shows which pins are high
15 years ago on Introduction
this is really cool, is there any way to get a pre-programmed chip, and what is the power supply on this?
15 years ago on Introduction
and how are u going to connect the ic to the computer?
Reply 15 years ago on Introduction
You program it once through a usb programmer, and then you soldier everything together. Once you've decided to do this, you wo'nt be getting your chip back... Unless of course you soldier everything to a socket and then put the chip into that. It would also lower the chances of damage to the chip during soldiering. And easier way to do this without a Microcontroller is to use a 555 timer set to pulse once a second hooked up to some 7490 chips that divide the pulses and do the same thing as this. Then, if you only use one chip with 4 outputs, you can hook it up to a 4 line to 10 line demultiplexer such as the 7442 IC to drive a single digit nixie clock. That's what I did... And no MCU...