11 January 2011

First project

I gave the kids Arduino Inventor Kits for Christmas, you can read all the gory details on my About page.  If you'd rather cut right to the chase, I was way more impressed than I had expected to be, to the point that I decided to jump in to the world of Arduino myself.

I needed a first project and really didn't have to think.  I've always liked digital clocks so that seemed like a natural.  (This may go back to high school, when I built a digital clock from small-scale TTL integrated circuits.  I still have it, and I think it still works.  Maybe a topic for another time.)

So I ordered up a bunch of hardware, and luckily the Arduino Uno came first, along with a real-time clock (RTC) module.  The seven-segment LED and LCD displays were taking longer.  So I borrowed eight LEDs and a shift register from my son's kit and went at it.  I could have used some old individual 7-segment LEDs I had kicking around, along with some 7447 TTL BCD-to-7-segment decoder/drivers, but that gets to be a lot of hardware on a small breadboard and I had better ideas coming anyway.

The requirements for the first project were therefore:
  1. Read the date and time from the RTC via an I2C interface,
  2. Write to the shift register via an SPI interface, in order to
  3. Display the seconds in binary on six discrete LEDs, and finally,
  4. Write the complete date and time back to the Arduino serial monitor.
Good enough to know it's working, and also to check the accuracy of the RTC.  More on that later.

Lessons learned

Libraries needed for the project

Connecting the shift register and talking to it with SPI

Connecting the RTC, setting it, and talking to it with I2C

Sketch code
void setup() {

void loop() {


No comments:

Post a Comment