n^3 (group 7) – Toy Car

Project Brief

To design and assemble a prototype of a toy that aims to teach programming. Osmo, Lego boost robotics, code & go robot mouse activity set, and the code-a-pillar are just some of a vast range of such toys that already exist in the market.

Project Goals

Purpose

To provide an engaging way to teach children basic coding principles without having to go through the hassle of learning a foreign coding language and installing a bunch of software. The 5 main elements of coding are Input, Output, Looping and Conditionals, Mathematical Operations and Variables and Data Structure. Our product teaches children most of these core elements in a fun and straightforward way that maintains their attention. It will also act as an efficient segue for them into more complex programming interfaces in the future.

Objectives

  • Ensure that it is easy to use for children
  • Maximize each child’s potential and creativity through an interactive playing experience.
  • Make the product as functional as possible
  • Ensure physical components (such as Arduino Uno) do not hinder the purpose of the product
  • A product that receives inputs and produces an output.

Target Audience

The target demographic is children aged 3 to 6, an age group that has little fine motor skills allowing them to hold objects, press buttons and utilize tools. At this age children begin to become more curious about the world around them and how certain things work. This curiosity will make them want to play with our product which will in turn develop their computational thinking skills and problem solving skills.

Market Research

1. Osmo

Coding Starter Kit

Ages: 5-12

Osmo consists of a base unit that you slot the iPad or Fire tablet in portrait mode on, and a little plastic mirror cap that fits over the camera so the iPad can ‘see’ what’s happening on the table below. This “Reflective AI technology” allows kids to play with physical items in the real world while still benefiting from the power of iPad technology.

2. Sphero Bolt – A Programmable Robot Ball

Coding Robot

Ages: 8+

Sphero Bolt is a translucent version of the robot ball (about the size of a tennis ball) that packs loads of sensors and a programmable LED matrix, but any of the Sphero models will work with the iOS or Android app – including the much cheaper Sphero Mini, or, if you can get your hands on them, the Star Wars droids including BB-8, BB-9E, and R2-D2.

3. Let’s Start Coding Code Rocket

Rocket Setup

Ages: 8+

Using a Windows, Mac or Chromebook computer, child coders can control the rocket booster LEDs and deep space headlights, have fun with the laser blasters with sound effects, Morse code light and sound messages, and start the countdown to lift-off sequence.

Conclusion

There are many products on the market that try to tackle the challenges of teaching kids the theory of code/programming in an entertaining and efficient way. However, none of them depict runtime errors. We plan to take the basic idea of a physical based programming interface and add upon it, by having the sequence stop when a collision has occurred. (This is done through sensors detecting if a wall is within range). We will also utilize blinking LEDs to provide visual feedback if an obstacle is identified.

Design Decisions

1. (3) navigation buttons [right, forward, left]

As opposed to the stereotypical 4 ones [right, forward, backward, left]. This is because the car will not be required to move backward for play, especially during the early stages of familiarizing a child with coding. Backwards is a command reserved for more complex sequences.

2. (1) RGB LED

Due to time constraints, instead of providing 2 LEDs to act as the pupils of the car, one LED will protrude from the hood of the car and act as a siren light.

3. Removal of sensors

Due to time and space constraints, the Arduino UNO does not have enough pins for all the components. Using a shift register would have required that we change the design of the car and make it abnormally large; something that the child would not be able to manage.

4. Car trunk

We decided to make a cover for the batteries to imitate the back trunk of a car: an intuitive and fun design to help the child relate the toy to real life and feel included with adult activities.

Prototypes

Low Fidelity – Detailed Sketches

Conceptual design of the car – emulates “Cars” movie toy
Top view – Level (1)
Top view – Level (2)
Side view – Both levels

High Fidelity – Technical Drawings

Isometric view (1)
Isometric view (2)
Side view
2D production diagrams

Task List & Group Member Roles

Nadia

Project Manager (Assembling, Physical Prototyping, Testing, Design Blog)

Nicolas

Lead Designer (Assembling, Coding, Physical Prototyping, Testing, Upload Blog)

Nathanael

Lead Programmer (Coding, Code Prototyping, Testing, Design Blog)

WEEK EIGHTBuild Team and Assign Roles
Decide on a Project Brief
Conduct Market Research
Meeting 1
WEEK NINEBrainstorm Ideas
Research on components needed for project ideas
Low-Fi Prototype 
Meeting 2
WEEK TENOrder components needed to build final product
Use currently available components to build a technical prototype
Code Prototype (tester)
Plan extra features
Meeting 3
WEEK ELEVENCollect components
Finish physical build
Finalize Code
Evaluate project
Final Meeting
WEEK TWELVEPRESENTATION WEEK
-Showcase product
-Complete documentation/design blog(CIO wordpress website)
Gantt Chart

Maker Manual

Components

  1. X1 GSD-329 ScrewDriver
  2. X1 Car Shell
  3. X1 L298N Dual H Bridge Stepper Motor Driver Board
  4. X4 DC 3V-6V Single Axis Gear Reducer Motor
  5. X2 RGB LED (Optional, visual indication of collision)
  6. X5 Buttons
  7. X4 Smart Robot Car Tyres Wheels For TT Gear Motor Chassis
  8. X2 Breadboard
  9. X1 Sensor
  10. X1 DollaTek 4 x AA 6V Battery Holder Case Box Wired ON/OFF Switch and Cover

Breadboard Layout

Arrangement of components

How to Build

  1. Cut out all cardboard components to prepare them and keep them on standby
  2. Solder Ground and Positive wires to all 4 motors
  3. Solder elongated to wires to buttons (make sure to connect 2 teeth protruding from the same side, and not on opposite sides)
  4. Solder elongated wires to designated RGB LED inputs (color code the wires to the inputs for intuitive understanding [ex. Red wire to red input])
  5. Connect motors to wheels
  6. Connect and screw to secure wires into designated output slots on the motor driver
  7. Connect all components as demonstrated in the breadboard layout

Testing Iterations

Short demo of performance

Shortcomings

  • Soldering is a bit weak on the motors making it easily removable/detachable. (Tape used to hold it in place)
  • Not as powerful when using a battery compared to plugged in directly, believe it’s due to the battery not providing enough power/voltage to the Arduino UNO
  • Cardboard base is weak and not strong enough to protect the arduino from children recklessness (a more sturdy recyclable material should be used/OR reinforce cardboard with paper mache)
  • Buttons used are too small for children to use.
  • Could have a display to show what the current input sequence is in case the user forgets.
  • Using a stripboard and solder parts on a breadboard may have been a more neater option.
  • Huge battery drain, possibly a voltage issue and lack of resistors for efficiency purposes a rocket switch/power switch should’ve been included.
  • Exposed wires tend to touch each other causing undesired colour changes in the LEDs. wiring could be more efficient using shorter wires and thicker soldering.

Commented Code

//Simple state check, this is for the main loop of the car combination
bool start;
 
//Storing the motor pins for forward and reverse movement
int l_motorR = 13;
int l_motorF = 12;
 
int r_motorF = 11;
int r_motorR = 10;
 
//Left
int button1Pin = A0;
//Start
int button2Pin = A1;
//Forward
int button3Pin = A2;
//Right
int button4Pin = A3;
//Reset
int button5Pin = A4;
 
//Keep track of all button states
int button1State;
int button2State;
int button3State;
int button4State;
int button5State;
 
//Rather than an array which has a fixed size it's better to use a string and loop through each character as you can add to a string at any point;
String commands;
 
//RGB LED Pins
int redPin = 5;
int greenPin = 6;
int bluePin = 3;
 
void setup() {
  // put your setup code here, to run once:
  //Setup all pins
  pinMode(l_motorR, OUTPUT);
  pinMode(l_motorF, OUTPUT);
  pinMode(r_motorF, OUTPUT);
  pinMode(r_motorR, OUTPUT);
 
  pinMode(button1Pin, INPUT);
  pinMode(button2Pin, INPUT);
  pinMode(button3Pin, INPUT);
  pinMode(button4Pin, INPUT);
  pinMode(button5Pin, INPUT);
 
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
 
  //Reset Check Vars
  start = false;
 
}
 
void loop() {
 
  // put your main code here, to run repeatedly
  //Read all button Inputs
  button1State = digitalRead(button1Pin);
  button2State = digitalRead(button2Pin);
  button3State = digitalRead(button3Pin);
  button4State = digitalRead(button4Pin);
  button5State = digitalRead(button5Pin);
 
  //Set LED to Cyan at first
  setLED(255, 0, 0);
 
  //If(Left button pressed)
  if (button1State == HIGH) {
    commands += "1";
    delay(500);
  }
 
  //if (start button pressed)
  if (button2State == HIGH) {
    start = true;
  }
 
 //if (forward button pressed)
  if (button3State == HIGH) {
    commands += "2";
    delay(500);
  }
 
   //if (right start button pressed)
  if (button4State == HIGH) {
    commands += "3";
    delay(500);
  }
 
 //if (reset button pressed)
 if (button5State == HIGH) {
    Reset();
    delay(500);
  }
 
  //Force the loop to be stuck here until the string of commands is complete
  while (start) {
    //Set Color to Green to show it is running the commands
    setLED(255, 0, 255);
   
    //for loop to go through each character of the string
    for (int i = 0; i < commands.length(); i++) {
      if (commands[i] == '1') {
        Left(3500);
      } else if (commands[i] == '2') {
        Forward(3500);
      } else if (commands[i] == '3') {
        Right(3500);
      }
    }
    //reset everything when command is completed
    Reset();
    start = false;
  }
}
 
