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 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
Hack the Holidays
  • Challenges & Projects
  • Project14
  • Hack the Holidays
  • More
  • Cancel
Hack the Holidays
Hack the Holidays Blog SANTA ONE TWO THREE
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Hack the Holidays to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 7 Jan 2023 5:54 PM Date Created
  • Views 2430 views
  • Likes 13 likes
  • Comments 7 comments
  • SANTA ONE
  • SANTA TWO
  • servo
  • arduino nano
  • hacktheholidaysch
  • hack the holidays
Related
Recommended

SANTA ONE TWO THREE

dubbie
dubbie
7 Jan 2023
SANTA ONE TWO THREE

I just had enough time left to create SANTA THREE : The Baubles befoe the close of the Hack The Holidays Project 14 competition. This adds some dancing baubles to the SANTA ONE and TWO displays, to create the full throttle SANTA ONE TWO THREE.

It is just two servo motors added to A2 and A1 outputs on the Arduino Nano used for SANTA TWO and uses almost the same programme from EyeballThingy ( EyeBall Thingy ) to create random movements on the two servo motors. The full programme including the train controlling is listed at the end of this Blog.

Santa Three Crcuit

I used two giant baubles with each servo motor with a small piece of wood bar to separate them. By hanging the baubles equi-distant from the centre point the stress on these small servos is reduced. I used cotton to tie the baubles to the ends of the wood bars and BlueTac to hold everything together. I wasn't planning on creating something that would last (and it didn't). I then placed the two servo motors on a shelf above the SANTA ONE : Diorama to create SANTA THREE. Below is a video showing the full SANTA ONE TWO THREE in operation (almost).

https://www.youtube.com/watch?v=ZIxc6NYv3pY

Sadly, by the time SANTA THREE was working, SANTA TWO : The Train had stopped working under Nano control so in this video the train is being manually controlled by me. But, it has worked previously so if I was inclined (which I am not) I could probably get it all working properly again. However, time has now run out and I am pleased to stop.

Dubbie

PS The full programme listing is given below.

/*
SantaOneTwoThree
Dubbie Dubbie
4th Jan'23
Just for Fun

*/

#include <Servo.h>

#define bauble1 A2
#define bauble2 A1
#define trainlight 4
#define trainwhistle 5
#define trainbackwards 6
#define trainforwards 7

Servo baubleone;
Servo baubletwo;

int prevleft;
int prevright;
int indexmove;

void setup()
{
Serial.begin(9600);
Serial.println("Santa OneTwoThree ");
baubleone.attach(bauble1);
baubletwo.attach(bauble2);
prevleft = 90;
prevright = 90;
indexmove = 0;

pinMode(trainlight, OUTPUT);
pinMode(trainwhistle, OUTPUT);
pinMode(trainbackwards, OUTPUT);
pinMode(trainforwards, OUTPUT);
digitalWrite(trainlight, HIGH);
digitalWrite(trainwhistle, HIGH);
digitalWrite(trainbackwards, HIGH);
digitalWrite(trainforwards, HIGH);
delay(100);

} /* setup */

void loop()

{
int angle;
angle = 0;

trainmovements();

while (1)
{
randombaubles();
} /* while */

} /* loop */

void tforward(void)

{
digitalWrite(trainforwards, LOW);
delay(1500);
digitalWrite(trainforwards, HIGH);
delay(100);
} /* tforward */

void tbackward(void)

{
digitalWrite(trainbackwards, LOW);
delay(1500);
digitalWrite(trainbackwards, HIGH);
delay(100);
} /* tbackward */

void tbackstop(void)

{
digitalWrite(trainforwards, LOW);
delay(100);
digitalWrite(trainforwards, HIGH);
delay(100);
} /* tbackstop */

void tforstop(void)

{
digitalWrite(trainbackwards, LOW);
delay(100);
digitalWrite(trainbackwards, HIGH);
delay(100);
} /* tforstop */

void trainmovements(void)

{
delay(1000);
tbackward();
delay(2000);
tbackstop();
delay(2000);
tforward();
delay(2000);
tforstop();
} /* trainmovements */

void randombaubles(void)

{
int nexteye;

nexteye = 0;
nexteye = random(0, 180);

movelefteyeto(prevleft, nexteye);
moverighteyeto(prevright, nexteye);
prevleft = nexteye;
prevright = nexteye;
} /* randomeyes */

void movelefteyeto(int prev, int next)

{
int angle;
angle = 0;

// Serial.print(prev); Serial.print(" "); Serial.println(next);
if (next >= prev)
{
// Serial.println("Up ");
for (angle = prev; angle <= next; angle += 1)
{
baubleone.write(angle);
delay(20);
} /* for */
}
else
{
// Serial.println("Down ");
for (angle = prev; angle >= next; angle -= 1)
{
// Serial.println(angle);
baubleone.write(angle);
delay(20);
} /* for */
} /* else */

} /* movelefteye */

void moverighteyeto(int prev, int next)

{
int angle;
angle = 0;

// Serial.print(prev); Serial.print(" "); Serial.println(next);
if (next >= prev)
{
// Serial.println("Up ");
for (angle = prev; angle <= next; angle += 1)
{
baubletwo.write(angle);
delay(20);
} /* for */
}
else
{
// Serial.println("Down ");
for (angle = prev; angle >= next; angle -= 1)
{
Serial.println(angle);
baubletwo.write(angle);
delay(20);
} /* for */
} /* else */
} /* moverighteye */

 

  • Sign in to reply
  • dubbie
    dubbie over 2 years ago in reply to beacon_dave

    I must be doing something wrong. I have tried several times to embed the video into the blog. It uploads it and then says there is an error and it cannot be displayed. I have eventually managed to insert a link to a YouTube version, but it only shows the link and not the YouTube ready to play as you have managed in your comment. Despair is close.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 2 years ago in reply to beacon_dave

    YouTube embed test - Dubbie's Baubles

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

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 2 years ago in reply to dubbie

    Your link was there at one point as I remember watching it:
    https://www.youtube.com/watch?v=D-1nB9tLb7Q

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 2 years ago

    I have just noticed that this is not quite the Blog that I originally posted. The picture at the top I did not enter (well I'm pretty sure I didn't enter) and the video (a YouTube Link) has disappeared. Plus, the programme listing has been put into it's scrolling window - which is good, but I didn't do it. Is this a part of a dastardly plot to destablise my attempt to take over the world with my robots (Admittedly I'm not making much progress with my world take over plan)?

    Also, I'm having real problems trying to insert pictures into Blogs and it just refuses to insert videos. I assumed this was just some problem with the Element14 website. Is it just me?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 2 years ago in reply to dougw

    Good name : Loco-Motion. I might use that in the future.

    Dubbie

    • 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