Output devices

Output Devices

Workflow

Workflow

Technically I completed input and output devices in my previous weeks when I manufactured the TOF and OLED board. However, I want to learn more about electronics design and therefore opted to try and design another unique output device.

My initial idea was to design a temperature sensor and reactor. I dubbed it the hot stove test! A DHT sensor would be connected to a XIAO ESP32 C3 and that would in turn be connected back to a speaker. The DHT sensor would broadcast a signal to the XIAO and when above or below a specific temperature reading, the speaker would react with a “ITS HOT” or “ITS COLD”.

After I ran my weekly feasibility study with Anthony, he advised me that I should look at how I can perhaps simplify the design. I decided to remove the DHT sensor and instead focus on perhaps interfacing a speaker with the XIAO.

He explained that it will not be so simple as to connect a speaker to a microcontroller. Some examples which I found online and had previously worked through describes a functioning system like that.

I was looking at two paths forward. One using a LM4871 Audio Amp (which would be easier to code but harder to manufacture) and the other using a I2S digital amplifier which would be easier to manufacture but harder to code.

These audio systems are deceptively simple looking. Recorded audio files are digital (like mp3 or Wav files) and they are saved withing the microcontroller. This digital data isn’t directly compatible with the analogue speaker and therefore needs some refinement. The I2S peripheral (this is an audio to digital interface built into the XIAO S3) sends the data to the DAC (Digital to Analogue converter). The DAC changes the I2S digital signal coming from the XIAO to an analogue signal. This analogue signal is then amplified in the amplifier, which would then be the LM4871 in this case. The LM4871 transmits this analogue signal to the Speaker which we hear expressed as music.

After my chat with Anthony, I had some general suspicions about the simplicity of this project. I tried to find some tutorials on Xiao ESP32 C3 microcontroller to Audio output projects but struggled to match the specifications completely. I started by asking my friend Chat-GPT what he thought about the feasibility of my project as I started to have doubts about the suitability of the C3. I explained my components and my logic behind using them and it turned out that the C3 doesn’t have I2S capable functionality. I have found that using GPT as an advisor really helps when the TAs aren’t around after office hours.

Matching components which I have at hand and component descriptions from online tutorials is really one of the most frustrating parts of designing PCB and electronics. In the end I didn’t necessarily have a choice as to which of the two paths I mentioned earlier I could take. I took the path which allowed me to proceed the farthest with the components I had on hand.

I was lucky that Chat GPT explained that there are alternative XIAO models, like the S3 which offer the I2S capabilities. The next step was designing a PCB board around the S3 which would function with the LM4871 audio amplifier (the one I found listed in the inventory) and a DAC with I2S capabilities.

I started by experimenting with drawing the schematics on KiCad. In architecture, sometimes, the form follows the function. Similarly, the components followed the signal and ran from the ESP32 S3 to the DAC to the Amplifier to the Speaker. My DAC at this stage didn’t have a WS port and therefore didn’t allow for stereo sound, which wasn’t a problem due to the fact that I was only trying to play a simple recording on the output.

Sometimes you can work around your limitations and other times they prevent you from moving further. Next, I ran into a critical snag when I tried to apply the DAC because it didn’t seem to support I2S. The Local Fab Lab schematics only had DACs for I2C and not I2S conversion and my progress ground to a halt.

The following day I spoke to Anthony about my design and he suggested that I simplify the design to remove the DAC. If I am using an I2S amplifier it is no longer necessary to return the signal to analogue once it is already digital. The amplifier which I specified should incorporate a number of different functions so as to bypass the DACs functionality.