Time Squared – Word Clock

A company in Germany sells absolutely stunning time pieces that attract oohs and ahhs from everyone who sees them. They are called the ‘Qlock Two’. If you are like me and crave balance and symmetry, the Clock Two will not disappoint. Unfortunately they are not yet available in the United States, and at $1500 a piece, it is unlikely that they would be easy to come by, even if they were sold here. Now that is a problem, because I really want one.

 

Update: The code is now hosted on github

Note that there are two branches, Master and Arduino Uno

If you are using the newer Adruino Uno board (It will say uno on it) Make sure you check out the code from the Arduino Uno Branch.

https://github.com/spudstud/TimeSquared

wpid-safari-2010-12-5-23-16.png

With the college semester coming to a close, I decided to do something about my predicament of wanting something I couldn’t have. About 3 weeks and $85 later the ‘Time Squared’ was born.

Technical Features

114 white led’s wired in a matrix
Atmega 328 Microprocessor @ 16Mhz
2 Led Drivers (Maxim 7219)
Atomic Clock Radio to automatically update time WWVB
1307 IC programable Real Time Clock
Light Sensor – Automatically adjusts to room brightness
Touch Sensors Switch modes (on/off, seconds, manual update)
Plexiglass front with black vinyl sticker cutout

wpid-dsc_6590-2010-12-5-23-16.jpg

On to Construction

The real Qlock Two is made from high quality molded plastics. Since I am a student and make minimal money, I settled for a steel back and wood frame.

wpid-aperture-2010-12-5-23-16.png

The dimensions are 18 x 18 inches square. There are 11 Columns and 10 rows of lights plus 4 leds in the corner totaling 114 leds in total. The placement of the center of each light was measured on an Adobe Illustrator file of the letter layouts. Luckily I was not the first person to do this project so I used RuddBurger’s pre made file here (it’s in german)

The L.E.D.s where soldered to VeroBoard. I bought an 11 X 6 Inch board and tediously cut it into strips using a jewelry saw. This part was by far the most grueling part of the whole project. I could have bought smaller strips that would require less cutting, but I had to save every penny I could on this project.
In case you are wondering, veroboard is a type of circuit prototyping silica that has single lines of copper that run one direction of the board. I bought mine on ebay for less than $10.
wpid-1____aperture-2010-12-5-23-16.png

wpid-2____aperture-2010-12-5-23-16.png

The led’s were then soldered to the veroboard. Since the final circuit would be wired in a matrix where the – goes along the horizontal line and the + goes along the vertical, I cut the copper next to every – lead isolating them from their neighbors. It will become more clear why I did this later on.

wpid-3____aperture-2010-12-5-23-16.png

Each hole in the vero board is exactly 1mm apart. Since my measurements didn’t line up exactly with the veroboard, some leds are 12mm apart and others are 13mm apart. In the picture the horizontal are the negative and the vertical strips are the positive. I eventually realized that by leaving the + leg on the led’s I would need less wire when I hooked up the vertical strips.

wpid-4____aperture-2010-12-5-23-16.png

one six-foot strip of soft “base board” wood was cut at 45 degree angles to make a perfect square 18 inch frame. Scrap wood was then used to reenforce the corners. Ace hardware made the four 45 degree angle cuts for me on their circular saw. Despite asking for a deal they still charged me .50 cense a cut! ( I told you that I am broke!) I cut the inside supports by myself trying to save two bucks, but realized that 45 degree angles are very difficult do make with a hand saw. Don’t be cheep like me, cut them right. (Also I highly recommend not taking on projects while you are a student in college).

Getting the 4 corners to line up at exactly 90 degrees was much more difficult than I would have thought.

wpid-5____aperture-2010-12-5-23-16.png

A center punch, 1/16 if an inch drill bit and the smallest nails I could find firmly attached the wood to the metal.

wpid-6____aperture-2010-12-5-23-16.png

I went one step further and put a big fat nail in the bottom two corners These would be the touch sensitive buttons. Rather than pysical buttons, a circuit attached to these metal nails will respond simply by touching them with anything that holds a charge (e.g. your skin). I originally tried putting strips of metal in the corner, but found they were too sharp and too difficult to stay in place. If you look really close at this picture, you may still be able to see the metal strip.

