Introduction: Automatic Fedora Tipper
Do you ever have this problem that when you walk down the street while carrying something heavy (for example groceries) and a lady walks past to whom you want to tip your fedora in order to greet her, but if you do that you'll drop what you are carrying? Me neither, but incase you do, here's a simple, though elegant solution to this problem.
Step 1: Materials
- An arduino controller
- Servo motor
- Push button switch
- 10k Ohm Resistor - brown-black-orange
- A sufficient amount of wires compatible with your length
Step 2: Push Button Connections
- The black wire on the diagram connects pin 1 of the switch (on the left side) to the GND pin on the Arduino.
- The Yellow wire on the diagram connects pin 2 of the switch (on the right side) to pin 8 on the Arduino.
- Connect a 10kΩ resistor (brown-black-orange) to pin 2 (right side) and the other terminal to the 3.3V pin on the Arduino.
Step 3: Servo Motor Connections
- The white wire (yellow in the diagram) is connected from the signal pin of the servo motor to pin ~9 of the Arduino.
- The Red wire is connected from the signal pin of the servo motor to the 5V pin of the Arduino.
- The yellow wire (black in the diagram) is connected from the ground pin of the servo motor to the GND pin of the Arduino.
Step 4: Attaching the Servo Motor
- I carved some rings in a pencil in order to tie it to the rotating part of the Servo motor. You could use stape to do so, but I found tying it with rope was a bit more secure and sturdy.
- The other end of the pencil is to be attached to the hat at the backside. I pushed a paperclip through the fringe of the hat and bent it into shape so it could hold the pencil in place.
- The motor itself is to be attached to a plate (or something else that could rest on top of your head without moving too much), which I left out in the picture for the sake of clarity.
Step 5: Code
// pushbutton pin
const int buttonPin = 8;
// servo pin
const int servoPin = 9;
//create a variable to store a counter and set it to 0
int counter = 0;
// Set up the pushbutton pins to be an input:
// local variable to hold the pushbutton states
//read the digital state of buttonPin with digitalRead() function and store the value in buttonState variable buttonState = digitalRead(buttonPin);
//if the button is pressed increment counter and wait a tiny bit to give us some time to release the button
if (buttonState == LOW)
// light the LED
if(counter == 0)
// zero degrees
else if(counter == 1)
//else reset the counter to 0 which resets thr servo to 0 degrees
counter = 0;
Step 6: Hiding the Electronics
- In order to make the construction seem more inconspicuous you could shove the arduino and the plate with the button into a small box (for example a pack of sigarettes or the box of a pack of cards) and make a hole in it. This way you can hold the construction in plain sight without arousing suspicion that something more is going on.