I was asked to build a replica ball drop for a friend. I had 3 days to get this thing working. It was a fun build, and took a lot of headaches to get it setup. In the end it worked out great.
The ball itself is a Christmas ornament that has been cut in half and stuffed with 14 LEDs, a 9V and a switch. I hot glued the thing back together and cut a hole in the bottom for the rod to come through. My wife decorated it for me; she also decorated the building.
Parts used:
- Christmas ornament
- Pill bottle (base of rod)
- 2 boxes
- Spent soldier spool
- Plastic clothes hanger (rod)
- Yarn
- Paperclip
- Arduino
- LCD shield (key pad)
- LED’s
- Components for relay circuit
- Paint
- Glitter
- Tiny mirrors
- Servo (mod for continues rotation)
The next thing was to make it go down the rod. There is several ways of doing this, the best in my opinion to use a screw like device and have the ball mounted on it for the linear motion. But I did not have the supplies or money for that. So I used a moded servo for a pulley type system.
I took a spent soldier spool and glued it to the horn of the servo. That’s where the yarn is tied. The yarn goes up the rod, through a looped paperclip and attached to the ball. When the servo “unwinds” the spool, the ball is lowered.
Besides the arduino and LCD shield, there is a circuit to control the servo. It is a simple 5V regulated relay transistor setup. I used the same schematics as the IRC controlled air freshener.
The trickiest part of the build was to lower the ball at a timed rate and have it hit the bottom on count 0. It took some trial and error with delay times in the code, but it worked out nicely.
<pre> <pre> //up == 130 //down == 306 //right == 0 //left == 480 #include <Servo.h> #include <LCD4Bit_mod.h> #include <stdlib.h> Servo myservo; // servo object LCD4Bit_mod lcd = LCD4Bit_mod(2); int key_in; void setup() { Serial.begin(9600); lcd.init(); lcd.printIn(" Time Square "); lcd.cursorTo(2,0); lcd.printIn(" New Years Eve "); myservo.attach(12); pinMode(3, OUTPUT); digitalWrite(3,HIGH); } void loop() { lcd.cursorTo(1,0); key_in = analogRead(0); if (key_in == 0){ lcd.clear(); myservo.write(90); digitalWrite(3, LOW); lcd.printIn("Coming Down"); key_in = 0; } else if (key_in == 480){ lcd.clear(); lcd.printIn("Going Up"); myservo.write(0); digitalWrite(3,LOW); key_in = 0; } else if (key_in == 306){ lcd.clear(); lcd.printIn("Count Down Start"); delay(3000); lcd.clear(); lcd.printIn("***1:00***"); delay(1000); count_down(); } else { digitalWrite(3,HIGH); } } void count_down(){ myservo.write(90); for (int i=59; i>0; i--){ lcd.clear(); char count [21]; char* r; r = itoa(i,count,10); lcd.printIn("*****"); lcd.printIn(r); lcd.printIn("*****"); if (i <= 10){ digitalWrite(3,LOW); delay(130); digitalWrite(3,HIGH); delay(870); continue; } delay(1000); } lcd.clear(); lcd.printIn(" 2011 "); delay(5000); lcd.clear(); lcd.printIn("Happy New Year!!"); lcd.cursorTo(2,0); lcd.printIn("_,~*`~2011~*`~,_"); }