wpid-7____aperture-2010-12-5-23-16.png

A broken printer sacrificed it’s usb port. We will forever thank you good printer. The hole in the wood is for the light sensor.

wpid-8____aperture-2010-12-5-23-16.png

The led driver (maximum 7219) is hooked up to one section of the led matrix. This chip receives a simple binary number and turns on that number in the matrix for 1/600 of a second. The reasoning is; no two led’s can be turned on in the same row or column at the same time, since it would light up every led in between them. To the human eye the leds appear to be on constantly, but really are refreshing extremely quickly like a CRT Television. This is the part of the project that took some research. The 7219 needs a capacitor and a resistor. The resistor must be very carefully calculated depending on how many led’s you have and how many milliamps they are. A great tutorial on using this chip can be found at these links;

7219 Arduino

7219 Resistance tutorial

7219 Daisy Chaining * My design does NOT use daisy chaining.

7219 Vin Marshal Tutorial Thanks vin marshal. Most of my code was forked from his work.

wpid-9____aperture-2010-12-5-23-16.png

Black acrylic paint on the inside and white on the outside with a protective clear coat. Spray paint gave less than optimal results. A good old fashion brush works best.

wpid-10____aperture-2010-12-5-23-16.png

The usb port provided a steady 5 volt supply, however in certain situations, ripple and tiny power dips caused funky results from the microprocessor. It was most noticeable when running the clock from a usb wall adaptor. To resolve the issue I added capacitors to the input to reduce any ripple that was coming in from the AC to DC conversion. The diodes weren’t necessary and I eventually removed them. From right to left, 0.1pf, 22pf, 10uf, 40uf, 100uf capacitors. I am not an electrical engineer so note that this setup is probably overkill. If you want to learn more about ripple check out spark fun’s tutorial here.

wpid-11____aperture-2010-12-5-23-16.png

All parts in place and clear glass 18 x 18 panel being measured.

wpid-12____aperture-2010-12-5-23-16.png

I originally started with 3/16” glass because it was much more scratch resistant and attracts less dust. Due to the fact that I was unable to get a perfectly square sheet and glass is heavy, I switched to 1/8” plexiglass.

wpid-13____aperture-2010-12-5-23-16.png

A custom circuit board for the touch sensor IC. A full tutorial on interfacing a touch sensor with an Arduino can be found on my blog here.

wpid-14____aperture-2010-12-5-23-16.png

wpid-15____aperture-2010-12-5-23-16.png

The plexiglass is attached to the frame with magnets so that it is easily changeable. I shopped around for a long online trying to find cheap super powerful thin magnets, but couldn’t find anything I liked. I realized that hard drive magnets are super strong, free and very thin. I routed out the wood and put the magnet in the wood with epoxy. Not very pretty but works great.

wpid-16____aperture-2010-12-5-23-16.png

A picture of the Atomic Clock Module. Thanks to vinMarshal for help with the coding here. You can see his implementation here. I wrote a full arduino & WWVB (atomic clock) tutorial on my blog here.

Below it is the 1307 Real Time Clock. It is very easy to implement with an arduino since the libraries are very well documented. Simply send it the hour, minute, seconds, day and month and it will keep ticking as long as it has power. A backup battery prevents it from loosing the correct time. The clock is accurate to several minutes per year. I considered using the more accurate yet more expensive ChronoDot but since it has an atomic radio, the time is synchronized to the second with the Atomic Clock in Colorado every day.

wpid-17____aperture-2010-12-5-23-16.png

Do not use old solid core networking cable. It will make your life miserable. Instead I recommend you use good stranded core wire.
Below you can see the 7219 on the left, a RBB arduino in the center, and a red touch sensor dangling to the right.

wpid-18____aperture-2010-12-5-23-16.png

The black face was done with a vinyl sticker cut out and stuck to a piece of plexiglass. The sticker was applied to the inside of the plexiglass giving it a glossy look. Some have wondered about bubbles forming on the inside. When I first applied the sticker, there were a lot of bubbles despite my best effort to avoid them. Luckily they disappeared on there own after a couple of days. If I were to do this part over again I would have put some water with a drop of baby shampoo in a spray bottle and wetted the glass first. That makes any bubbles that do form very easy to squish out with a credit card.

