GPT Hat - Gyroscopic Pronosticator Top Hat

by lianhan3920 in Circuits > Arduino

93 Views, 1 Favorites, 0 Comments

GPT Hat - Gyroscopic Pronosticator Top Hat

Weixin Image_20240610122646.jpg
CDDF_HatGPT (2).png
CDDF_HatGPT(3).png
GPT_Hat_1
GPT_Hat_2

Welcome to the magical world of DIY wizardry, where your craft can bring to life a companion as wise as it is whimsical. Imagine a hat, not just any hat, but one that speaks, interacts, and guides you through the labyrinth of life’s choices. This isn’t just a project; it’s the creation of a friend, fashioned from fabric and electronics, inspired by the enchanting Sorting Hat of Harry Potter fame.

In this instructable, we’re not just stitching seams; we’re weaving enchantment. You’ll learn how to imbue a stylish top hat with the power of decision-making, using nothing but your own hands and a sprinkle of technology. This hat doesn’t just sit pretty atop your head; it converses, it contemplates, and it helps clear the fog on those days when the right path seems hidden.

With a nod, you’ll answer its probing questions. With a tilt, you’ll steer the course of its counsel. The hat senses the subtleties of your movement, discerning yes from no, and delving deeper into the dance of decision-making. It remembers, it reasons, and it responds, guiding you through a gauntlet of queries until, at last, it arrives at a conclusion, offering feedback as personalized as your own thoughts.

So, don your crafter’s cap and prepare to partake in the creation of the Gyroscopic Pronosticator Top Hat (GPT), a gyroscopic guide through the quandaries of life, and perhaps, in the process, discover a bit more about yourself. Let’s begin this journey of joy, jest, and judgment, and bring to life a creation that’s sure to be the talk of any gathering, magical or mundane.

Supplies

image14.jpg
  • Arduino UNO
  • Power Supply: Either 3 units of 9v Batteries or a 3Amp - 9v power supplier
  • Servo Motors: 4 units of 180° 12kg 6v MG996R or similar
  • Accelerometer: ADXL345
  • Audio Player: DFPlayer Mini MP3 Player
  • Micro SD card: 2GB
  • Audio Amplifier: 2 * 3W Arduino PAM8403 or similar
  • Speaker: 4 Ohm 3W, 40mm in size
  • Jumpers/Wires
  • Resistor: 1K Ohm
  • Breadboard: Half-size or larger

Print Structure

diagram-mechanism-01.png
a948442e-5782-4f5a-a201-eb773bef1106.jpg

Use 3D printer to print the inner structure.

Fabrication

20561ec9-8835-4588-ab17-f921aa7d6751.jpg
cf79f014-6a39-42ee-ba22-3bb0d09ddc4e.jpg
eccc0491-ab7c-49e2-a7f1-553c92baa569.jpg
edd758b4-e826-41cf-a133-c4047dd4e411.jpg
41bafce7-8521-45a9-a4f5-90d18d0761cb.jpg
  • Find a wide-brimmed hat (if the color is not suitable, you can rewrap it with a layer of fabric).
  • Secure the structural components to the hat.
  • Attach the four motors to four positions on the brim of the hat, adjust the propeller blades to a vertical position, and use strings to secure the tops of the propellers to the top ring of the hat.
  • Secure the speakers to the brim of the hat, and attach the other electronic components (Arduino board, accelerometer, power supply, etc.) to the platform.

Build Logic

CDDF_HatGPT.png
CDDF_HatGPT (1).png

Build baisc behaviour logic, it includes three parts here:

  • Start behaviour: To start the entire program, an identifiable start point is needed, such as a specific behavior or a button press. In this case, we set "JUMP" as the starting behavior and use data collected by the accelerometer sensor to recognize it.
  • Instruction Behaviour: To ensure the user understands what will happen, the hat will first demonstrate the correct reaction. It will use a WHILE loop to ensure the program does not continue until the user performs the correct reaction.
  • Reaction Behavior: The accelerometer sensor will record the user's movement in the XYZ axes for a certain period. The program will then compute the maximum movement to determine if the user is answering "yes" or "no" and record the response.

For the hat movement, there are three types:

  • Speaking: When the hat is speaking, it will move up and down with all four servos working together.
  • Saying YES: To demonstrate "yes," only the front and back servos will move, causing the hat to swing back and forth.
  • Saying NO: To demonstrate "no," only the left and right servos will move, causing the hat to swing left and right.

Downloads

Build Circuits

ada1a007-4280-4189-aa2c-7ed9a461ddc2.jpg
f4bc6947-291c-4284-a413-a4cd44a582a8.jpg

Breadboard to Arduino UNO: 

  • Power both transversal positive lines of the breadboard with the 5V pin in Arduino 
  • Connect both transversal negative lines of the breadboard to the GND pin in the Arduino

Servo Motors to Arduino UNO:

  • Servo motors have 3 wires: two for power (normally red for + and black for gnd) and one more for signal (normally yellow or orange).
  • Power all servos to the positive and negative lines on the breadboard.
  • Connect the signal cable of the servo to the following pins corresponding to the position of the Servo in the Hat:
  • Front servo to pin 11 
  • Right servo to pin 10 
  • Back servo to pin 6 
  • Left servo to pin 5

Connection

image3.png
image7.png
image1.png
image12.png
image6.png

Accelerometer to Arduino UNO: 

  • Connect VCC  to the positive line on the breadboard, and GND to the negative line on the breadboard. 
  • Connect SDA to pin A4 and SCL to pin A5 on the Arduino.

DFPlayer Mini to Arduino UNO: 

  • Connect VCC to the positive line on the breadboard, and GND to the negative line on the breadboard. 
  • Connect pin 2 in the Arduino board to the 1k resistor, and the resistor to the RX pin in the DFPlayer Mini
  • Connect pin 3 in the Arduino board to TX pin in DFPlayer Mini

DFPlayer, SD card and .mp3 files:

  • Record or select the MP3 files for the dialogues, introductions, and questions.
  • Store them in your SD card. The files must be named using a 4-character number (eg. 0001, 0023, 0140, ...) IMPORTANT: the DFPlayer uses these numbers to organize the .mp3 files in ascendant order to play them in the code. 
  • Here are some website you can generate AI sound and download for free like https://voicegenerator.io/
  • Insert the SD card in the DFPlayer.

DFPlayer Mini to Amplifier:

  • Connect the Amplifier “5V +” pin to the positive line on the breadboard, and  the “-” pin to the negative line on the breadboard. 
  • Connect the DAC_R pin and DAC_L pins on the DFPlayer to the R and L pins on the Stereo Amplifier respectively. Connect also the pin in between L and R to GND in the breadboard

Stereo Amplifier to Mini Speakers:

  • Connect both the positive and negative sides of the speakers to the output L and R in the amplifier as shown in the image below.

Batteries in series:

  • Connect all 3 batteries in series by connecting the 3 positive and 3 negative sides.

Arduino UNO:

  • Power Arduino using the 9v batteries connected in series using the power jack in the board. IMPORTANT: Arduino UNO can work with up to 12v but only if the power is input through the power jack, otherwise you can fire the board.

Load the program to your Arduino:

  • Load the script in the description to your Arduino using the USB A-B cable and the Arduino IDE interface.