Things used in this project

Hardware components:
Pi 3 02
Raspberry Pi 3 Model B
×1
Adafruit usb speaker
×1
usb microphone
×1
08377 02 l
Resistor 330 ohm
×1
09590 01
LED (generic)
×1
Software apps and online services:
raspbian
Logo assistant kvfq4j72g6 yciz8pmvwr
Google Assistant SDK

Code

hotword.py.patchDiff
Used to patch hotword.py to control the LED via the GPIO pins.
--- hotword.py.old	2017-08-04 19:16:18.699604629 +1000
+++ hotword.py	2017-07-02 00:56:30.749997722 +1000
@@ -27,6 +27,12 @@
 from google.assistant.library.event import EventType
 from google.assistant.library.file_helpers import existing_file
 
+import RPi.GPIO as GPIO
+import time
+GPIO.setmode(GPIO.BCM)
+GPIO.setwarnings(False)
+GPIO.setup(18,GPIO.OUT)
+
 
 def process_event(event):
     """Pretty prints events.
@@ -39,12 +45,18 @@
     """
     if event.type == EventType.ON_CONVERSATION_TURN_STARTED:
         print()
+        GPIO.setup(18,GPIO.OUT)
+        print("LED on")
+        GPIO.output(18,GPIO.HIGH)
+        
 
     print(event)
 
     if (event.type == EventType.ON_CONVERSATION_TURN_FINISHED and
             event.args and not event.args['with_follow_on_turn']):
         print()
+        print("LED off")
+        GPIO.output(18,GPIO.LOW)
 
 
 def main():

Credits

Youutbeiconfix2 flqqgju0oc
Andrew Jones
1 project • 17 followers
Maker, youtuber and woodworker
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog