Ho Ho Howdy Hat

By Milena Serych, Kamryn Dudwal and William Tremaglio

Have you ever seen Christmas cowboy hat? If not, you are about to see one, which reacts to your movement with colourful LEDs! This hat reacts according the distance to the ground, so in order to see some interesting colour patterns, do not be lazy and dance on different levels!

Purpose

Create an interactive addition to your costume for themed party or dance costume which will make you stand out in the crew.

Target audience

Anyone who likes to be noticed, dancers and other kind of performers who wear specific costumes, people looking for Halloween, Christmas or another Themed party costume.

Market research

Hats with implemented LEDs available in the market are not interactive – they just have hardcoded LED patterns but do not react to the user’s movement. That’s why our product would stand out in the market.

Tools and Supplies

Design Decisions/Problems

  1. We decided on the cowboy style hat because we thought it would make the sensor the least noticeable as well as allowing room for the arduino, the breadboard, and the battery pack. 
  2. We put the ultrasonic sensor in the front of the hat so that it picked up the ground/object in front of the person. If we had put it on the side it would have picked up the shoulder the whole time and on the back it would most likely pick up the person’s back as the hat tilted back.
  3. We put the arduino and the perfboard at the back of the hat. We initially wanted to put inside the hat, however it proved to be uncomfortable and made the hat not fit the person’s head. 
  4. We put the wires through the inside of the hat to conceal them as the wires from the sensor needed to reach the back of the hat.
  5. To make LED strips working we figured out how to use the NeoPixel library. 
  6. Initially the idea was to use the LilyPad for this project, as we are doing e-textile work that requires parts to be as small and unnoticeable as possible. But it would not be able to handle the amount of current required for the sensor and strip to work together (9V) – it would fire up at 5V. So we decided to keep working on Arduino Uno
  7. To make our hat more organized we decided not to use the breadboard but solder LED and Sensor connections to the small perfboard
  8. To power our project up we started from two 1,5V coin batteries but realized that we need at least 5V. Further in the project we figured out that the required voltage for the project to work properly is 9V, which we achieved by six AA batteries.
  9. After soldering everything to the perfboard we faced the problem of bad connection (it was either sensor or LEDs working) so we needed to resolder some parts to make connection better and more stable.

Design principles

Conceptual Model (how a particular product works): Have with integrated Ultrasonic sensor on the top of the hat facing to the floor to measure the disance from users head to the floor and change colours according to this distance.

Visibility: our main controls are Ultrasonic for input and LEDs for output. Everything is being powered with 6 AA batteries so user have a choice to turn on or off the LEDs by disconnecting it from the power supplier. Once it is powered all the user needs to do is move and dance, and hat will automatically change the colours using information from Ultrasonic.

Constraints: since it is a hat, it’s designed to be worn on the head to work properly as designed. As mentioned before, project is powered up with batteries so at some point user will need to change the batteries in order for the LEDs on the hat.

Shortcomings

A lot of testing and problem solving occurred throughout the duration of our project. We initially wanted to use the LillyPad Arduino instead of Arduino Uno to hide the circuit better, however we couldn’t get the battery to be strong enough to power both the ultrasonic sensor and the LED’s needed to complete the project. Throughout our project we tested individual elements like the ultrasonic sensor and the LED’s so that when we combined them it was easier to problem solve. The part that took the most testing was the batteries. It was difficult to know exactly how much the voltage needed to be in order to power everything we wanted it to. We went from a tiny coin battery to a two battery holder, to four, then six was the magic number of batteries. We also have a problem with hiding the wires inside the hat to make it fit and look better. We ultimately had to settle on taping them in place in our prototype.

Task List

  • William:
    • Worked on the software side of the project:
      1. Created an enum to represent the different types of LED patterns. Refractored the code to use the enum instead of hardcoded patterns.
      2. Split the code into separate functions to eliminate repeated code.
      3. Added comments and documentation to the code to explain the purpose and usage of each function.
      4. Organized the code into logical blocks to improve readability and maintainability.
      5. Tested the code to ensure that it works as expected and produces the correct results for each distance reading.
  • Milena:
    • Worked on the hardware side of the project:
      1. I gathered all the necessary components and soldered most of the items for the project.
      2. Connected the Ultrasound Sensor and LED Strip to the Perfboard using various soldered wires.
      3. Connected the Perfboard to the Arduino Board through soldering.
      4. Tested the setup to ensure that the components are functioning properly.
      5. Made any necessary adjustments or fixes to ensure that the hardware is working as expected.
  • Kam:
    • Worked on both the hardware and software sides of the project:
      1. Helped gather the necessary components and soldered some of the items for the project.
      2. Prepped the hat for implementation of the project by making any needed cuts.
      3. Researched the Adafruit Neopixel library and familiarized myself with its capabilities.
      4. Used my knowledge of the Neopixel library to lay out the foundation for the code that controls the project.
      5. Assisted with the testing of both the hardware and software of the project.
      6. Helped with any necessary adjustments or fixes to the code or hardware to improve the project’s performance.