void Reset() {
  commands = "";
  setLED(0, 255, 255);
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
  digitalWrite(10, LOW);
  digitalWrite(13, LOW);
  delay(300);
  end = false;
 
  Serial.print("Reset");
}
 
void Forward(int delayTime) {
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
  digitalWrite(13, HIGH);
  digitalWrite(10, HIGH);
  delay(delayTime);
}
 
void Left(int delayTime) {
  digitalWrite(12, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH);
  digitalWrite(13, HIGH);
  delay(delayTime);
}
 
void Right(int delayTime) {
  digitalWrite(12, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(11, LOW);
  digitalWrite(13, LOW);
  delay(delayTime);
}
 
//Set RGB Values for Light
void setLED(int red_light_value, int green_light_value, int blue_light_value) {
  analogWrite(redPin, red_light_value);
  analogWrite(bluePin, blue_light_value);
  analogWrite(greenPin, green_light_value);
}

Group 5: Parrot Theatrical Prop

We chose to create an interactive parrot theatrical prop.
This prop would be used during a live performance to interact with the audience and bring life into the scenery. 

Sketching and Ideation

  • The main interactive feature in our design is the wing movement:
    The two wings of our parrot will be moving in a motion that resembles flying.
  • Complementary interactive features:
  1. Sound effects: our prop will be able to make parrot sounds 
    we also planned to add a microphone to record the user’s audio which the parrot will then be able to repeat.
  2. Light: the eyes of the parrot will light up in the dark
Early design sketches of the parrot and exploration of the wings’ range of movement

Low-Fi prototype

paper prototype showing feather groups of wings
reverse side with lolly sticks showing bone structure

Supplies

We aimed to make sustainable design decisions and use recycled materials as much as possible:

  • For the main body of the parrot, we chose to use a 2-litre plastic water bottle that provides shape and also allows us to hide the wooden wings’ supporting structure.  
  • For the head, we used another 0.5-litre water bottle and added a beak-like part, also made out of the plastic bottle.
  • For the base, we used a cardboard box that hides most of the Arduino’s electronic components to achieve clean aesthetics on the exteriors.
  • For the wings, we chose to use umbrella parts which allow for a similar movement to that of a wing.

Wing mechanism testing

The wing structure and motion were achieved using a broken foldable umbrella controlled using a servo. We used 90 degrees range of movement to open and fold back the wing.

foldable umbrella mechanism explained
wing mechanism sketches
umbrella rib with feather groups (folded)
umbrella rib with feather groups (outstretched)
wings with body

Internal structure

wooden structure with servos and wings attached

Paper Mache

In order to create a solid base for the acrylic colouring as well as to add a feathers-like texture, we used paper mache in both the body and the head of our prop.

Inside: body with a head and supporting wooden structure
Outside: body and head (paper mache) with wings attached to the internal structure

Colouring

We used acrylic paint for the surface area to achieve the typical macaw parrot’s look and create a tropical leaf pattern on the box at the base.

Wing motion

Project Task List

TaskDeadlineAssignment
Researching components required25th NovemberInbar
Making body exterior29th November Luciana
Making wings29th NovemberOlivia
Creating internal structure 2nd DecemberLuciana & Olivia
Adding microphone and speaker functionality2nd DecemberInbar
Adding wing controls 6th DecemberOlivia, Inbar & Luciana
Decorating exterior9th DecemberLuciana & Olivia
Adding speaker control9th DecemberInbar
code testing10th DecemberLuciana, Olivia and Inbar

Maker Manual

Overview

This is a Macaw parrot which can flap its wings and make noises. The wing speed can be controlled using a potentiometer, as well as stopping the wings at the open or closed position. The parrot sounds can be activated by pressing a button.

Tools and supplies

Electrical components:

  • 2 arduino unos
  • 2 SG90 servo motors
  • 1 potentiometer
  • 1 button
  • 1 led (red)
  • 1 8O3W-JST-PH2.0 Speaker
  • 1 Micro SD SPI Storage Board
  • 1 micro SD card

Non-electrical components

  • 2 litre plastic bottle
  • 0.5 litre plastic bottle
  • 2 umbrella ribs
  • cardboard box
  • thin paper (for paper mache)
  • thicker paper (for wings and leaves)
  • rectangular wooden dowels
  • screws
  • nails

tools:

  • glue gun
  • hammer
  • screw driver

Build

First, disassemble an old umbrella, leaving 2 ribs. Cut out two ‘feather sections’ out of paper and stick them onto the umbrella ribs.

Next, make the internal skeleton out of some rectangular wooden dowlels. A central thicker piece (a bit longer than length of 2 litre bottle), and three thinner pieces (length is diameter of bottle) arrange two of the dowels near one end of the central dowel, a servo width apart. Secure these dowels to the central dowel with nails and/or wood glue. Attach the third shorter dowel further down the stick at a perpendicular angle to provide more support once inside the bottle. Position the two servos vertically between the wooden dowels, about 4cm apart, and add screws to secure them. Screw servo arms onto the servos.

With the 2 litre plastic bottle, cut two holes, about 1.5cm by 7cm on either side of the bottle, at the position of the wings. Cutting out a panel of the bottle can be useful at this point. Put the wooden skeleton inside the bottle, lining up the servos with the gaps in the bottle. Arrange the wings at the correct position, with the umbrella directly over the center of the servo, and the runner angled to the central dowel. Use hot glue to attach the umbrella rib to the servo arm and at the end of the runner to the central dowel. Do this for both wings. That is the mechanism finished. You may choose to paper mache the bottle and decorate before assembling the mechanism, or after. To make the head, cut a 0.5 litre water bottle in half, cut a triangle from the leftover plastic, and stick it on curved to make a beak.

Layout and circuit diagram

Speaker audio

SD card containing our audio file which is used by our speaker (output) when triggered by the button (input)

Wing’s movement

The 2 servos (outputs) are controlled by the potentiometer (input) which can be monitored by the LED

Code

Our Code consists of two main interactive output components: the speaker and the servos. These are user-controlled using a button and a potentiometer. The LED allows for speed monitoring.

Speaker audio

This code allows the speaker to play an audio file saved on the SD card. At the setup, the connection with the SD card is established. This can be verified through the Monitor. When the button, linked to pin 2, is pressed, the audio file ‘parrot3.wav’ plays at a volume of 5. While the audio is playing, there is a 10-second delay to allow for the audio to complete before it can be played again.

#include <TMRpcm.h>
#include <SD.h>
#include <SPI.h>

TMRpcm audio; // make instance variable
TMRpcm tmrpcm;   // create an object for use in this sketch

const int buttonPin = 2; // the number of the pushbutton pin

int buttonState = 0;  // variable for reading the pushbutton status

#define SD_CSPin 4 // defines the CS pin of the SD card.

void setup() {
  tmrpcm.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc
  tmrpcm.setVolume(5); //audio's volume (0-7)

  //initializes the serial connection between the Arduino and any connected serial device
  Serial.begin(9600);
 //initial the SD card connection and verification through the serial monitor
  Serial.println("loading... SD card");
  if (!SD.begin(SD_CSPin)) {
    Serial.println("An Error has occurred while mounting SD");
  }
  while (!SD.begin(SD_CSPin)) {
    Serial.print(".");
    Serial.print("h");
    delay(500);
  }
  audio.CSPin = SD_CSPin;

  // initialize the pushbutton pin as an input
  pinMode(buttonPin, INPUT);

}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH
  if (buttonState == HIGH) {
//play the audio
    tmrpcm.play("parrot3.wav");
//1 second delay
    delay(10000);
  } 
}

Wing movement

This code adds the wing movement functionality to our parrot. It makes use of the Servo library. It starts by initialising some variables including maxDegree, minDegree (boundary movements of the wings), speed (used to control the speed of the wing movement), and ledPin, sensorPin (potentiometer input), sensorValue (potentiometer value).

In setup, the servos and LED are attached to their respective pins. In the loop, the getSpeed function is called, getting the current potentiometer value and mapping it to a value between 10 and 50, determining the speed of the servo movement. If the potentiometer is all the way to the low end, the wings will stay open. If the potentiometer is turned all the way to the high end, the wings will stay closed. If the potentiometer is not at the highest or lowest values it will flap, with the speed depending on the position of the potentiometer.

The openWing and closeWing functions work by creating two variables lDegree and rDegree (the angle of each wing) they then loop from minDegree to maxDegree (for open wing) with the delay fetched from the getSpeed function. An LED also blinks at a speed relative to the wing speed. If the wings are at a multiple of 20 degrees, the LED turns off, else if they are at a multiple of 10, the LED turns on. This causes the light to blink faster or slower with the movement of the wings.

#include <Servo.h>

Servo Lservo;  // create servo object to control a servo
Servo Rservo;

int maxDegree = 80;
int minDegree = 10;

int sensorPin = A0;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor
int speed;
int ledPin=7;

