HOW TO develop YOUR own GOOGLE AIY WITHOUT THE set

author
11 minutes, 17 seconds Read

Google’s voice assistant has been around for a while now as well as when Amazon released its Alexa API as well as ported the PaaS Cloud code to the Raspberry Pi 2 it was just a matter of time before everybody else jumped on the quick train to maker kingdom. Google just did it in style.

Few understand that the Google assistant API for the Raspberry Pi 3 has been available for a long time now however when they decided to provide away a free set with the may 2017 problems of MagPi magazine, they made an perception on everyone. unfortunately the world has more makers as well as hackers as well as the number of copies of the magazine are limited.

In this writeup, I design the diy version of the AIY set for everybody else who wishes to talk to a cardboard box. I take a better look at the free kit, take it apart, put it together as well as replace it with diy magic. To make things more convenient, I likewise designed an enclosure that you can 3D print to total the kit. Začněme.

The Teardown

A shout out to my buddy [Shabaz] in the UK for sending me a copy of the MagPi. The “Google AIY jobs Voice Kit”(henceforth understood as the kit) contains two PCBs as well as a lot of other stuff. The Voice HAT which appears like a Sound-Card-On-A-Diet has extremely restricted number of components. I will detail each section as well as draw the KiCAD schematic for the exact same one by one

Servos

Starting from the left side, there are 6 sets of 3-pin headers that are labelled ‘Servos’. The meant servo manage is made possible utilizing the Raspberry Pi 3’s on-board PWM module. Each set has a GPIO pin, 5V as well as GND connection. The GPIO pin does not link directly to the Raspberry Pi 3’s header however rather with 220Ohm present limiting resistors (labelled R1-R6).

Zdroj napájení

Just south of these are gadgets identified Q5 as well as Q6 which I am presuming are part of a power supply choice circuit. correct me if I am wrong however right here is my estimate. The working is simple where Q5 only turns ON when the input voltage is higher than the 5V from the USB port. A simple comparator should do so I am utilizing the LM393 for reference.

EDIT: [Raivsr] explained that this might be the equivalent of the Raspberry Pi ‘Ideal Diode’.

Communication Interfaces

North of the ‘Servo’ headers is J15 labelled I2C that directly link to the Raspberry Pi 3 header. That means these should not be linked to anything with 5V pull-ups. They are not being utilized on the board however we will discuss more on this later. right next to it is the SPI as well as 2-pin UART headers. once again these link directly to the primary header as well as serve only as a breakout.

The DAC as well as EEPROM

A bit lower as well as we show up at the boxed circuit with a 16-Pin QFN marked ‘AKK BDQ’. This is the Maxim MAX98357A(PDF) which is an I2S DAC with a class D amplifier. It drives the speaker directly nevertheless since there is only one output, it can only be mono or integrated stereo. It’s still pretty rocking for the budget.

The fascinating thing is the existence of JP6 which seems to have all the I2S connections from the Maxim MAX98357A as well as a few other choose lines. integrated with the two vias that link to the second speaker output, you might potentially in shape one more Maxim MAX98357A breakout board on top to get stereo sound. I am going to do the schematic as well as make it downloadable as well as if you want to provide it a shot let me understand the results. think about it optional homework.

Next to the DAC is an 8-pin SSOP which is a 24C32 (PDF) I2C EEPROM. It’s not linked to the I2C header I talked about earlier however rather to pins 27 as well as 28 of the Raspberry Pi 3 header. According to the Raspberry Pi Foundation’s blog.

“The EEPROM holds the board manufacturer information, GPIO configuration as well as a thing called a ‘device tree‘ fragment – basically a description of the connected hardware that enables Linux to immediately tons the needed drivers.”

So its got some additional sauce that makes things tick as well as I might utilize a BusPirate to Dump the data however I am not sure if Google considers it Intellectual residential or commercial property so I won’t. I have an alternate for it also so checked out on.

Řidiči

Moving towards the right, we discover 4 headers marked ‘Drivers’. These are MOSFET circuits for controlling tons such as relays. [Shabaz] did a fantastic task tracing out the elements on this as well as the 3 pins are GPIO, 5V as well as Driver.

The MOSFETs can drive tons of as much as 500mA each thanks to a polyswitch nevertheless the GPIOs are offered for utilize directly as well. tons to be driven should be linked between the pins marked ‘+’ as well as ‘-‘. The header pin on the left is a direct gain access to to GPIOs header pins from the Raspberry Pi 3 as well as the schematic shows the same.

Use these to link LEDs or similar gadgets to suggest the operation of the relays or loads.

Microphone as well as Button Connectors

More fascinating stuff is happening on the right side’s upper right with a push button as well as two JST connectors. The 4 pin connector is meant for the push button that sits on top of the assembled enclosure. The little PCB mounted push button is wired in parallel with the outside switch as well as can be utilized in its location while setting up as well as testing. The 5 pin JST is for the microphone connector as well as has all the I2S pins.

The Microphones

Lastly, the microphone board is marked 432 QDF21G, as well as has Knowles SPH0645LM4H MEMs digital microphones that talk I2S directly.

A je to!

That about wraps up the teardown as well as all the info needed to make your own AIY Kit. The KiCAD schematic data are offered for download from GitHub nevertheless I leave you with the fun part which is the design as well as routing.

Here is some food for thought. Some parts can be omitted as well as the size of the hat can be shrunk down to the Pi Zero pHat.

For simplicity reasons, I am utilizing the preconfigured OS picture from the Google AIY page. It is a tad short of 900MB as well as can be downloaded directly from Goolge (huge file).

Add A Shutdown Button

