Input Devices

This week I am working on the voice control part of my Castform machine.

Finish Soldering the Board

This week also presented a great opportunity to continue working on my final project Castform machine. There are two input modules in its design: a button and a microphone for voice control. I intend to work on both this week as they form a nice line of progression. The first thing I did this week was to continue soldering the board. The input modules I will be using don't need many components, but I think it's a good chance to get components ready in case some unexpected behavior occurs.

Next batch soldering of the board
The next batch of components I soldered on the board. The resistors and capacitors are mostly there.

I finished soldering most of the components on the board, but I also found some remaining issues. First as you can see in the PCB design below, I accidentally used the 1mm pitch pin header for J3 and J5, which are designed for OLED display and speaker respectively. They obviously don't fit the 2.54mm pitch pin headers I have in lab. I can get around J5 through the additional J7 expander I put in. However, there is no good way around J3 so I may need to do some board surgery to fix it later on.

The other issue is comparatively minor. I designed my J1 and J8 connectors to use the larger SM99S01VBNN05G7 footprint, but it turns out we do not have them currently in EECS lab. I will solder them after they come in later on in the semester. Luckily I can still power the board through the USB-C port.

Revised and revised again board design
The PCB layout of my current board. Here you can see the J3 and J5 connectors are visibly smaller than others, which is where the issue lies.
Next batch soldering of the board with most connectors
The rest of the soldering I did this week. Other than the previously mentioned issues, the board is ready for testing.

Button Testing

Those issues aside, let's move on to the button testing. This part is pretty straightforward. Since I haven't designed the machine yet, I just put the button on a breadboard and connect it to the board through jumper wires.

Button test configuration
The configuration of the button test. The button is connected through the designed button connector. Button itself is on the breadboard now.
Video showing the button test working. Both the LED on the board and the serial monitor are changing with each button press.

Microphone Testing

The microphone testing is a bit more involved. I used the add-on Sense board on top of XIAO ESP32-S3 to read the microphone signal. It also has a built in camera but it is not relevant in my case. For sound testing, I first directly constructed the script to push the sound data to the serial monitor for visualization. I received help from ChatGPT in building this script.

Microphone testing configuration
The configuration of the microphone testing.
Video showing the microphone test working. The waveform changes with my sound input.

Voice Control Testing

The voice control testing is the final part of this week. While the general idea is to have my Castform change based on current weather, adding voice control to change form would be a good way to demo and test. For implementation, I used Espressif's ESP-SR library in ESP-IDF for that. The idea is the microcontroller will continuously listen to the microphone input for a wake up word (I initially used "Jarvis" but it did not work well so I later switched to "Hi ESP"). Once it gets that, it will listen for three commands "Sunny", "Rainy", and "Change form". For this part I also received help from ChatGPT in building the code.

ESP-IDF configuration
Here I installed the ESP-IDF plugin in VSCode and successfully flashed the microcontroller with the code.
Video showing the wake up word and command recognition working.

Code

Download the input and voice code (.zip)