Skip to content

Instantly share code, notes, and snippets.

@kuri65536
Last active May 26, 2018 14:33
Show Gist options
  • Save kuri65536/221bb68e1bcdb4c22b1e2da627e460f4 to your computer and use it in GitHub Desktop.
Save kuri65536/221bb68e1bcdb4c22b1e2da627e460f4 to your computer and use it in GitHub Desktop.
Google AIY without HAT and its setup

[toc]

Google AIY without HAT and its setup

I made the Google AIY voice kit without HAT. Thanks to great Hackaday article !

However some of the files are changed from 17/05/30. Some steps were changed from hackaday article and I changed the few things.

I tried AIY at 18/01/24 with newer image 2018/01/03

Current image

current photo of my AIY

Hardware setup

  • Append USB Sound adapter
  • Connect Microphone to adapter
  • Connect Speaker to adapter
  • (Under construction) audio amplifier
  • (Under construction) mic and amplifier

Append button switch to GPIO23

  • standard: GPIO23 - button - GND

Append LED to ... (Under construction)

  • (Under testing) standard(Optional): GPIO?? - res - LED - GND

Sound configuration

Disable RasPi I2S and change to USB Audio as ALSA-#0

append a blacklist and a option then reboot.

blacklist snd_soc_bcm2835_i2s
options snd_usb_audio index=0

Configure alsa sound

make default hw to plugin device, I really don't know alsa settings.

pcm.!default plughw:Device
ctl.!default plughw:Device

Confirm

you can confirm it by aplay /usr/share/sounds/alsa/Front_Center.wav too. you might be got the error like invalid sample rate or channels if you were wrong the settings.

Hack AIY some scripts

  • change I2S to USB audio, override the alsa parameters to point the USB audio
    def __init__(self, output_device='default'):
        output_device = "plughw:0,0"
        self._output_device = output_device
    def __init__(self, input_device='default',
                 channels=1, bytes_per_sample=2, sample_rate_hz=16000):
        """Create a Recorder with the given audio format.
        ...
        """
        input_device = "plughw:0,0"

Confirm

run check_audio.py.

Update sdk

  • for Register AIY kit to Google Assistant API, you must update the SDK.

(Optional) Free diskspace

  • I tried to use 4GB SD card for AIY kit, but there was no diskspace.
  • remove these packages and got 300MB.
$ sudo apt remove minecraft-pi   # ... about 5M
$ sudo apt remove libreoffice*   # ... about 200M
$ sudo apt remove geany*         # ... about 1M
$ sudo apt remove claws-mail*    # ... about 1M
$ sudo apt remove python-thonny  # ... about 1M
$ sudo apt autoremove

upgrade packages

$ pip install --upgrade google-assistant-library

Confirm

$ googlesamples-assistant-devicetool

Register a device

  • create new application on Google Client

see SDK document

  • Enable Google Assistant API.
  • Register AIY kit to Google Assistant API.
$ googlesamples-assistant-devicetool register-model --manufacturer "Assistant-SDK-developer" \
          --product-name "Assistant-SDK-light" --type light --model [your-model-name]
$ googlesamples-assistant-devicetool list --model  # confirm and get project_id from it.

Launch

$ googlesample-assistant-hotword --device_model_id [your-model-name] \
    --project_id [your-project-id]

(Optional) Extra Hacking

  • o Bootup voice --- too mechanical voice, change to play a fanfire.
  • ignoring pop noise from speaker at bootup
  • LEDx8
  • Swtich x4
  • USB-HDD x2 and build NAS and mirroring

circuit (not included raspi USB)

Casing

case image 1

USB-HDD

  • install hd_idle for WD devices.
  • to spin down the WD HDD, run hd-idle -t disk/by-uuid/... (remove /dev from path)

Power Consumption

AIY is always turn-on in usual situation. So I measure some conditions with my watt meter.

Condition avg. max(W)
RasPi3 2.0 2.7
RasPi3 + HDMI + USB Keyboard(Dongle) 2.0 2.7
RasPi3 + Assistant launched --- ---
RasPi3 + Assistant + HDDx2 --- ---
RasPi3 + Assistant + HDDx2 (spin down) --- ---
RasPi3 + USB-HDD 11.0 11.5
RasPi3 + USB-HDD (spin down) 4.3 4.8
RasPi3 + USB-HDD (spin down) + Assist 4.7 5.7
RasPi3 + USB-HDD (slow) 7.5 7.8
RasPi3 + USB-HDD (spin up) 14.0 14.0
RasPi3 + USB-HDDx2 (spin up)

Don't worry, AIY does not spend the power too much! Enjoy use AIY.

History

3.

current photo of my AIY

2. append D-class amp and microphone

current photo of my AIY

1. Parts

current photo of my AIY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment