Introduction: 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!

Supplies

  1. Arduino Flora
  2. L298N motor driver
  3. Adafruit tilt ball switch
  4. 9v battery
  5. 9v battery to JST adapter
  6. Sparkfun lilypad green led
  7. Adafruit panel mount 10k potentiometer
  8. 5v-12v dc motor
  9. hat with a propeller
  10. Conductive thread
  11. sewing needle
  12. scissors
  13. wire strippers
  14. soldering iron
  15. solder
  16. flux
  17. 2 wires at least 5 inches in length
  18. 2 wires male to female at least 5 inches in length
  19. 3 wires male to female at least 5 inches in length
  20. fabrics with color of your choice
  21. bottle cap
  22. 2.5 inch wide piece of plastic (I used a cap from the toxic waste candy container)
  23. 1 velcro adhesive dot
  24. air dry clay
  25. super glue

Step 1: Make the Air Dry Clay Mold for Potentiometer

  1. make a mold around the potentiometer using air dry clay, encasing the entire unit, but ensuring that the knob can still move
  2. orient it so that the pins are upright
  3. allow sufficient time to dry

Step 2: Motor and Propeller Prep

  1. glue the propeller to the output shaft of the dc motor
  2. 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
  3. cut a hole in a piece of fabric just big enough to fit the bottle cap through
  4. glue the bottom outer edges of the DC motor to the bottle cap
  5. 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)
  6. 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

Step 3: Sew the Prepped Propeller to the Hat

  1. sew the prepped propeller to the top of the hat
  2. ensure that you sew tightly around the perimeter of the 2.5 inch plastic disc to prevent movement of the disc

Step 4: Attach Tilt Switch to the Flora

  1. apply a small amount of flux to both prongs on the tilt switch
  2. solder the tilt switch to the flora, one prong to pin #6 and the other to GND
  3. 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

Step 5: 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

  1. solder one male to male wire to pin #10
  2. solder one male to male wire to pin GND (the same one the tilt switch is soldered to)
  3. solder one male to male wire to VBATT
  4. solder one male to female wire to pin #1
  5. solder one male to female wire to pin #0

Step 6: Attach

  1. 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
  2. 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

Step 7: Place LED

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

Step 8: Attach Battery

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

Step 9: Attach Motor Driver

  1. cut out a piece of fabric the exact shape of the motor driver, and use small amounts of hot flue to attach it
  2. 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


Step 10: Attach Potentiometer to the Hat

  1. ONLY DO THIS IF THE AIR DRY CLAY IS FULLY DRY
  2. 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)

Step 11: Sew Conductive Thread for Led

  1. 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)

Step 12: 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

  1. 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)
  2. sew the middle pin (analog) to the #9 pin
  3. 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

Step 13: Connect All Wires to the Motor Driver

  1. connect the wires soldered to the DC motor, to the pins labeled OUT1 and OUT2 on the motor driver (as labeled in the diagram)
  2. 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)
  3. 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)(
  4. 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)
  5. labeled in the diagram)
  6. 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)
  7. 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)

Step 14: 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);


}

}