Arduino Powered Andorian Antenna
by r570sv in Circuits > Arduino
2033 Views, 3 Favorites, 0 Comments
Arduino Powered Andorian Antenna
Wife decided to be a Andorian for the upcoming Silicon Valley Comic Con in San Jose to match my Elvis Captain Kirk costume. While the face painting/makeup and the rest of the costume took quite a bit of time I couldn't let the antenna just be static. I decided to make them turn and rotate on a somewhat random basis. Turns out lots of people sell both static Andorian antenna and those that already rotate. But the $100 price tag was too pricey and I'm a DIY guy anyway.
Since time was short I located some 3d printed antenna off of Etsy vs. trying to make them.
REQUIRED PARTS -
Andorian antenna - check etsy for these or make them yourself
Two micro servos - can find numerous places
Adafruit itsybitsy - see adafruits web site. Smaller the better
Extended servo cables - amazon/ebay
servo two wire power cable with on/off switch - amazon/ebay
9V battery
9V battery holder
masking tape, electrical tape
hair band - any CVS, target, etc.
TOOLS USED
soldering iron
hot glue gun
super glue
wire strippers
Xacto knife
Prototype bread board to wire solution
Installed Arduino development environment on your PC
The Code
Here is the code I used. Lifted off of the internet. Driving a servo(s) from a Arduino is super easy. While there are more technical ways of doing this, I brute forced two different movement patterns with a freak out movement between them and ping-ponged back and forth. You will need to play with this to make sure you know where center is once your servo is attached to the head band and what looks best for your application. /* Sweep
by BARRAGAN <http: barraganstudio.com=""> This example code is in the public domain.</http:>
Modified by r570sv 8-14-19
*/
#include <servo.h></servo.h>
Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards
int posl = 0; // variable to store the servo position int posr = 0; int DELAY = 50; int everyOther = 0; int i = 0; int j = 0; int k = 0; int x = 0; Servo servo1; Servo servo2;
void setup() { // myservo.attach(9); // attaches the servo on pin 9 to the servo object // myservo.attach(10); // attaches the servo on pin 10 to the servo object servo1.attach(9); servo2.attach(10); servo1.write(0); servo2.write(0); delay(1000); servo1.write(180); servo2.write(180); delay(1000); Serial.begin(9600); }
// // // start 180 left go left 50, right go right 50, then slow back to 180 then r 50 & left 50 // //
void loop() { for (j = 0; j <=5; j++) { for (i = 0,posl = 180,posr = 180;i <= 50;i++) { // goes from 0 degrees to 180 degrees posl = posl - 1; posr = posr + 1; servo1.write(posl); // tell servo to go to position in variable 'pos' servo2.write(posr); delay(DELAY); // waits 15ms for the servo to reach the position } for (i = 0,posl = 130,posr = 230;i <= 50;i++) { // goes from 0 degrees to 180 degrees posl = posl + 1; posr = posr - 1; servo1.write(posl); // tell servo to go to position in variable 'pos' servo2.write(posr); delay(DELAY); // waits 15ms for the servo to reach the position } } // for
if(everyOther == 1){ servo1.write(180); servo2.write(180); delay(500); servo1.write(280); servo2.write(280); delay(500); servo1.write(120); servo2.write(120); delay(500); servo1.write(180); servo2.write(180); delay(500); everyOther = 0; // toggle this so every other time it will done one of these two routines } // if else{ everyOther = 1; for(x = 0; x <= 5; x++){ for (i = 0,posl = 180,posr = 180;i <= 40;i++) { // goes from 0 degrees to 180 degrees posl = posl - 1; posr = posr + 1; servo1.write(posl); // tell servo to go to position in variable 'pos' servo2.write(posr); delay(10); // waits 10ms for the servo to reach the positio } for (i = 0,posl = 140,posr = 220;i <= 40;i++) { // goes from 0 degrees to 180 degrees posl = posl + 1; posr = posr - 1; servo1.write(posl); // tell servo to go to position in variable 'pos' servo2.write(posr); delay(10); // waits 1ms for the servo to reach the position } } } // else } // loop
Wiring and Packaging
So basic wiring wise it's super straight forward.
A servo has three wires. Power, Ground and the PWM pin from the Arduino.
So pins, 9 and 10 were used for the PWM and ground and power were used from the Arduino.
I chose a 9V battery because I had a holder for it. I could of used a smaller LiPo 3.7V battery to make the whole package smaller but I didn't know if I could run for 8 hours on the very tiny 3.7V battery I had so I went with the larger 9v battery, put it in a holder and brought a spare so I could swap it out if necessary. I also included a off/on switch because I wanted a way to easily power it on and off. The whole package was going to be tucked at the back of the head between the wig and hair and what I didn't want is some hacked up way to power it up that may cause a wig or wiring fail trying to muck with it.
The actual packaging of the whole project was one of the most difficult parts. I needed it small but I also didn't want to have any wires come un-done and have the project FAIL when I needed it. I hot glued all of the connections on the Arduino so the pins wouldn't slip off and I soldered the power and ground wires right to the Arduino board. Any other wire connections were taped together and the whole package was wrapped in masking tape with easy access to the on off switch.
Installing Gadget to the Wig.
If packaging wasn't tedious enough actually getting the whole thing in the wig was painful.
The antenna came mounted to a hair band that was completely going to fail for what I planned on using it for so we had to purchase a stronger hair band - made from metal and covered in rubber.
The 3d printed antenna didn't fit the micro servos so I had to dremel the slots bigger. Servos were set in place with hot glue.
Mounting the servo horn to the hair band was a complete mess. I didn't want to cut a huge slot in the wig so I could pre-attach the servo to the hair band and antenna perhaps causing a wig failure so I went the very painful route of cutting a small hole in the wig 1/4" so the servo shaft fit through. Then I attached the server horn to the servo. Then I epoxied the server horn to the hair band - which didn't work. Super gluing the server horn to the hair band didn't work either. Soooooo, I wrapped the server horn to the hair band with very thin paracord, tied each wrap then super glued the paracord knots so they wouldn't loosen. Taking care not to go wild with the glue and glue the servo shaft shut (I trashed a servo the firs time doing this). Kinda like what you might do to making an arrow like 10,000 years ago kinda technique.
There are better ways of doing this. Use my example as something that works but something that could be improved upon :-)
Two extra 1/4 inch slots were cut so the server wire could fit through the wig and down the back of the wig to where the battery/Arduino was going to reside.
Attaching the battery/Arduino to the head/wig
YMMV on this. I was able to tie wrap the package to my wife's bun under the wig. She was wearing a hair net and that got tie wrapped into the bundle too. We had one failure where it slipped out so I re-tie wrapped it again and it lasted for the rest of the day (bring some supplies when you go to the con to assist with this :-) )
At the Show - What Worked, What Didn't, What We Would of Done Differently
So what worked -
Antennas didn't fall off - but we had to be super careful getting in and out of the car. The servo is small and the connection of the servo horn to the hair band is even more fragile.
Battery lasted all of the show - no need to swap out batteries.
No wires fell off, no loose connections - the extra time to glue and tape paid off
What didn't work so well -
So at my desk I figure out what would look good for the movement of the antenna. Turns out when we got in a huge expo center, most people - not all, didn't notice the antenna moving. Those who did, kinda freaked out - 'did your antenna just move?' kinda thing which was nice but bigger moment would of been better. What I SHOULD of done was provide a external potentiometer that we could of tweaked real time to increase either rotation, frequency, etc. etc. Could of tied it up to the package tucked away under the hair.
The way i tied it up to the wig and my wife's hair - it fell off after a couple of hours. Fortunately I had a spare tie wrap and was able to re-tie it to her wig/hair bun. Actually this isn't a fail more like being prepared for a weakness we saw going into the show.