Stages/Meetings

each group member created a low-fi prototype – Kamryn
each group member created a low-fi prototype – Will
each group member created a low-fi prototype – Milena
practice using the ultrasonic sensor
combining the sensor with the LEDs
putting sensor on hat
hiding wires of sensor
first completed version of the prototype
final completed version of the prototype
The Ho Ho Howdy Hat prototype finished!

Schedule

Task / WeekWeek 9Week 10Week 11Week 12
BrainstormingEveryone
PrototypingEveryoneEveryone
CodingWilliam & KamWilliam & Kam
SolderingMilenaEveryone
Prepping hatEveryoneEveryone

Breadboard Layout

This is the layout we used while testing. Connecting this layout to the Santa hat required a perfboard that works as a breadboard, using longer wire we can then string the perfboard to the different features to use

How to create…

  • Ensure the ultrasonic sensor and the LED’s work using the Arduino Uno and the breadboard
  • Start Soldering, solder wires, sensor, and LED’s to pin headers and then solder the perfboard, this way there’s no breadboard to attach to the hat
  • Cut two holes large enough for the ultrasonic sensor to fit at the front of the hat
  • Make one large incision at the front base of the hat, to put the wires through so they cannot be seen
  • make another incision at the back of the hat to put the wires from the perfboard as well as the wires necessary to connect to the Arduino Uno through
  • Attach the Arduino Uno and the 6-pack battery to the rear of the hat
  • Attach the battery pack to the Arduino Uno
  • Wrap the Neopixel LED strips around the buckle of the hat and slip the wire needed to be connected to the Arduino Uno into the slit at the front of the hat and our of the slit at the back of the hat
  • Add accessories, like the dangling string with bells attached to it, or anything else you want and you have made the Ho Ho Howdy Hat

Code

#include <Adafruit_NeoPixel.h>
#define echoPin 2  // attach pin D2 Arduino to pin Echo of HC-SR04
#define trigPin 3  // attach pin D3 Arduino to pin Trig of HC-SR04

#define pixelPin 10  // Defining pixel pin
#define pixelNum 16  // Defining number of LEDs on pixel strip

#define WHITE (255, 255, 255)
#define RED (255, 0, 0)
#define GREEN (0, 255, 0)

int distance;  // Defining variable for the distance measurement

// Defining Pattern Enum
enum patternType {
  ONE,
  TWO,
  THREE,
  FOUR,
  FIVE,
  SIX
};
enum patternType pattern;  // Defining variable for the pattern type

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(pixelNum, pixelPin, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();
  Serial.begin(9600);        // Setup for Serial Monitor
  pinMode(echoPin, INPUT);   // Sets the echoPin as an INPUT
  pinMode(trigPin, OUTPUT);  // Sets the trigPin as an OUTPUT
}

void loop() {

  updateSensor();   // Updating the Ultrasonic Sensor reading
  updatePattern();  // Updating the pattern with new distance
  //displayPattern(pattern);

  switch (pattern) {
    case ONE:
      for (int i = 0; i < 16; i++) {
        pixels.setPixelColor(i, pixels.Color(0, 255, 255));
      }
      pixels.show();
      break;
    case TWO:
      for (int i = 0; i < 16; i++) {
        pixels.setPixelColor(i, pixels.Color(255, 0, 255));
      }
      pixels.show();
      break;
    case THREE:
      for (int i = 0; i < 16; i++) {
        pixels.setPixelColor(i, pixels.Color(0, 255, 0));
      }
      pixels.show();
      break;
    case FOUR:
      for (int i = 0; i < 16; i++) {
        pixels.setPixelColor(i, pixels.Color(255, 255, 255));
      }
      pixels.show();
      break;
    case FIVE:
      for (int i = 0; i < 16; i++) {
        pixels.setPixelColor(i, pixels.Color(255, 0, 0));
      }
      pixels.show();
      break;
    case SIX:
      for (int i = 0; i < 16; i++) {
        pixels.setPixelColor(i, pixels.Color(0, 0, 255));
      }
      pixels.show();
      break;
  }
}

