Motorized Propeller Hat


A fun motorized propeller hat that stops spinning if it falls. Is it a bit bulky and over complicated? Yes, but that's what makes it fun!
Downloads
Supplies
- Arduino Flora
- L298N motor driver
- Adafruit tilt ball switch
- 9v battery
- 9v battery to JST adapter
- Sparkfun lilypad green led
- Adafruit panel mount 10k potentiometer
- 5v-12v dc motor
- hat with a propeller
- Conductive thread
- sewing needle
- scissors
- wire strippers
- soldering iron
- solder
- flux
- 2 wires at least 5 inches in length
- 2 wires male to female at least 5 inches in length
- 3 wires male to female at least 5 inches in length
- fabrics with color of your choice
- bottle cap
- 2.5 inch wide piece of plastic (I used a cap from the toxic waste candy container)
- 1 velcro adhesive dot
- air dry clay
- super glue
Make the Air Dry Clay Mold for Potentiometer

- make a mold around the potentiometer using air dry clay, encasing the entire unit, but ensuring that the knob can still move
- orient it so that the pins are upright
- allow sufficient time to dry
Motor and Propeller Prep







- glue the propeller to the output shaft of the dc motor
- cut a hole just big enough for the bottom of the DC motor in the bottle cap (the gray circular object on the yellow disc) and glue it on top of a circular 2.5 inch piece of plastic
- cut a hole in a piece of fabric just big enough to fit the bottle cap through
- glue the bottom outer edges of the DC motor to the bottle cap
- solder two wires at least 4 inches in length to the metal connector on the DC motor (I made mine 7 inches and coiled to help with movement)
- cut out a piece of fabric, just big enough to wrap around the DC motor and not get in the way of the propeller, and then sew it together so that it stays in place
Sew the Prepped Propeller to the Hat

- sew the prepped propeller to the top of the hat
- ensure that you sew tightly around the perimeter of the 2.5 inch plastic disc to prevent movement of the disc
Attach Tilt Switch to the Flora

- apply a small amount of flux to both prongs on the tilt switch
- solder the tilt switch to the flora, one prong to pin #6 and the other to GND
- slightly bend the newly soldered tilt switch slightly upwards (towards you if you are facing the top of the Flora). This will ensure the ball inside the tilt switch stays in contact while the hat is being worn
Attach Motor Driver Wires to the Flora

All wires attached are at least 5 inches in length
Before soldering each one, add a small amount of flux to each prong being soldered to the Flora pins
Where these pins connect to the motor driver will be explained later
- solder one male to male wire to pin #10
- solder one male to male wire to pin GND (the same one the tilt switch is soldered to)
- solder one male to male wire to VBATT
- solder one male to female wire to pin #1
- solder one male to female wire to pin #0
Attach

- orient the Flora so that the side that has pins VBATT, #12, #6, GND, #9, #10,, and 3.3v is closest to the top of the hat
- sew the Flora from pins #2 and #12 to the back left of the hat (1.5 inches left of the middle of the hat, and 1.5 inches from the bottom
Place LED

- use a small amount of hot glue to attach the led near the Flora, to the bottom left
- make sure the positive (+ symbol) is facing upwards if you want to follow the tutorial exactly
Attach Battery


- add the adhesive velcro dot to the back right of the hat
- stick the battery to the velcro dot, with the power connectors facing the back middle of the hat
- connect the 9v batter to JST adapter to the battery, and plug the other end (JST type) to the Flora
Attach Motor Driver



- cut out a piece of fabric the exact shape of the motor driver, and use small amounts of hot flue to attach it
- cut out a piece of fabric about 2 cm longer than the motor driver, and sew the overhanging ends to the hat so that the motor driver stays in place
Attach Potentiometer to the Hat

- ONLY DO THIS IF THE AIR DRY CLAY IS FULLY DRY
- glue the potentiometer to the hats left side of the bill, and make sure the holes for the pins have enough space from the bill of the hat (this is a must so that later we can slip and knot conductive thread through the holes)
Sew Conductive Thread for Led

- using conductive thread, sew the negative side of the led, to the bottom GDN pin and the positive side to the #3 pin (as shown in the image)
Begin Sewing in the Potentiometer








All of the following sewing is done using conductive thread
When connected to the Flora pins it is looped around the pin multiple times to ensure full connection
- sew the right most pin (GND) on the potentiometer to the GND pin beneath the JST power connector (where the 9v battery plugs into the Flora)
- sew the middle pin (analog) to the #9 pin
- sew the left most pin (using a small patch to ensure no cross connections over the analog and GND pin threads, and hot glue the patch on to prevent movement) to 3.3v pin that is right next to pin #10
Connect All Wires to the Motor Driver


- connect the wires soldered to the DC motor, to the pins labeled OUT1 and OUT2 on the motor driver (as labeled in the diagram)
- connect the wire we soldered earlier to the Flora GND pin, to the pin labeled GND on the motor driver (as labeled in the diagram)
- connect the wire we soldered earlier to the Flora pin VBATT, to the pin labeled VSS on the motor driver (as labeled in the diagram)(
- connect the wire we soldered earlier to the Flora pin #10, to the pin labeled ENA on the motor driver (as labeled in the diagram)
- labeled in the diagram)
- connect the wire we soldered earlier to the Flora pin #0, to the pin labeled IN2 on the motor driver (as labeled in the diagram)
- connect the wire we soldered earlier to the Flora pin #1, the the pin labeled IN1 on the motor driver (as labeled in the diagram)
Upload Code
//ENA pin on motor priver
const int enA = 10;
//OUT1 pin on motor driver
const int in1 = 1;
//OUT2 pin on motor driver
const int in2 = 0;
//led
const int led = 3;
//potentiometer
const int potPin = 9;
//tilt ball switch
const int tiltPin = 6;
//variable used for fall delay section
int fallDetectVar = 0;
//save analog value for potPin
int value;
//save analog value for tiltPin
int tiltValue;
void setup()
{
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(potPin, OUTPUT);
pinMode(tiltPin, INPUT_PULLUP);
}
void loop()
{
//value of potentiometer (0 to 1023)
value = analogRead(potPin);
//reassign '
value = map(value, 0, 1023, 127, 255);
// Serial.print("pot value: ");
// Serial.println(value);
//value of the tilt sensor (0 or 1)
tiltValue = digitalRead(tiltPin);
// Serial.print("tilt value: ");
// Serial.println(tiltValue);
//both if statements below stop all motor movement for 3 seconds if the hat falls and it picked up again
if (tiltValue == 1){
//1 means hat fell
fallDetectVar = 1;
}
if (fallDetectVar == 1 && tiltValue == 0){
//wait 3 seconds for hat to be picked up
delay(3000);
}
//check if potentiometer has not hit the required value to turn motor on
//also checks to see if tilt sensor is tilted
if (value < 128 || tiltValue == 1){
// Serial.println("pot off and/or hat fell");
//turn the led off
digitalWrite(led, LOW);
//turn motor off
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}
//the potentiometer is turned enough and the tilt ball switch detects the hat is upright
else if (value >= 128 && tiltValue == 0){
fallDetectVar = 0;
// Serial.println("hat upright and pot on");
//turn the led on
digitalWrite(led, HIGH);
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
}
}