You most likely noticed the little golden button next to the huge eco-friendly button in the picture above as well as that is the very first part of the exercise. It is a shutdown button as well as is added since I don’t want to SSH to the box every time I want to turn it off safely.

Get the button you want to utilize as well as add two wires with female headers. This bit works even without the Voice Hat so feel free to try it out. next if you have a voice hat, add male headers to the I2C part. You may select any type of other pins as well as it will still work. link the button to the SDA or GPIO 2 as well as boot the Pi 3 up.

Open up your favourite text editor as well as copy-paste the complying with code into it.

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/python
# simple script for shutting down the raspberry Pi at the press of a button.
# by Inderpreet Singh

import RPi.GPIO as GPIO
import time
import os

# utilize the Broadcom SOC Pin numbers
# configuration the Pin with interior pullups enabled as well as PIN in reading mode.
GPIO.setmode(GPIO.BCM)
GPIO.setup(02, GPIO.IN, pull_up_down = GPIO.PUD_UP)

# Our function on what to do when the button is pressed
def Shutdown(channel):
    os.system("sudo shutdown -h now")

# add our function to execute when the button pressed event happens
GPIO.add_event_detect(02, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)

# now wait!
while 1:
    time.sleep(1)

Save the data in your /home/pi folder as shutdown.py

In a terminal type the complying with commands

1.
chmod +x shutdown.py python shutdown.py &

This should make the script run in the background. If you press the button, the Pi should shutdown immediately. You may select to add a delay by uncommenting the sleep phone call in the example code. Alternatively, you may likewise modification the GPIO by replacing the appropriate number in the python script.

Chladný! now we can shutdown by pressing a button.

Add a USB noise Card

The obvious alternate to the Google AIY Voice Hat is to utilize any type of USB noise Cards that are offered from a number of sources. The easiest method is to just plug one in as well as configure the software application to utilize that instead of the Hat however when there two drivers installed, the python scripts requirement to be reconfigured to make whatever seamless.

Once you plug in the soundcard, the very first thing to do is inspect if it was acknowledged or not. In the terminal window, type in:

1.
aplay – l

‘aplay’ is utilized by the scripts to speak out the replies so you should be able to see two noise devices. note that the onboard noise has been disabled from within the config.txt (see gadget tree reference) and can be enabled if you plan to utilize a USB microphone instead of the noise card. The windows output should look like the picture below.

I would like to set the USB noise card as the default audio, as well as for that we requirement to customize the /etc/asound.conf .

1.
sudo nano /etc/asound.conf

Delete the existing material as well as replace it with text as shown below. though this sets the default input as well as output gadget to the USB device, there is one more step to make things work. (To exit nano, utilize Ctrl+x, y, return)

Next we edit to audio.py data that handles all the audio playing as well as recording functionality. For that, open up the data in your favourite text editor; mine is nano:

1.
sudo nano /home/pi/voice-recognizer-raspi/src/audio.py

Scroll down to the part thatStavy ‘Arecord’, který je ve funkci __init__. Je zřejmé, že je oddaný proces, který udržuje rekordér běží, jak se ukáže ve videu. Nyní chceme upravit argumenty, abyste zajistili, že využívá USB kartu k zachycení zvuku místo původního hlasového klobouku. Jednoduchá nastavení pro využití ‘-D’, ‘sysdefault: karta = 1’ by měla stačit, jak je zobrazeno na obrázku níže.

Podobná modifikace je potřeba pro funkci APLAY o něco dále v kódu.

S tím je hack dokončen! Dvakrát klikněte na ‘test_audio.py’ pro kontrolu, pokud audio funguje. Chybí nám jen jednu část puzzle – tlačítko “Poslouchat”! Takže jen kabel push tlačítka mezi GPIO23, stejně jako sousední zemníček, stejně jako pak spusťte ‘SRC / MAIN.PY’ začít hrát s DIY Google AIY.

Demo.

Malý video demo navrhovaného hack s USB šumu, mimo reproduktor, stejně jako levný mikrofon.

Krytu

3D tištěný kryt je navržen ve fúzi360, stejně jako data STL jsou součástí úložiště GitHub. Můžete využít přesně stejný kryt pro řadu pracovních míst, protože tam jsou stoupání pro malinové pi, stejně jako porty jsou vyvodeny pro pohodlí. Tam je velká oblast uvnitř přidání klobouků, stejně jako další obvody.

Udělal jsem krytu rozdělit ze středu, aby bylo zajištěno, že se stane jednoduchým přístupem k GPIOS. Celá věc bude tlačit ve tvaru, včetně horní víčko, které má otvory pro tři tlačítka. I přestože by mělo mít smysl mít menší knoflíky, protože se očekává, že výsledek bude tvrdší než lepenka. Existuje dostatek prostoru pro reproduktor, který byste měli vybrat, abyste zahrnuli jeden, který je poněkud odlišný.

Neměl jsem možnost tisknout jeden, stejně jako aktualizovat tuto stránku, když je v tomto tématu nějaký typ vývoje. Právě tady je vykreslení designu.

souhrn

Společnost Google již měl API k dispozici veřejnosti, nicméně předkonfigurovaný Raspbický obraz bude pomáhat velkému množství lidí, kteří by mohli začít. Snažil jsem se navrhnout základy šumové karty kromě toho, abyste poskytli plány na ekvivalentní kartu, pokud chcete udělat jeden. Pro ostatní je vysvětlena volba k využití vnějšího šumu kartu, stejně jako prokázáno, stejně jako doufám, že ovlivňuje lidi, aby se skutečně dostali do těchto projektů. Svět potřebuje více AIY, stejně jako právě tady je vaše možnost začít, takže co čekáte? Získejte hacking.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *