Custom Code - Google Assistant amateur radio


Custom Code - Google Assistant amateur radio simplex/repeater prototype

William VE4VR here. Over the long weekend I finally had a chance to try something I've wanted to do for months - connect Google Assistant/Alexa up to amateur radio (simplex, or repeaters).

This prototype is based on using a fresh IRLP hardware setup with a simplex VHF radio attached. I chose this as the starting point because we have a Linux machine and all the radio/sound working.

Once we have a Linux & radio setup, I created a Google developer account and learned how to build Assistant products (smart speakers) but instead of a speaker integrated it with the IRLP platform.

When a radio user presses A[ssistant] or 0[perator] it calls the Assistant and then listens for voice commands. Google responds and talks to IFTTT for custom questions/responses. Wake words might come later but need to be careful with sharing audio hardware.

Once IFTTT processes a custom command it uses a encrypted web command to talk back to the IRLP box and execute commands such as bringing up links to other IRLP stations. With that foundation in place any customization can be done in a browser.

But that's just the beginning of what can be done. Successful tests with sending emails, texts, adding items to list. Notifying people "tell William to get on the WPG repeater". It's pretty cool.

It's like having a virtual net control operator there all the time that knows how to run the repeater system and can answer any question you can think of. Lots of possibilities for amateur radio applications, next up moving this dev setup to a repeater site.

Thanks for Dan VE4DRK for giving me the IRLP board and saying "learn how setup IRLP". We're going to do some great stuff with this here in VE4-land.

https://aihamradio.blogspot.com/2019/08/google-assistant-amateur-radio.html

This is a stock IRLP simplex node setup - desktop PC, IRLPv3 board, and in this case a Midland commercial VHF radio from the 90s. If you want to build something like this I'd start with a Pi3, USB sound card, and use a GPIO to turn on/off transmit. Using wakewords you don't need any of the IRLP setup at all. You're just building a Google Assistant/Amazon Alexa "product" connected to a radio.

Check out PicoVoice too (https://picovoice.ai/), it's possible to add voice control without Internet access including wakewords and speech-to-intent to a repeater system. That would deliver voice control like what most vehicles have these days. "OK Repeater", "turn on the link to ABC". "[OK]".

voice is going to replace DTMF as the primary control method in the coming years. The recognition accuracy is so good it's doing better than DTMF in my tests. Even a weak RF signal has enough voice bits to get the message across where as DTMF would false and detect the same digit many times.

http://kb9mwr.blogspot.com/2012/02/ham-radio-voice-recognition.html

Dan VE4DRK and myself visited VE4WSC this morning and put the first box into production. If you're around Winnipeg, Canada give it a try on 147.570 MHz simplex with 127.3 CTCSS. Press A or 0 and unkey to get the Assistant. Press B for no prompt. Press C to start conversational mode - you can keep having a PTT conversation with the Assistant for a maximum of 120s (2min).

VE4CNR repeater, 146.76-, IRLP 1504 is our second station setup. New IRLP box with SSD and full duplex Google Assistant support. If you're around Winnipeg, Canada give it a try.

When you build your install, here's the code you need to modify to key the transmitter: self.conversation_stream.stop_recording() os.system('/home/irlp/bin/key') time.sleep(0.5) self.conversation_stream.start_playback() logging.info('Playing assistant response.')


And here's the code change to unkey the transmitter: os.system('/home/irlp/bin/unkey') logging.info('Finished playing assistant response.')


And don't forget to break the keyboard loop in the PTT example, with: if wait_for_user_trigger: # click.pause(info='Press Enter to send a new request...') continue_conversation = assistant.assist() break


And some example custom_decode shell script to wrap it up, along with prompt/tone: #!/bin/bash # Google Assistant Environment cd /home/irlp/ source env/bin/activate # Play Acknowledgement cd /home/irlp/google-assistant/ amixer -q sset 'Line Out' xx% /home/irlp/bin/key /bin/sleep 0.5 /usr/bin/aplay /home/irlp/google-assistant/google-assistant-prompt.wav /home/irlp/bin/unkey alsactl restore # Google Assistant Push-to-talk cd /home/irlp/ amixer -q sset 'Line Out' xx% timeout 120s python -m googlesamples.assistant.grpc.pushtotalk_irlp --project-id YOUR_PROJECT_ID_GOES_HERE --device-model-id YOUR_DEVICE_MODEL_ID_GOES_HERE /home/irlp/bin/unkey alsactl restore



And finally here's the contents of my /home/irlp/custom_decode file after these changes:
#!/bin/bash

# This is the custom decode file. Make sure all valid codes exit with "exit 1".
# To enable the codes below, the "#" must be removed from the start.
# This would allow the node to be disabled with the code 12001
# This would allow the node to be enabled with the code 12002

#if [ "$1" = "12001" ] ; then "$SCRIPT"/disable ; exit 1 ; fi
#if [ "$1" = "12002" ] ; then "$SCRIPT"/enable ; exit 1 ; fi

# Google Assistant
# Default/new user. Plays prompts then listens for one question.
# How to use it: key up, A/0, unkey, key up, question, receive answer
if [ "$1" == "A" ] ; then /home/irlp/google-assistant/ptt_a.sh ; exit 1 ; fi
if [ "$1" == "0" ] ; then /home/irlp/google-assistant/ptt_a.sh ; exit 1 ; fi

# Google Assistant Question
# Advanced user. No prompts. Answers one question.
# How to use it: key up, B, unkey, key up, question, receive answer
if [ "$1" == "B" ] ; then /home/irlp/google-assistant/ptt_q.sh ; exit 1 ; fi

# Google Assistant Conversation
# Advanced user. No prompts. Conversation mode.
# How to use it: key up, C, unkey, key up, question, receive answer, key up ..
if [ "$1" == "C" ] ; then /home/irlp/google-assistant/ptt_c.sh ; exit 1 ; fi

exit 0



This is worth a look: https://github.com/Picovoice/rhino/blob/master/README.md

Looked at other technical options - Allstar using the DMK URI and Asterisk, Alexa etc. I think what you see here is going to be the best version of this type of integration - until I learn otherwise. Going to work on making this into an installer for IRLP systems so it's just a few seconds and done.


William Franzin VE4VR
@WillianFranzin
VE4VR
https://www.qrz.com/db/VE4VR
wfranzin gmail com



Follow me :     FORMATTING THE INFORMATION AND THIS BLOG
Andre Van.ier



Also working on a project just like this a few months ago and I will like to bounce some ideas off of you if you want. Please shoot me an email at KN4AWW-gmail-com.