Introduction: Hogwarts Sorting Hat

If you wished to study at Hogwarts when you were a child, you have come to the right place. Here, you can make a real-life sorting hat that sorts you into your designated Hogwarts house!

As we created this hat, we implemented speech recognition software and natural language processing (NLP) programmed in JavaScript. We designed the components in Fusion 360 and 3D printed them on one of our classroom Lulzbot Mini printers. We also used Adobe Illustrator for a couple of the steps and even utilized our arts & craft skills!

We are Aadhvi and Angela and we have created this Sorting Hat for Ms. Berbawy’s Principles of Engineering class at Irvington High School. We would like to thank Ms. Berbawy and Berbawy Makers for their guidance and support, Super Crafty-Listic on Youtube for their hat-making instructions, and N1ffler for their sorting hat analysis on Reddit. We would also like to thank the platforms we utilized when making this project: Adobe Illustrator, Fusion 360, Lulzbot, and Alan AI :)

Supplies

  1. Hat Build Supplies:
  2. 22 x 28 in White Poster Paper
  3. Felt
  4. Faux Suede Fabric
  5. Watercolor
  6. Paintbrushes
  7. Hot glue AND Elmer's glue
  8. Newspapers
  9. Paper towels
  10. Aluminum foil
  11. Brown thread and needle (for sewing)
  12. Electrical Components
  13. MOMOHO Mini Bluetooth Speaker
  14. Wireless Lavalier Microphone
  15. Software/CAD
  16. Fusion 360
  17. If you are a student, you can get a free educational Autodesk account
  18. Alan AI
  19. Documentation (You can reference this documentation when working on Alan AI)
  20. 3D Printing
  21. Lulzbot MINI
  22. NinjaFlex Filament (Color of your choice)

Step 1: Hat Build Part One

We followed this video: Harry Potter DIY - Sorting Hat

Things that we had to watch out for (that weren't mentioned in the video!):

  • When making the bottom of the hat, we took into account that the human head is NOT the shape of a circle. The shape needed to be more like an oval or ellipse. We took measurements of our classmate’s heads and calculated an overall average. 
  • This is how we layered our materials: Paper Towels --> Newspapers --> Fabric/Felt
  • We used Elmer's Glue for the paper towels and newspapers. We used a hot glue gun for the fabric and felt.
  • We only put felt on the bottom of the brim! We did not put felt on any other part of the hat.
  • WE DID NOT CLOSE THE TOP OF THE HAT. There was an interior component for the speaker that was going to be held by a string that looped over the tip of the hat that we still needed to put inside. So, we decided to leave a 2 inch long, 0.5 inch wide, rectangular space free of felt. This space was around 60 degrees left of the face of the hat and was at the bottom of the hat brim. The picture above shows this space.

Step 2: Hat Code

  1. Pre-code work
  2. Process (w/ Flowchart)
  3. We created a flowchart to understand the functions necessary for this code and organize the "flow" of the program (how each function leads to the next).
  4. Then, we began the question-generation process. We referred to the Pottermore Sorting Hat Quiz Analysis done by N1ffler on Reddit. There were six binary answer questions that calculated how likely it was for a certain Hogwarts House choose a specific answer.
  5. Code
  6. Our code contained four variables for each Hogwarts house. We wanted our program to ask the user a certain set of questions and add a set amount of points to the correlating variable based on the user's response.
  7. The final house that the user was sorted in was determined by which variable had the maximum value. For example, if the Gryffindor variable had 3 more points than the other variables, it would be the final house.
  8. We added a command that told Alan AI to begin running the Sorting Hat program. We decided to use the words "Sort me" as a "signal" for Alan AI. So, when the user said "Sort me," the code would start running.
  9. Our program checked for the possibility of a tie. When there were ties, we used a question with four possible responses from N1ffler's analysis to break the tie (shown in the third picture above).
  10. Lastly, we checked for the house with the most points. Then, our program announced the results to the user! (The code has been attached below)

Step 3: 3D Modeling Interior Component

Use of interior component:The main purpose of the interior component was to hold the speaker that connected to our computer, which contained our code.

The STL file of the interior component is attached below. The center part holds the speaker in place, and the air holes located on the base of the component lets more sound travel through.

Download STL File here

Step 4: 3D Printing Interior Component

After downloading the STL File, we uploaded it onto Cura, the slicing software used for our classroom's Lulzbot MINI.

Software: Cura Download

Our Lulzbot MINI 2 had NinjaFlex filament installed in it. The interior component needed to be flexible in order to properly fit in the hat, which is why we used NinjaFlex.

The pictures of our finished print are shown above.

Tips:

  • We changed the infill density of our print from 25% to 15% so the component would be more flexible. The pictures of our print settings are shown in the 4th and 5th pictures.
  • On Cura, we always checked if the first layer was completely on the build plate. If the first layer was at an angle and a part of it was not touching the build plate, the print would have definitely failed. The sixth photo attached above shows an example of what it looked like when the first layer was fully on the build plate.

Print error:

  • Shown in the second picture, the extended pieces of our print were extremely fuzzy due to NinjaFlex filament wobbling when being printed. However, the extended parts only had one job: being the pieces that the string could tie onto. The messy fuzz did not affect its functionality, which is why we did not reprint the component.

Step 5: Hat Build Part Two

  1. Once the print finished, we tied all three strings together around 2 inches above the extended pieces. The string was needed to stabilize and hold the interior component in place. The first picture shows how our component looked with the strings attached to it.
  2. We aligned and fit the interior component into the hat and pulled the excess string through the hat's tip (this is why we did not close the tip when we first built the hat).
  3. Once all the string was out, we hot glued the string onto the back of the hat, around 5 inches from the top (shown in second picture).
  4. When we created the cover for the tip of the hat, we cut a 6 by 6 inch square piece of fabric. We wrapped the fabric around the top of the hat until the tip closed. We then sewed the edges of the tip together.
  5. We attached two pieces of velcro on the inside of the of the tip cover (shown in the third picture above). We attached two more pieces of velcro on the hat and made sure it aligned with the velcro on the cover (shown in second picture). 
  6. Lastly, we created a cover that went over the brim, in order to cover the microphone. We used felt on the top, and fabric on the bottom. The last picture shows our velcro placement when the cover was open.

Tip:

  • We used hot glue to stick the velcro pieces onto the fabric and felt.

Step 6: Final Assembly

  1. For finishing touches, we used dark brown watercolor to shade the eyes, mouth, and edges of the hat. We avoided using too much water, and used just enough to make our paintbrush damp. The first two pictures above show the hat before the shading, and the hat after the shading.
  2. To assemble the hat, we began by attaching the MOMOHO speaker inside the speaker holder (the 3D printed part) and fitting the whole thing into the hat. The third picture above shows a bottom view of how our 3D printed component looked inside the hat.
  3. We closed the tip of the hat by attaching the tip cover (shown in fourth picture).
  4. Then, we attached the Lavier microphone to the hat brim, specifically in the area under the microphone cover. We closed the cover to hide the microphone. (pictures 5 and 6).
  5. After making sure our laptop could simultaneously connect to the microphone and the speaker, we began running the code.

Step 7: Hogwarts Sorting Hat Video

We hope you enjoyed making the hat! Hope you get sorted into the right house ;)