element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
Holiday Special 20
  • Challenges & Projects
  • Project14
  • Holiday Special 20
  • More
  • Cancel
Holiday Special 20
Blog The Christmas Forest
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Holiday Special 20 to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fmilburn
  • Date Created: 8 Dec 2020 4:53 AM Date Created
  • Views 3821 views
  • Likes 13 likes
  • Comments 10 comments
  • 3D Printing
  • leds
  • christmas
  • holidayspecial20ch
  • arduino
Related
Recommended

The Christmas Forest

fmilburn
fmilburn
8 Dec 2020

image

Once upon a time there was a girl who wanted a Christmas Tree for her doll house.  So she asked her grandfather if he would help.  They found stickers to use for decorations and tiny fairy lights to make it glow.

image

 

And the grandfather designed a Christmas tree in Fusion 360 and printed it in red and green PLA on his Anycubic I3 Mega 3D printer.

 

image

 

The girl slotted the tree together and stuck it into the base.  And then she decorated it with stickers and wrapped the lights around the tree.

 

image

 

But the girl had brothers and a sister and there was only one tree.  So the next week they built more, one for each sibling.  But the lights didn't blink. So the grandfather who liked to tinker with electronics measured the current necessary to light a string of fairy lights and found it to be about 6 mA with Vf approximately 2.6V.  And they needed a microcontroller so the grandfather rummaged through his stuff and found a ESP8266 that would do the trick.  Then he soldered a current limiting 150 ohm resistor between each string of lights and four pins on the microcontroller.

 

image

 

 

And he made a box with the 3D printer to hold the microcontroller.

image

 

And he wrote some code using the Arduino IDE.

 

/* Control of miniature Christmas trees
 * Written and tested on NodeMCU Amica ESP8266 (ESP12-E Module)
 * F Milburn, December 3, 2020 Rev1
 */


void displayOff(){
  digitalWrite(D5, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D7, LOW);
  digitalWrite(D8, LOW);
}


// numBlinks is number of times to blink LEDs
void blinkDisplay(int numBlinks){
  int i;
  for(i=0; i<numBlinks; i++){
    digitalWrite(D5, HIGH);
    digitalWrite(D6, HIGH);
    digitalWrite(D7, HIGH);
    digitalWrite(D8, HIGH);
    delay(500);
    digitalWrite(D5, LOW);
    digitalWrite(D6, LOW);
    digitalWrite(D7, LOW);
    digitalWrite(D8, LOW);
    delay(500);
  }
}


// numFades is number of times to fade the LEDs
void fadeUpfadeDownDisplay(int numFades){
  int i;
  int j;
  for(i=0; i<numFades; i++){
    for(j=0; j<1024; j++){
      analogWrite(D5, j);
      analogWrite(D6, j);
      analogWrite(D7, j);
      analogWrite(D8, j);
      delay(5);
    }
    delay(100);
    for(j=1023; j>=0; j--){
      analogWrite(D5, j);
      analogWrite(D6, j);
      analogWrite(D7, j);
      analogWrite(D8, j);
      delay(5);
    }
    delay(100);
  }
}


// numWaves is number of times to wave the LEDs
void waveDisplay(int numFades){
  int i;
  int j;
  for(i=0; i<numFades; i++){
    for(j=0; j<1024; j++){
      analogWrite(D5, j);
      delay(2);
    }
    delay(100); 
    digitalWrite(D5, LOW);
    
    for(j=0; j<1024; j++){
      analogWrite(D6, j);
      delay(2);
    }
    delay(100);
    digitalWrite(D6, LOW);    
    
    for(j=0; j<1024; j++){
      analogWrite(D7, j);
      delay(2);
    }
    delay(100);
    digitalWrite(D7, LOW);
    
    for(j=0; j<1024; j++){
      analogWrite(D8, j);
      delay(2);
    }
    delay(100);
    digitalWrite(D8, LOW);


  }
}


