element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Build a Present
  • Challenges & Projects
  • Project14
  • Build a Present
  • More
  • Cancel
Build a Present
Blog Time for Christmas Tree Time!!
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dwinhold
  • Date Created: 30 Dec 2021 3:56 PM Date Created
  • Views 1046 views
  • Likes 11 likes
  • Comments 1 comment
  • binary clock
  • Build a Present
  • dwinhold
  • tree
  • buildapresentch
  • arduino
Related
Recommended

Time for Christmas Tree Time!!

dwinhold
dwinhold
30 Dec 2021

My idea for "Build a Present" has a backstory.

When I was a little younger (50 years ago), we opened our presents on Christmas Eve at 8pm (Exactly). Santa for some reason dropped off the presents early so our family tradition can continue (He still does this to the day!!). I remember when it was getting close to 8pm, my brother and I would be checking every clock in the house to see if we could gain that extra few seconds.

This tradition continues with my family, even though my kids are older now, they still can't wait until 8pm. This year, I made a wooden Christmas Tree with LED lights attached. These LED lights are attached to an Arduino Micro which is programmed to flash in a specific pattern. This pattern is a Binary Clock!! Since the kids are old enough, I told them they needed to learn how to read the clock in order to open their presents at 8pm, if they didn't, Santa wouldn't come early. It took them a couple of hours to learn, but they caught on quickly. This tree will be passed on as our family tree so future kids will learn the very old school way of coding. I also built one for friends of ours who have 4 kids, hopefully they will enjoy it as much as we do!!

The binary clock itself is a 24 hour clock.

For those who don't know how to read a binary clock, below is a "quick clock course!!".

Below is a photo of the tree where I labeled the rows for "Seconds", "Minutes" and "Hours". The seconds and minutes rows have numbers labeled 1, 2, 4, 8, 16 & 32. The hour row has numbers labeled 1, 2, 4, 8, 16.

To tell the time you add up the numbers that are lit up, example:

x = Light on

o = Light off

You read the lights right to left.

Hours:     oxxoo    = 12 hours

Minutes:  oxxoox  = 25 minutes

Seconds: xoxoox  = 41 seconds

12:25:41pm is the time

Arduino code:

int ledPinsSec[] = {2, 3, 4, 5, 6, 7};
int ledPinsMin[] = {8, 9, 10, 11, 12, 13};

int ledPinsHr[] = {A0, A1, A2, A3, A4, A5};

// set time here
int countS = 0;   // Seconds
int countM = 33;  // Minutes
int countH = 13;  // Hours

byte countSec;
byte countMin;
byte countHr;

#define nBitsSec sizeof(ledPinsSec)/sizeof(ledPinsSec[0])
#define nBitsMin sizeof(ledPinsMin)/sizeof(ledPinsMin[0])
#define nBitsHr sizeof(ledPinsHr)/sizeof(ledPinsHr[0])

void setup(void)
{
  for (byte i = 0; i < nBitsSec; i++) {
    pinMode(ledPinsSec[i], OUTPUT);
  }

  for (byte i = 0; i < nBitsMin; i++) {
    pinMode(ledPinsMin[i], OUTPUT);
  }

  for (byte i = 0; i < nBitsHr; i++) {
    pinMode(ledPinsHr[i], OUTPUT);
  }
}


void loop(void)
{
  countS = (countS + 1);
  if (countS > 59)
  {
    countS = 0;
    countM = (countM + 1);
    if (countM > 59)
    {
      countM = 0;
      countH = (countH + 1);
      if (countH > 23)
      {
        countH = 0;
        countM = 0;
        countS = 0;
      }
    }
  }

  dispBinarySec(countS);
  dispBinaryMin(countM);
  dispBinaryHr(countH);

  delay(1000);   //1 second delay
}


void dispBinarySec(byte nSec)
{
  for (byte i = 0; i < nBitsSec; i++) {
    digitalWrite(ledPinsSec[i], nSec & 1);
    nSec /= 2;
  }
}

void dispBinaryMin(byte nMin)
{
  for (byte i = 0; i < nBitsMin; i++) {
    digitalWrite(ledPinsMin[i], nMin & 1);
    nMin /= 2;
  }
}

void dispBinaryHr(byte nHr)
{
  for (byte i = 0; i < nBitsHr; i++) {
    digitalWrite(ledPinsHr[i], nHr & 1);
    nHr /= 2;
  }
}

Photos and video of the Christmas Tree:

image

image

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

I hope you enjoyed my project,

Merry Christmas and all the best in the New Year. Stay safe everyone!!

Dale Winhold

  • Sign in to reply
  • DAB
    DAB over 3 years ago

    Yes, waiting for santa was never our strong suit, but it made christmas eve so much fun.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube