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
Holiday Special 20
  • Challenges & Projects
  • Project14
  • Holiday Special 20
  • More
  • Cancel
Holiday Special 20
Blog Victoria's secret: A nervous Elf can lose his head
  • 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: robogary
  • Date Created: 11 Jan 2021 5:31 AM Date Created
  • Views 3262 views
  • Likes 13 likes
  • Comments 8 comments
  • arduino nano
  • animatronics
  • holidayspecial20ch
  • buildapresentch
Related
Recommended

Victoria's secret: A nervous Elf can lose his head

robogary
robogary
11 Jan 2021

Nothing is more fun and jovial than a happy Christmas Elf sitting on a gift, waving to you...except watching him lose his head when you catch him being naughty.

 

The story:

The naughty Elves like to peek inside very personal Christmas gifts.

The naughty elves are also really sneaky.

Once someone gets in his viewing range, he kicks his legs, waves his hand, and acts totally innocent and nonchalant.

 

Actually, the Elf is sweating bullets on the inside, butterflies in his belly, behaving jittery and nervous.

If you see thru his innocent act and shout at him to behave or startle him, he loses his head...it goes flying. 

It's actually pretty funny to see an elf lose composure.

image

This project is the animatronic Elf.

If you get in proximity of him sitting on the Victoria's Secret box, the PIR activates, he flutter kicks his legs, and he waves to you.

If you yell at him to behave or startle him, the sound sensor triggers , a solenoid activates, and his head is launched and he loses his head.

 

Watch the action on You Tube and details on the build.

https://youtu.be/W00JnFMU6eU

 

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

 

The schematic

image

 

The Arduino Code:

#include <Servo.h>

 

Servo rightLeg;  // create servo object to control a servo

Servo leftLeg;  // create servo object to control a servo

Servo rightArm;  // create servo object to control a servo

 

// twelve servo objects can be created on most boards

 

int pos = 0;    // variable to store the servo position

int MotionDetected = LOW;    // variable to store the PIR value

int SoundDetected = HIGH;    // variable to store the sound input, HIGH is NO SOUND

int SolenoidOn = LOW;  // variable to store the sound input

int SolenoidOnTime= 400; // time to leave on solenoid trigger high , to give it time to fully extend

int LegSwingTime = 30;  // millisec delay time between position reference updates to the servos. 45 degrees/30ms per degree = 1.5 seconds

 

void setup() {

//yes, all my O.C.D. software friends go bananas when I assign pins to my code rather than making them a confuguration variable

// too bad :-) I do it this way to spite you

 

  leftLeg.attach(9);  // attaches the servo on pin 9 to the servo object

  rightLeg.attach(10);  // attaches the servo on pin 9 to the servo object

  rightArm.attach(11);  // attaches the servo on pin 9 to the servo object

 

 

  pinMode(5,INPUT);      // sets the digital pin 5 as input for the PIR

  pinMode(3,INPUT);      // sets the digital pin 3 as input for the sound sensor

  pinMode(12,OUTPUT);      // sets the digital pin 12 as an output for firing the Solenoid MOSFET

}

 

 

void loop() {

  MotionDetected = digitalRead(5);   // read the input pin of PIR

 

// check for motion detected, if none, set all servos to home position

  if (MotionDetected == HIGH) {

        for (pos = 0; pos <= 45; pos += 1) { // goes from 0 degrees to 180 degrees

          // in steps of 1 degree

          leftLeg.write(pos);              // tell servo to go to position in variable 'pos'

          rightLeg.write(pos);           // right side servo is moubted opposite of the lHS servo

          rightArm.write(pos);

          delay(LegSwingTime);                       // waits for the servo to reach the position

          // every scan check for a sound trigger

           SoundDetected = digitalRead(3);  // read the input pin of sound module

           if (SoundDetected==LOW){ digitalWrite(12,HIGH);delay(SolenoidOnTime);}

           else {digitalWrite(12,LOW);}

          }

        for (pos = 45; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees

          leftLeg.write(pos);              // tell servo to go to position in variable 'pos'

          rightLeg.write(pos);              // tell servo to go to position in variable 'pos'

          rightArm.write(pos);

          delay(LegSwingTime);                       // waits 15ms for the servo to reach the position

          // every scan check for a sound trigger

          SoundDetected = digitalRead(3);  // read the input pin of sound module

           if (SoundDetected==LOW){ digitalWrite(12,HIGH);delay(SolenoidOnTime);}

           else {digitalWrite(12,LOW);}

           }

          }

  else {

          leftLeg.write(0);              // tell servo to go to position in variable 'pos'

          rightLeg.write(0);           // right side servo is moubted opposite of the lHS servo

          rightArm.write(0);

          digitalWrite(12,LOW);             // reset and ensure the head launch solenoid is off

       }

 

 

}

  • Sign in to reply

Top Comments

  • shabaz
    shabaz over 4 years ago +3
    Hi Gary, I'm speechless, that is a cool elf. Was not expecting the head flying off!
  • robogary
    robogary over 4 years ago in reply to shabaz +3
    Thank you. I'm working on 2 projects for March/April that I hope are even funnier. The engineer who founded the Robotics & Makers Club, that I now have run for nearly 10 years, said his goal in life is…
  • dubbie
    dubbie over 4 years ago +2
    I like the concept, especially as animatronics are almost robots right! A pity the head doesn't shoot off a bit more forcefully. Maybe I could use something like this to keep the cats from doing their…
  • dougw
    dougw over 2 years ago

    Cool comical elf.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • robogary
    robogary over 4 years ago in reply to shabaz

    Thank you.

    I'm working on 2 projects for March/April that I hope are even funnier.

     

    The engineer who founded the Robotics & Makers Club, that I now have run for nearly 10 years, said his goal in life is to be 12 years old.

    It is a profound statement, and I take it to heart.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 4 years ago

    Hi Gary,

    I'm speechless, that is a cool elf. Was not expecting the head flying off!

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • robogary
    robogary over 4 years ago in reply to hugohu

    Lol Hugo. Thanks . I tell my wife all the time how lucky she is to have me. 

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • hugohu
    hugohu over 4 years ago in reply to robogary

    Can't say I don't agree image

    • Cancel
    • Vote Up +1 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