3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

LED Cube 8x8x8

Step 31Build the controller: clock frequency

Build the controller: clock frequency
«
  • IMG_6089.JPG
  • IMG_5977.JPG
  • IMG_6080.JPG
  • IMG_6088.JPG
  • IMG_6092.JPG
We use an external crystal of 14.7456 MHz to drive the ATmega system clock.

You may be thinking that this is an odd number to use, and why we didn't run the ATmega at the 16MHz it is rated for.

We want to be able to control the LED cube from a computer, using RS232. Serial communication requires precise timing. If the timing is off, only by a little bit, some bits are going to be missed or counted double from time to time. We won't be running any error correcting algorithms on the serial communications, so any error over the line would be represented in the LED cube as a voxel being on or off in the wrong place.

To get flawless serial communication, you have to use a clock frequency that can be divided by the serial frequency you want to use.

14.7456 MHz is dividable by all the popular RS232 baud rates.
  • (14.7456MHz*1000*1000) / 9600 baud = 1536.0
  • (14.7456MHz*1000*1000) / 19200 baud = 768.0
  • (14.7456MHz*1000*1000) / 38400 baud = 384.0
  • (14.7456MHz*1000*1000) / 115200 baud = 128.0
The formula inside the parentheses converts from MHz to Hz. First *1000 gives you KHz, the next Hz.

As you can see all of these RS232 baud rates can be cleanly divided by our clock rate. Serial communication will be error free!
« Previous StepDownload PDFView All StepsNext Step »
7 comments
Mar 16, 2012. 9:52 AMjtovar93 says:
Do crystals have polarity like LEDs?
I am not sure if the way I insert the crystal makes a difference.

Thanks in advance.
Mar 16, 2012. 5:17 PMjwestenberg says:
Crystals that have polarity have three legs. Most crystals do not have polarity, so I'm pretty sure you don't have to worry about it!

Good Luck!
Mar 20, 2012. 12:16 AMjtovar93 says:
Alright, thanks.
I keep bumping into this type of questions.

I am assuming it would be the same for the ceramic capacitors, right? Or do these have polarity?
Mar 20, 2012. 2:22 AMjwestenberg says:
Ceramic capacitors don't have polarity.

Electrolytic capacitors do have polarity though. Usually it is indicated where ground has to go.

Don't worry about asking questions, the community is there to help you build these awesome things!!!
Nov 24, 2011. 2:33 PMScerion says:
I guess if you use an ATMega328, or other chip that has a hardware UART then you can dispense with the crystal altogether and just use the internal oscillator?
Nov 17, 2011. 9:09 AMbrucesallen says:
My clock would not run until I programmed the fuses. Drove me crazy.
Jul 5, 2011. 2:45 PMplok91765 says:
@chr I was wondering if the RS232 is necessary for the design. I'm hoping to setup my cube to be able to work by itself I remember that you mentioned in the 4x4x4 cube design that the RS232 component is optional. (Was hoping the same would apply to this one.
Jan 25, 2011. 4:38 PMelectric11 says:
@chr

Can I use a Mac to control the cube?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
651
Followers
7
Author:chr
I like microcontrollers and LEDs :D