Feel free to use my illustrator file here.

Time Squared Vinyl Sticker

The best way I have found to attach stickers to a large object is to tape it down with the wax paper still attached. Then lift up 1/2 of the sticker. Remove the wax paper and carefully apply while removing all the bubbles with a credit card. Once the first half is in place, lift the other half of the sticker up and repeat. Take a look at this video of applying a sticker to a laptop to get a better idea of how it is done.

http://www.youtube.com/v/hJV1qIcWyio?fs=1&hl=en_US

wpid-19____aperture-2010-12-5-23-16.png

wpid-20____aperture-2010-12-5-23-16.png

wpid-21____aperture-2010-12-5-23-16.png

wpid-22____aperture-2010-12-5-23-16.png

wpid-23____aperture-2010-12-5-23-16.png

wpid-24____aperture-2010-12-5-23-16.png

I had more air bubbles than I would have liked. The next time I would probably use water with a tiny bit of baby shampoo to aid in the application process. Luckily about 95% of them went away on there own over the next few days.

To help diffuse the light, I left the white backing on the sticker. It gave the letters a semitransparent white look and made the letters really pop.

wpid-25____aperture-2010-12-5-23-16.png

I considered making individual baffles to prevent the light from one letter from leaking into the neighboring letters. This turned out to not be necessary since the light bleed is less than expected.

wpid-26____aperture-2010-12-5-23-16.png

wpid-27____aperture-2010-12-5-23-16.png

A photo of the corner and the metal nail acting as a touch sensor. The white paint was protected with a clear coat. All paint had to be removed from the metal touch sensor for reliable readings.

wpid-28____aperture-2010-12-5-23-16.png

26 Seconds.

wpid-29____aperture-2010-12-5-23-16.png

Other Resources

Inspiration

http://www.flickr.com/photos/19203306@N00/sets/72157622998814956/

http://blog.makezine.com/archive/2009/11/qlocktwo_remake.html

Illustrator File

http://crashdummy.nl/shizzle/qlocktwo_front_3372.eps

Light Sensors

http://www.instructables.com/id/Photocell-tutorial/

I welcome feedback and comments to help improve the quality of my posts. Have something on your mind? Let me know.

Macbook Pro Left Audio Issue

I got my new unibody macbook pro 15 inch a few weeks ago and it is AWESOME! I was sitting on my couch watching some hulu when I noticed that the sound didn’t seem quite right, It sounded like the audio was coming out of the right speaker louder than the left. I stopped what I was doing and checked the system preferences to see if the balance was off. It was fine, I restarted the computer and tried watching hulu again. The problem was still there. An extensive search on the internet revealed that it is a ‘feature’ not a problem. The reason is that there are 3 speakers in the macbook pro; A Left, Right and “Subwoofer”. Unfortunately the subwoofer had to be placed on the right side by the DVD rom drive for space issues, which results in the right speaker sounding louder than the left.

Photo credit iFixit.com

wpid-wpid-c2kt5m3yonfjypew-medium-2010-12-4-18-52-2010-12-4-18-52.jpeg

Left Speaker

wpid-wpid-uxw1mkhjievyrryy-medium-2010-12-4-18-52-2010-12-4-18-52.jpeg

Right Speaker and Subwoofer

If you have noticed this issue with the macbook pro’s sound, you are obviously just more observant then the typical mac user. There is nothing wrong with your laptop, continue on as you were.

Getting started with Teensy (Usb rubber ducky)

Got your teensy? Alright, here is how we get started. There are several different ways to get code onto your board. Some people prefer to do it from the command line, but I am a huge succor for the Graphical User Interfaces.

You will need to download 3 separate programs. If you have done any programing in the past with arduinos, you most likely already have the first one. Even if you do, re download it to make sure you have the latest version.

I recommend that you don’t plug in your teensy just yet. You already did plug it in? Don’t worry, nothing broke. I’ll tell you when it’s time to plug it in later on.

Download all 3 of these programs:

1.Arduino IDE – Free, cross platform and can program almost every atmel microprocessor you will probably run into.

