It’s currently summer holidays and I am
in my school at Parsons and decided to follow Adafruit’s tutorial on converting this teddy
bear, that has a motor inside, into a mega-brain that is powered by Chat-GPT. So the idea is
that you speak and it detects your voice, sends an API request to OpenAI, and then returns
Chat-GPT’s answer. This whole thing is powered by a raspberry Pi 4 that I’ve had since
some time and wanted to try out. So let’s get started. The hardware components I used were this teddy
bear, RPi4, a USB microphone, a motor hat, an amp board, speaker, chargers, resistors,
some wires, heat shrinkers, some tools, and 3D print equipment. I first opened the stl-files in PrusaSlicer
, and then exported the g-code onto an SD-card. I’m now in Parsons’ prototyping lab, so
you can see we have a lot of 3D printers, and we are ready to 3D print the files on
our SD card. This print was pretty straight forward, took
50g of filament and 5.5h to print.
Now let’s get to the fun part! First I de-assembled
the entire bear by screwing open the plastic battery compartment like this. And now we
can take out the entire box, open it and extract the electronic components! Inside, there is a PCB board where all the
wires connect. Unfortunately it looked nothing like the tutorial’s one, so I pretty much
just guessed and tested. Now let’s take off all of these wires: There
are 4 wires that connect to the 2 DC motors, 2 wires that connect to the button, and another
2 wires that connect to the speaker. Time to solder new connections!I used these
handy male to male prototyping wires to prep the 4 new motor wires. One motor moves the
bear’s arms, and the second one moves the bear’s mouth.
During this process I unfortunately broke one of the wires, which meant I had to open
up the entire inner plastic encasing - up to the actual DC motor - to then solder an
extension to the wire I broke. AAAnd fixed! Now let’s put everything back in place and
pretend like nothing ever happened. Next up we are going to solder the prototyping
wires we just prepared to the wires on the bear. My soldering skills are still in progress….
:) Add heat shrink tubes to stabilize, and do this for all of the four wires. In order to connect the bear’s button, I
am using one of these Plug + Receptacle Cable Sets and soldered each leg to the two gray
wires of the bear.
All done!
The speaker from Adafruit came with these teeny thin wires,
so I decided to re-solder them to the slightly thicker and more sturdy prototype wires as
well.
And, this is all that we have done so far!
Okay so now we have already completed the first part which is all the wirings to the
bear, as well as this speaker. Finally we are ready to connect the two motors,
the speaker, the amp board and the button together on this Raspberry Pi DC & Stepper
Motor HAT. Just solder on all he pins and it’s ready to go. Now let’s get started with the amp board
by first soldering on the terminal block. I also connected a 100K resistor between Gain
and Vin on the Amplifier so that the speaker doesn’t heat up too much. Then I am preparing
all the other wires, and solder them on to LRC, BCLK, DIN and GND. All the wires are
then connected to the GPIO pins according to Adafruit’s Circuit Diagram. Now we are actually all done with the Hardware,
and get to the software part. Here we first burnt the Raspberry Pi OS Lite (64-bit) onto
a mini SD-card. And this is truly where the real struggle
began: It was super hard for me to set up all the software properly. Especially because
some of the software they used was outdated, the instructions were not super helpful anymore.
In comparison to the hardware, that I finished in about a day, this took me a full week and
caused a lot of mental breakdowns. What I found hardest was to get the speaker to work
as it always auto-connected to the speaker on my screen.
But in the end, luckily everything still ended up working out, and here is the final result!! This is a quick demo for the Project that
I have been working on this week and last week. To run the code, start Terminal. “Hello
there, just give my left foot a squeeze if you would like to get my attention”. So
in order to connect it to ChatGPT and to the API request, we are going to press the button
in the left foot of the bear. “How may I help you?” Hi ted, please tell me a joke.
“Let me think about that!” “Of course, here is a joke for you: Why don’t skeletons
fight each other? - They don’t have the guts”. And this is the project so far!