void updateSensor() {
  // Setting the trigPin LOW (INACTIVE) for 2 microseconds
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);

  // Setting the trigPin HIGH (ACTIVE) for 10 microseconds
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);

  // Calculating the distance
  distance = pulseIn(echoPin, HIGH) * 0.034 / 2;  // Speed of sound wave divided by 2 (go and back)

  // Displays the distance on the Serial Monitor
  Serial.println(distance);
}

void updatePattern() {
  if (distance < 36 && distance >= 0) {
    pattern = ONE;
  } else if (distance < 72 && distance>=36) {
    pattern = TWO;
  } else if (distance < 108&&distance>=72) {
    pattern = THREE;
  } else if (distance < 144&&distance>=108) {
    pattern = FOUR;
  } else if (distance < 180&&distance>=144) {
    pattern = FIVE;
  } else {
    pattern = SIX;
  }
}
Group 13

Ho Ho Howdy Hat

Introducing the “Ho Ho Howdy Hat” – the ultimate fusion of holiday cheer and Western flair! Unleash your inner cowboy and light up the dance floor with this one-of-a-kind e-textile creation. Our Cowboy Santa Hat combines the coziness of a Santa hat with the rugged style of a cowboy hat, adorned with interactive LEDs that respond to your every move. Twirl, jump, or groove to the music – the built-in ultrasonic sensor detects your distance from the floor and adjusts the dazzling light show accordingly. The Ho Ho Howdy Hat is perfect for festive gatherings, country-themed parties, or anyone looking to stand out on the dance floor. So why wait? Giddy up and grab your Ho Ho Howdy Hat today, and let the festivities begin!

Ultrasonic Sensor
Ho Ho Howdy Hat
Milena's Low-Fi Prototype

The Ho Ho Howdy Hat is designed to bring joy, excitement, and a unique twist to holiday celebrations, country-themed events, and casual gatherings. Its innovative technology adds a dynamic visual element to any dance floor, creating unforgettable memories for the wearer and onlookers alike.

The Ho Ho Howdy Hat is designed to bring joy, excitement, and a unique twist to holiday celebrations, country-themed events, and casual gatherings. Its innovative technology adds a dynamic visual element to any dance floor, creating unforgettable memories for the wearer and onlookers alike.


Step-by-Step Guide

Tools and Supplies

Steps

Step 1: Test Your Components

Before starting the assembly, ensure that the ultrasonic sensor and the LEDs work correctly with the Arduino Uno and the breadboard. This step helps identify any issues early on and saves time during the build process.

Step 2: Prepare the Hat

Cut two holes large enough for the ultrasonic sensor to fit into the front of the hat. These openings will allow the sensor to detect distances accurately. Make a large incision at the front base of the hat, just above the brim, and another incision at the back to thread the wires through later.

Step 3: Soldering the Electronics

Begin by soldering wires, the ultrasonic sensor, and the LEDs to pin headers. Then, solder these components onto the perfboard. This approach eliminates the need for a breadboard to attach to the hat and streamlines the design.

Step 4: Attach the Arduino and Battery Pack

Secure the Arduino Uno and the 6-pack battery holder to the rear of the hat. Ensure they are firmly attached and well-balanced for comfortable wear.

Step 5: Hide the Wires

Thread the wires from the ultrasonic sensor through the incision at the front base of the hat to conceal them. Pass the wires from the perfboard and the connections to the Arduino Uno through the incision at the back of the hat.

Step 6: Connect the Battery Pack

Connect the battery pack to the Arduino Uno to provide power to the electronics.

Step 7: Add LED Strips

Wrap the Neopixel LED strips around the buckle of the hat. Slip the wire needed for connection to the Arduino Uno into the slit at the front of the hat and out of the slit at the back. Make sure the LED strips are evenly spaced and securely attached.

Step 8: Customize Your Hat

Add accessories to personalize your Ho Ho Howdy Hat. Consider attaching a dangling string with bells or other festive ornaments. Get creative and make your hat truly one-of-a-kind.


Behind the Scenes