Close

Do The Fandango

A project log for VoiceBox

Adding a Flask web interface (and other stuff) to the Google AIY Voice Kit.

tmTM 08/07/2018 at 21:530 Comments

Probably the easiest way to get into the functionality of VoiceBox.py is to look at the cooling fan. A bit of background first, having printed the first version of the enclosure and running Blinkter (which chews a lot of CPU) without a heat-sink on the Pi's SoC, I was getting intermittent black screens.

It turned out that the black screens were mainly due to the crappy swivel HMDI to DVI converter that I was using, but before biting the bullet and buying an HDMI to DVI cable, I first added a heatsink:

and ordered some cooling fans from DealExtreme:

The fan is a 30mmx30mm 5V unit, connected to DRIVER2+, the buffered 5V VoiceHat output driven by GPIO27. (See "A Note on Wiring" below.)

The code is very straight-forward, in process_event(), 

    elif event.type == EventType.ON_RECOGNIZING_SPEECH_FINISHED and event.args:
        ...if 'fan on' in text or 'cooling on' in text:
            fan('on')
        elif 'fan off' in text or 'cooling off' in text:
            fan('off')

where fan() is

def fan(action, quiet=False):
    GPIO.output(COOLING_FAN, GPIO.HIGH if action == 'on' else GPIO.LOW)
    if not quiet:
        assistant.stop_conversation()
        aiy.audio.say('Cooling fan '+action+'.')

 So, if the user says "Hey Google, Cooling fan off", GPIO27 will be set to LOW. (I added the word "cooling" as Google really struggled to recognize the word "fan" out of context.)

As we saw in the previous log ("Double-Tap"), the fan can also be turned off by pressing the button twice within 1 second.

A third method for controlling the fan is via the GPIO page of piHole (see screenshot in "A New Home For piHole").

By default, the rear face of the enclosure is printed to mount the fan in "suck" mode: sucking hot air out of the upper part of the box, to be replaced by cold air drawn in at the connection holes.  (See enclosure log entry.) With the fan running, the CPU temperature drops from circa 60ºC to circa 40ºC. Unfortunately, the fan noise makes Google's voice recognition less effective, so the fan is probably most useful when using the Pi with a keyboard.

Discussions