WEEK 0
This week I brainstormed different ideas for how I was going to turn this idea into a reality.
This week I brainstormed different ideas for how I was going to turn this idea into a reality.
This week I put together some semblance of circuitry for the design -- to get a feel for the size constraints of the design.
Originally, the connections were overcomplicated and I was using too many parts -- which made the final design diameter clock in at about 6 inches, which was way too large. After finding smaller motors, speakers, and simplifying the circuit, I got it down to around 3.8in, which was way better.
I spent about 20 hours in total this week creating the circuit model.
Some of the main difficulties came through making sure connections weren't overlapping and looked clean, finding and downloading the right part footprints, and making sure the mp3 sheild would work correctly with the esp32 (which was difficult because the mp3 shield hadn't been delivered yet)
This week I started to seriously move things around -- changing out parts, starting to put code together, and 3D Modeling. I had to redo the model about three times in total, making it clock in at about 40 hours of work this week.
On the coding side, I had to figure out how to use a python API to generate the voices, download them as MP3s, and send them to the esp32 so that they could be read by the mp3 shield.
The first challenge was to get the right API. I settled on the Google Cloud Voice Synthesis API, because it was easy to use and had the exact implementation I was looking for. The free voice was less-than ideal, so I generated some basic mp3s to see what they would sound like. The first is a free-version voice, and the second is a premium voice. I'm hoping that later down the line I will be funded to use the premium voice for a more immersive experience using the product.
Then, I had to set it up to be recieved by the arduino, so I set it up using CGI file transfer on a web server, which I'd done before. This part of the process was fairly simple. Then, I had to figure out the most simple way for it to be recieved by the arduino, so I decided to send it as a bytestream. Recieving the bytestream on the Arduino end turned out to be more difficult than I'd expected because it was too large to read all at once, so I had to do it through a buffer, which required some additional research and implementation time.
On the CAD side, I'd never experienced such a precise and difficult CAD experience, and I walked away learning a lot. I had to think about leaving space for it to be plugged in, making mounts for parts that needed to be suspended inside the machine, leaving tolerance for parts I didn't have access to yet, and remodeling infinitely. It was a slow and grueling process, but eventually I had a 3D model I was proud of.
After a week-long break waiting for parts to arrive, it was time to start assembling the circuit.
The first challenge in the assembly process was connecting the ESP32 to the VS1053 Breakout -- giving me the ability to decode, store, and play MP3 files. There were a ton of connections needed to activate the VS1053 and it took me around five hours to get it up and running, but eventually I got it to play a preloaded MP3 file.
While I wired it up, I did a test-print of my 3D model. Thank goodness I did, because I was able to analyze a multitude of problems with it.
-Mounts fell off from being too flimsy
-Speaker hole wrong size
-Cord mount misplaced
-Eyes too far apart
-Eyebrows too large
-Eyebrows misaligned
-Motor holes not on bottom
-No bed in base for PCB
The next major hoop was to get the MP3 data that I set up with my webserver last week to play through the MP3. At first, it wasn't working because it was only sending a couple bits of data instead of the entire thing. After changing the buffer system I was able to read all of the bytes, but they werent reading as an mp3 file. Figuring out why the bits were changed took me multiple days of debugging, but eventually I realized the webserver was sending the bits as a string representation of the MP3 bits. This was because the ESP32 wasn't reading the headers returned by the request. This was due to the fact I was using the python http.server module. So, instead, I used my own custom webserver and I was able to send the mp3 data successfully.
Finally, I had to set up the motor. The first issue I had was that the motor wasn't turning on when I would activate it via the ESP32. This made no sense to me when it happened, because everything led to the idea that it should've worked. After some debugging with the help of Matthew, we figured out the current consumption of the motor was more than that of the ESP32. When I changed out the DC motor for another, the motor begun to work successfully.
But, I had another problem. The magnet inside the cup would jostle sporadically in a way that wouldn't stir the drink. I tried PWMing the motor, but when it was spinning too slow the motor would be stopped by the magnet. The solution I came up with was to stop the motor breifly every once in a while to give the cup-magnet time to realign itself so that it wouldn't jostle.
For next week, I have to redesign my circuit and model, print and mill them, and assemble the final product.