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
- Hat Build Supplies:
- 22 x 28 in White Poster Paper
- Felt
- Faux Suede Fabric
- Watercolor
- Paintbrushes
- Hot glue AND Elmer's glue
- Newspapers
- Paper towels
- Aluminum foil
- Brown thread and needle (for sewing)
- Electrical Components
- MOMOHO Mini Bluetooth Speaker
- Wireless Lavalier Microphone
- Software/CAD
- Fusion 360
- If you are a student, you can get a free educational Autodesk account
- Alan AI
- Documentation (You can reference this documentation when working on Alan AI)
- 3D Printing
- Lulzbot MINI
- NinjaFlex Filament (Color of your choice)
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.
Hat Code
- Pre-code work
- Process (w/ Flowchart)
- 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).
- 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.
- Code
- 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.
- 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.
- 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.
- 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).
- 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)
Downloads
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.
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.
Hat Build Part Two
- 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.
- 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).
- 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).
- 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.
- 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).
- 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.
Final Assembly
- 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.
- 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.
- We closed the tip of the hat by attaching the tip cover (shown in fourth picture).
- 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).
- After making sure our laptop could simultaneously connect to the microphone and the speaker, we began running the code.
Hogwarts Sorting Hat Video
We hope you enjoyed making the hat! Hope you get sorted into the right house ;)