void setup() {
  Lservo.attach(5);  // attaches the servo on pin 9 to the servo object
  Rservo.attach(6);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int nspeed = getSpeed();

  if(nspeed <=20){
    //wings open
    Lservo.write(minDegree);
    Rservo.write(180-minDegree);
  }else if(nspeed >= 40){
    //wings closed
    Lservo.write(maxDegree);
    Rservo.write(180-maxDegree);
  }else{
    //flap wings
    openWing();
    closeWing();
  }
}

//gets current value from potentiometer and maps it to a suitable speed value
int getSpeed(){
  sensorValue = analogRead(sensorPin);
  speed = map(sensorValue, 0, 1028, 15, 50);
  return speed;
}

//moves the servos from the minimum degree to the maximum degree
void openWing(){
  int lDegree;
  int rDegree;
  for (int i = minDegree; i<=maxDegree; i++){
    lDegree = i;
    rDegree = 180 - lDegree;
    Lservo.write(lDegree); // sets the servo position according to the scaled value
    Rservo.write(rDegree);

    //led bink
    if(i%20==0){ //led turns off every multiple of 20
      digitalWrite(ledPin, LOW);  
    }
    else if(i%10==0){ //if not a multiple of 20, but a multiple of 10, led turns on
      digitalWrite(ledPin, HIGH);
    }
    int nspeed = getSpeed();
    delay(nspeed);   
  } 
}

//moves servos from max degree to minimum degree
void closeWing(){
  int lDegree;
  int rDegree;
  for (int i=maxDegree; i>=minDegree; i--){
    lDegree = i;
    rDegree = 180 - lDegree;
    Lservo.write(lDegree);
    Rservo.write(rDegree);
    if(i%20==0){
	    digitalWrite(ledPin, LOW);  
    }
    else if(i%10==0){
      digitalWrite(ledPin, HIGH);
    }
    int nspeed = getSpeed();
    delay(nspeed);   
  }  
}

Testing and shortcomings

Software testing

The goal of this series of tests is to ensure the program runs smoothly and the logic of the code functions properly. To do so, we eliminate the physical components and use print commands to the monitor to follow the program step by step.

  1. Serial.println(lDegree) and Serial.println(rDegree) – This allows us to see the angles achieved by the servos in the serial monitor to check that the code was working as intended.
  2. Serial.println(nSpeed) and Serial.println(sensorValue) – Used to check that the correct range of values was being passed in by the potentiometer and that they were being mapped correctly into the speed at which the servos would turn.
  3. Serial.println(‘button pushed’) and Serial.println(‘played audio’) – Used to test that the code was going through the correct if statement when the user interacts with the button and used to test that the audio was being played.
  4. Using online tools (tinkercard.com) to test that our software was functional thus allowing us to see that the issue was the hardware.

Hardware testing

The goal of this series of tests is to ensure that every physical component used for our prop is functioning correctly on its own and is connected properly.

  1. Using the example servo code provided by the Arduino IDE to test the servo’s functionality and range as well as the potentiometer.
  2. When faced with issues we changed the wires and breadboard used in the circuit to test if that was the issue.
  3. Voltmeter testing with faulty components.
  4. We used separate breadboard and Arduino for the servo circuit and the speaker circuit at first before adding them together to make sure everything was functional and make testing easier.

Shortcomings

Our recording functionality was not working properly. In order to locate the root issue and fix it, we checked the hardware and the code separately. We tested each hardware component one at a time using a voltmeter to ensure all of the electronic components are fully functional. Unfortunately, we discovered the microphone component was faulty and therefore could not be used. Due to time restraints, we could not order a new microphone and had to give up on this feature.

Furthermore, the time constraints as well as the size of the breadboard made it difficult to add the LEDs for the eyes. Upon evaluating the priorities for the project we decided that the LED would be more suitable for a ‘creepy’ prop and it would be better to not use that idea on the final product.

Using a voltmeter to ensure the electrical components function as intended

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