wpid-wpid-finder-2010-10-21-21-342-2010-10-21-21-343.png

2.TeensyDuino – A plug in that adds Teensy support to the standard Arduino environment. It runs under the hood so you won’t actually see anything going on. Its purpose is to let the Arduino IDE set whether the teensy shows up a serial port, keyboard or a flash drive.

3.Teensy Loader – Absolutely essential for getting the code on to the board. Has a nice graphic that shows whether you are in ‘running’ or ‘programing’ mode.

wpid-wpid-1____finder-2010-10-21-21-342-2010-10-21-21-343.png

The first step is to get arduino software installed on your computer.  Getting this installed is pretty straight forward. Follow the directions on the Arduino website http://arduino.cc/en/Main/Software

When you have that installed, you are ready for the next step.

Close out of the Arduino program and run the TeensyDuino plugin that you downloaded in step 2. (Mac users, no need to copy the program to the application folder, once you run it, you can then delete the installer. I know, it looks like a program, but really it is just a plug-in.

You will be asked to find the location where the arduino software is installed. *You may run into problems here if you renamed your arduino program, or if you are running older versions. You must point the installer to the same folder that you installed the Arduino IDE.  Trying to install it to Program Files or the Applications folder will not work. This trips up many people the first time they try and install it.

If the next button doesn’t highlight even though you have selected the arduino folder, re download all 3 programs making sure that they are the latest versions, then start over. Also triple check that you selected the correct ardunio folder. My machine has multiple hard drives, so I had to navigate until I found the right one.

Alright, you made it this far, just one last step. Install the Teensy Loader program. It should go pretty quick. When that is done, you should see a screen like this. You need to leave this running.

wpid-wpid-teensy-2010-10-21-21-342-2010-10-21-21-343.png

Sweet! Now you can plug in your teensy (I told you I would let you know when) and fire up the arduino software.

You will most likely be presented with a blank screen.

wpid-wpid-arduino-2010-10-21-21-342-2010-10-21-21-343.png

Lets check a couple of settings. First lets go to “Tools>Board” and select the type of teensy you purchased. (Most likely you have version 2.0) If you aren’t sure, then check your receipt. If you can’t find what I am talking about, then you most likely need to reinstall the TeensyDuino Plugin. See step 2.

wpid-wpid-arduino1-2010-10-21-21-342-2010-10-21-21-343.png

Ok Lets start programming. First we will make a simple program to make the onboard led blink. Here is the format for every program you will write. Start out with 2 functions. A Setup() function and a Loop() function, both are returning void.

wpid-wpid-1____arduino-2010-10-21-21-342-2010-10-21-21-343.png

The setup() runs once whenever power is applied. You put in setup your initialization of the pins, and your global variables. After that it proceeds to the loop function and will do just what it says, loop endlessly.

Ok, now lets tell the board where the LED is. we know from the documentation that there is a built in led on pin 11. Every pin on the board can be either an input or an output. Outputs are for controlling an external device, (led, motor, buzer). Inputs are for sensors and interrupts.

This is how we setup the led on pin 11. It goes in the setup function.
wpid-wpid-2____arduino-2010-10-21-21-342-2010-10-21-21-343.png

Now in the loop function, lets turn on the led for 2 seconds, then turn it off for 1 second.

wpid-wpid-3____arduino-2010-10-21-21-342-2010-10-21-21-343.png

digitalWrite(11,HIGH);                 – sends 5 volts to pin 11.
delay(2000);                         – waits 2000 milliseconds (aka 2 seconds) before moving on.
digitalWrite(11,LOW);                 – sends 0 volta to pin 11.
delay(1000);                                 – waits 1000 milliseconds before moving on.

Great, you have your first program written. Lets upload it to the board.

Compiling & uploading your program

Compiling your code will convert it from english to the 1’s and 0’s the microprocessor understands. In the arduino software, you can compile by pressing the “play button” in the left top corner.
wpid-wpid-4____arduino-2010-10-21-21-342-2010-10-21-21-343.png

Click Compile then after a couple seconds you should see “Done compiling” in the bottom message box. If you don’t, double check your code. Every digitalWrite should be orange if you spelled it correctly, and every { should be matched with a }. If you get an error about only finding version 1.05 of the teensyduino software, go to the download page and re download version 1.06. Apparently the download link sometimes points to an out of date version. You must have version 1.06.
wpid-wpid-5____arduino-2010-10-21-21-342-2010-10-21-21-343.png

Bring your Teensy Loader program into focus with alt tab or click the icon in the dock / start bar (You did leave it running didn’t you?).

To upload your now compiled code, push the physical button on your teensy. Pushing the button will set the microprocessor to “programming mode”.

Once you do that you will see your Teensy Loader program change its picture.

The screen should switch from this
wpid-wpid-1____teensy-2010-10-21-21-342-2010-10-21-21-343.png

to this

wpid-wpid-safari-2010-10-21-21-342-2010-10-21-21-343.png

Ok, now we are ready to upload. Leave the Teensy Loader application open, and switch back to the arduino software. Press the Upload button.

wpid-wpid-1____arduino1-2010-10-21-21-342-2010-10-21-21-343.png

Uploading your first program should only take a couple of seconds. When it finishes your teensy should automatically restart and start running your script. You know that you didi it correctly if the led turns on for 2 seconds then off for 1, repeating for ever.

Other things to try.

What happens if you change the pin 11 to pin 12?

What happens if you change the 2000 to 5000?

Will the code compile if you delete the setup function?

If you are ready for some more advanced ideas, check out DaberManias blog here

Control a robot via internet

The gap between technology and the real world has been bridged. It is called the Orbduino, and yes it is run by the magical arduino. When you go to this webpage here, you are granted 45 seconds of control. If there are multiple users, the system automatically rotates control. Go ahead and try it out. Seriously stop reading and try it.

Giving up on Github

The new hip and cool thing is to share your code on github. By doing that, anyone can contribute and make changes to your code, while still having everything be reservable. Apparently I am too old to use it. (I’m 23). Even after 7 hours the extent of my github is an empty readme file. 😦

I am sure someday I will figure it out, in the mean time, here is my code.

/*
| The Word Clock |
A wall clock with no hands or numbers, only letters. Lights up the letters that spell out the time.
| Examples |
“IT IS TEN O’CLOCK”
“IT IS HALF PAST NINE”
“IT IS A QUARTER TO FOUR”

Touch Sensor for Arduino

Update: The QT118h is now impossible to find. Apparently the QT product line is extinct. If you are looking for an alternative to the QT118 check out Azoteq’s products

http://www.mouser.com/azoteq/

Electronics are no good unless you have a way to interact with them. Typically a standard push button has been the standard. I sell TV’s and LCD monitors for a living and all of the new models have removed all the boring buttons and replaced them with super sexy touch sensors. I wanted to emulate this on my word clock, so that touching a corner will either change the brightness or the hour/minute.

There is a really basic method for detecting touch on an Arduino or similar using just a resistor and a wire however I found it somewhat unreliable. Atmel has a product line called the QTouch, that is specifically designed to do the heavy lifting. I used this one (118H) because it was pretty much the only one I could find in stock. But rest assured, all of the QT line are pretty much the same. The difference between the 188 and the 118h is that the 118h goes from 0v (low) to 5v (high) on the output while the vanilla 188 is the opposite.

wpid-wpid-screen-shot-2010-05-30-at-1-14-23-pm-e1275246995513-2010-05-29-18-01-2010-05-29-18-01.png

Wiring the QT118h:
Here is the IC. The top left pin with the dot is pin 1, and the top right is pin 8. Pins 1,3 and 4 go to positive 5v. Pin 8 goes to ground. Pin 7 connects to whatever you are using as a sensor. It could be a piece of aluminum foil, a nail, or anything else metailic. The beauty of these sensors is that if you turn up the sensitivity, just getting close will indicate a touch. Just imagine hiding your sensor behind a piece of plastic or glass. Pins 5 and 6 each are connected to 1 side of your capacitor. Play around with different values for different sensitivity. 10 nf to 500 nf is the recommended value, but I found 600 nf to be the most accurate for my purpose. The output pin is pin 2. With the 118h, it goes high on a successful touch. Connect it to a LED, a transistor, or an input pin on an arduino like I did.

wpid-wpid-screen-shot-2010-05-30-at-1-24-30-pm-2010-05-29-18-01-2010-05-29-18-01.png


If you are keeping track, there is still one pin unaccounted for. Pin 5 (bottom right) is for sensitivty, in my situation I left it unhooked for the default maximum gain. wpid-wpid-screen-shot-2010-05-30-at-1-10-30-pm-2010-05-29-18-01-2010-05-29-18-01.png

Code:

The QT IC has only two output states, just like a pushbutton. You can use the same code with only a change to the input pin. Open up the arduino software, and go to File, Examples, Digital Button.

wpid-wpid-screen-shot-2010-05-30-at-2-12-11-pm-2010-05-29-18-01-2010-05-29-18-01.png

// constants won’t change. They’re used here to
// set pin numbers:
const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}

Arduino Atomic Clock

What is WWVB?

WWVB is 60Khz carrier signal that broadcasts the current time from Fort Collins Colorado. The antennas broadcasting the signal have been running nearly continuously since 1965.
The signal is remarkably slow, transmitting only 1 bit per second. With 60 bits in the message it takes a full minute to receive the time.

70 KW towers located in Fort Collins Colorado.

wpid-file-wwvb_antenna-2010-05-26-01-101.jpg

Image http://en.wikipedia.org/wiki/WWVB

Receiving the signal

The part you will need to buy / salvage to receive the WWVB signal is the CMMR-6P-60. It is available from Digikey 561-1014-ND. Note that there is also a 40 kHz and a 77 kHz variant. If you live in the united states, you want the 60 kHz module.

For only $2 more, you can buy a bigger antenna. 561-1001-ND. Unless you live in Colorado, those will be $2 very well spent.

wpid-wpid-screen-shot-2010-05-26-at-12-37-44-am-2010-05-26-01-10-2010-05-26-01-101.png

Hooking it up

See the data sheet for full instructions. Basically to get it working, you need to connect “PON” to Ground, and connect “TCO” to your micro controller. Optionally connect an LED to “TCON” to visualize the actual bits coming in.

Connect the TCO to pin 2 on the arduino,

Connect a led to pin 13 of the arduino.

wpid-wwvb-2010-05-26-01-101.png

Writing the Code

Head over to github to get the arduino sketch. Thanks goes to vinmarshal for his excellent work on this.

https://github.com/spudstud/WWVB-Clock

You will notice that there is simulator sketch which you can load on another arduino to simulate the wwvb module. This comes in handy if you live far away from colorado or are only able to pick up the radio signal at night. Upload the simulator code to a second arduino, and connect it to pin 2.

Once you get the board powered up, you should see the led on the wwvb module blinking like crazy. That is because of interference. Remember wwvb has a transmit rate of one bit per second, so the led should be blinking very slowly. I can’t emphasize enough how susceptible the radio is to interference. I can only get a good connection if all nearby electronics are turned off. (Especially my plasma tv). Frequently I would be getting a good steady transmission until my roommate would walk in to the room with his macbook pro. I’d have to wait until he would leave to get a good transmission again.

Once you finally get a full 60 bits without corruption, the led on pin 13 of the arduino should light up for 10 seconds.

wpid-wpid-screen-shot-2010-05-26-at-12-24-15-am-2010-05-26-01-10-2010-05-26-01-101.png

Final Considerations

-The wwvb code is pretty basic. Additional features / bug fixes are welcome.

-Don’t expect a successful transfer very often. Updates are most likely to happen late at night because radio waves travel further on earth at night.

-Power supply is important.  The ripple caused by cheap power supplies is death for sensitive signals. Genuine Apple iPhone chargers work best for me.

Measure your distance from the antennas here

Credits go to duinolab.blogspot.com for his tutorial.

The Github code first appeared in popular science http://www.popsci.com/diy/article/2010-03/build-clock-uses-atomic-timekeeping

Links

Popular Mechanics Clock

Salvaging a WWVB Modual

Arduino Forum

Arduino Forum 2

561-1014-ND

561-1001-ND.

Github

http://www.nist.gov/pml/div688/grp40/wwvb.cfm