// numSweeps is number of times to scan the Larson scanner
void larsonDisplay(int numScans){
  #define LEDS 4
  #define FRAMES 14
  bool larson[FRAMES][LEDS]={
    {HIGH, LOW, LOW, LOW},
    {HIGH, LOW, LOW, LOW},
    {HIGH, HIGH, LOW, LOW},
    {HIGH, HIGH, HIGH, LOW},
    {LOW, HIGH, HIGH, HIGH},
    {LOW, LOW, HIGH, HIGH},
    {LOW, LOW, LOW, HIGH},
    {LOW, LOW, LOW, HIGH},
    {LOW, LOW, LOW, HIGH},
    {LOW, LOW, HIGH, HIGH},
    {LOW, HIGH, HIGH, HIGH},
    {HIGH, HIGH, HIGH, LOW},
    {HIGH, HIGH, LOW, LOW},
    {HIGH, LOW, LOW, LOW},
  };
  int i;
  int j;
  for (i=0; i<numScans; i++){
    for (j=0; j<FRAMES; j++) {
      digitalWrite(D5, larson[j][0]);
      delay(50);
      digitalWrite(D6, larson[j][1]);
      delay(50);
      digitalWrite(D7, larson[j][2]);
      delay(50);
      digitalWrite(D8, larson[j][3]);
      delay(50);
    }
  }
}


// numTimes is number of times to display
void everyOtherDisplay(int numTimes){
  int i;
  for (i=0; i<numTimes; i++){
    digitalWrite(D5, HIGH);
    digitalWrite(D6, LOW);
    digitalWrite(D7, HIGH);
    digitalWrite(D8, LOW);
    delay(500);
    digitalWrite(D5, LOW);
    digitalWrite(D6, HIGH);
    digitalWrite(D7, LOW);
    digitalWrite(D8, HIGH);
    delay(500);
  }
}


// numTimes is number of times to display
void innerOuterDisplay(int numTimes){
  int i;
  for (i=0; i<numTimes; i++){
    digitalWrite(D5, HIGH);
    digitalWrite(D6, LOW);
    digitalWrite(D7, LOW);
    digitalWrite(D8, HIGH);
    delay(500);
    digitalWrite(D5, LOW);
    digitalWrite(D6, HIGH);
    digitalWrite(D7, HIGH);
    digitalWrite(D8, LOW);
    delay(500);
  }
}


void setup() {
  
  // Initialize the output variables as outputs
  pinMode(D5, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D7, OUTPUT);
  pinMode(D8, OUTPUT);
}


void loop(){


  blinkDisplay(5);
  delay(2000);


  fadeUpfadeDownDisplay(1);
  delay(2000);


  waveDisplay(1);
  delay(2000);


  larsonDisplay(2);
  displayOff();
  delay(2000);


  everyOtherDisplay(5);
  displayOff();
  delay(2000);


  innerOuterDisplay(5);
  displayOff();
  delay(2000);
}

 

The trees in the forest began to blink, and fade, and flash with different patterns.

 

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

 

And there was a Christmas Forest.

image

 

Additional notes on construction:  The fairy lights came in a box of 10 with 2032 coin cell holders for $11 on Amazon.  The "3D" stickers can be bought off Amazon or found in Dollar stores and other purveyors of inexpensive children's toys.  Any Arduino or Arduino clone should work but be careful not to overload the pins and LEDs by keeping the current under 10 mA per string.

 

Wishing you and yours the best this Holiday Season.

  • Sign in to reply

Top Comments

  • jw0752
    jw0752 over 4 years ago +10
    I don't know but Grandpa sounds an awful lot like Santa to me. John
  • Andrew J
    Andrew J over 4 years ago +6
    It’s what grandads and grandchildren were invented for. Lovely story.
  • colporteur
    colporteur over 4 years ago +5
    I have recommended to the E14 managerial cabal that you receive the BCGA for 2020. Great story, Best Christmas Grandpa Award winner!
Parents
  • jw0752
    jw0752 over 4 years ago

    I don't know but Grandpa sounds an awful lot like Santa to me.

     

    John

    • Cancel
    • Vote Up +10 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • jw0752
    jw0752 over 4 years ago

    I don't know but Grandpa sounds an awful lot like Santa to me.

     

    John

    • Cancel
    • Vote Up +10 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
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