Simple DIY Electronic Music Projects<p>Someone asked on the MiniDexed forums if the Google/Raspberry Pi AIY Voice HAT could be used with MiniDexed. This reminded me that I had V1 of the kit tucked away in a corner somewhere, so decided to finally take a look at it!</p><p><em><strong>Warning!</strong> I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!</em></p><p>If you are new to microcontrollers and single board computers, see the <a href="https://diyelectromusic.wordpress.com/getting-started/" rel="nofollow noopener noreferrer" target="_blank">Getting Started</a> pages.</p><p><strong>Parts list</strong></p><ul><li>Raspberry Pi 3</li><li>AIY VoiceKit</li><li>USB MIDI Controller</li></ul><p><strong>AIY Voice HAT</strong></p><p>The core project information can be found here:</p><ul><li><a href="https://aiyprojects.withgoogle.com/voice-v1" rel="nofollow noopener noreferrer" target="_blank">https://aiyprojects.withgoogle.com/voice-v1</a></li><li><a href="https://pinout.xyz/pinout/voice_hat" rel="nofollow noopener noreferrer" target="_blank">https://pinout.xyz/pinout/voice_hat</a></li><li><a href="https://github.com/google/aiyprojects-raspbian/tree/aiyprojects" rel="nofollow noopener noreferrer" target="_blank">https://github.com/google/aiyprojects-raspbian/tree/aiyprojects</a></li></ul><p>And here are some additional sources of information:</p><ul><li><a href="https://dronebotworkshop.com/hacking-google-aiy-voice-kit-part-1/" rel="nofollow noopener noreferrer" target="_blank">https://dronebotworkshop.com/hacking-google-aiy-voice-kit-part-1/</a></li><li><a href="https://community.element14.com/products/raspberry-pi/b/blog/posts/google-s-alexa-like-pi-aiy-kit-mini-teardown" rel="nofollow noopener noreferrer" target="_blank">https://community.element14.com/products/raspberry-pi/b/blog/posts/google-s-alexa-like-pi-aiy-kit-mini-teardown</a></li></ul><p>The Google-designed AIY Voice HAT is an add-on board designed for use with a Raspberry Pi 3 to provide audio input and output, with breakout connections for I2S, SPI, servos and motor drivers. Audio input is provided via two MEMS microphones that stream I2S directly into the Pi and audio output is provided by a MAX98357A – a “Tiny, Low-Cost, PCM Class D Amplifier with Class AB Performance” according to the datasheet.</p><p>This is the same device used on the <a href="https://www.adafruit.com/product/3006" rel="nofollow noopener noreferrer" target="_blank">“Adafruit I2S 3W Class D Amplifier Breakout – MAX98357A”</a> and in fact, if you look at the schematic for the voice HAT there is an interesting section that seems to imply that one of the Adafruit modules can be added to provide a second channel output for full stereo operation.</p><p>And it can be seen that there is a row of 7 unmarked pin header holes that when paired with a couple of additional holes the other side of the onboard MAX98357A, looks suspiciously like the pin footprint of the Adafruit board.</p><p>And sure enough, in the guide it does suggest adding that module to give a right channel output (<a href="https://aiyprojects.withgoogle.com/voice-v1/#makers-guide--gpio-pinout-and-expansions" rel="nofollow noopener noreferrer" target="_blank">see more here</a>).</p><p><strong>Audio on the AIY Voice HAT</strong></p><p>In terms of GPIO interface, the full details can be found at <a href="https://pinout.xyz/pinout/voice_hat" rel="nofollow noopener noreferrer" target="_blank">pinout.xyz here</a> and in the <a href="https://aiyprojects.withgoogle.com/voice-v1/#makers-guide--gpio-pinout-and-expansions" rel="nofollow noopener noreferrer" target="_blank">AIY Voice datasheet</a>, but the relevant ones for audio output are as follows:</p>Physical PinGPIOFunction25V Power6GND1218I2S Clock3519I2S WS3616Amp Shutdown3820I2S Data IN4021I2S Data OUT<p>These are standard power and I2S (PCM) audio connections, apart from GPIO16 “Amp Shutdown”. This is connected to “SD_Mode” of the MAX98357A (see above schematic section). The datasheet tells us that driving this LOW will put the amp into shutdown. But it also says it is responsible for selecting the mode of the amplifier, depending on the resistor used to drive SD_Mode HIGH. Example resistor values are provided for 1.8V and 3.3V operation:</p><p>There is a solder jumper on the board that changes the resistances to enable stereo mode – i.e. L channel goes to the onboard MAX98357A and R channel goes to the Adafruit add-on module.</p><p>For operation with MiniDexed, this pin just has to be held HIGH to 3.3V.</p><p>Also, of course, MiniDexed has no audio input, so GPIO20 (pin 38) just has to remain unused.</p><p><strong>AIY Voice HAT Other Pins</strong></p><p>Key additional functions for a MiniDexed would typically be:</p><ul><li>Serial MIDI interface via the UART (RX/TX).</li><li>Display either via direct GPIO or over I2C.</li><li>Button inputs.</li><li>Rotary encoder.</li></ul><p>In terms of the AIY Voice HAT, there are breakouts for I2C, SPI and then bespoke output driver connections for servos or motors. The button header includes outputs for a LED and an input for a button switch (which is also duplicated by the on-board button).</p><p>This means the following GPIO pins are easily available for MiniDexed purposes:</p>GPIOTypical AIY UsePossible MiniDexed Use2I2C headerI2C SDA for display3I2C headerI2C SCK for display7SPI headerGeneral IO8SPI headerGeneral IO9SPI headerGeneral IO10SPI headerGeneral IO14TXD headerTX for MIDI15RXD headerRX for MIDI22SPI headerGeneral IO23ButtonButton Input<p>All other GPIO pins include electronic circuitry as part of the AIY HAT which means it would be somewhat problematic to use for other purposes.</p><p><strong>Use with MiniDexed</strong></p><p>So for basic audio output it is possible to use the AIY Voice HAT with MiniDexed provided that GPIO 16 (Amp Shutdown) can be set HIGH.</p><p>Thankfully the Raspberry Pi has the config.txt file which is read and processed on startup before any operating system runs and this has the ability to preset GPIO pins to a defined state.</p><p>To use the AIY Voice HAT with MiniDexed therefore requires the following configuration.</p><p>In MiniDexed.ini, configure sound output to be I2S:</p><pre>SoundDevice=i2s</pre><p>In config.txt, preset GPIO 16 to be HIGH:</p><pre>gpio=16=op,dh</pre><p>Then be sure to check that any other GPIO uses in minidexed.ini do not conflict with any of the GPIO pins used by the AIY Voice HAT.</p><p>Then it is just a case of connect up the speaker, plug in a USB MIDI controller, and it just works.</p><p><a href="https://makertube.net/w/hu8qmtHg4xQY1khWfGvFdE" rel="nofollow noopener noreferrer" target="_blank">https://makertube.net/w/hu8qmtHg4xQY1khWfGvFdE</a></p><p><strong>Closing Thoughts</strong></p><p>Apparently these HATs can be bought quite cheaply these days, and I suppose if you have one lying around already (that you got a number of years ago off a magazine!) then it is an easy source of an I2S DAC.</p><p>But really, it isn’t easy to build out the other MiniDexed interface components to make a fully functional system, so I’d probably say save you AIY HAT for some neat robotics applications and just get a GY-PCM5102 module.</p><p>But if you want to get on an use the AIY Voice HAT as your sound output for a MiniDexed, then yes. It works. And so would the Adafruit MAX98357A breakout.</p><p>Kevin</p><p><a href="https://diyelectromusic.com/2024/10/12/aiy-voice-hat-and-minidexed/" class="" rel="nofollow noopener noreferrer" target="_blank">https://diyelectromusic.com/2024/10/12/aiy-voice-hat-and-minidexed/</a></p><p><a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/aiy-voice-hat/" target="_blank">#aiyVoiceHat</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/max98357a/" target="_blank">#MAX98357A</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://diyelectromusic.com/tag/minidexed/" target="_blank">#minidexed</a></p>