Raspberry Pi AI Assistant

Raspberry Pi AI Assistant

1 Raspberry Pi AI Assistant Cole Tharaldson Department of Computer Science, Minnesota State University Moorhead CSIS 492: Senior Seminar Dr. Andrew Chen May 4, 2020 2 Abstract Artificial Intelligence (AI) assistants are nearly everywhere you look in today’s society. With the use of a Raspberry Pi computer and the Google Application Programming Interface (API), an AI assistant can be created. Much like Google Home, this AI assistant can help people with everyday tasks, such as handling requests, controlling smart devices, answering questions, or even telling jokes. 3 Artificial Intelligence is a rapidly growing subclass of Computer Science that “makes it possible for machines to learn from experience, adjust to new inputs, and perform human-like tasks” (“Artificial Intelligence – What It Is and Why It Matters.”). The code and programs that make up Artificial Intelligence are based on human neural networks. By putting these programs and machines together, useful technology can be created to help out in our everyday lives. In the case of my Senior project, I used a Raspberry Pi for the “machine” and the Google Assistant API (Application Programming Interface) as the “program.” A Raspberry Pi is a credit card sized CPU (Central Processing Unit) with a Linux based operating system. Specifically, I used the Raspberry Pi 4 with 4 GB of RAM (Random Access Memory) and a 32 GB Micro SD card along with a USB microphone and USB speakers. In order to obtain the Google Assistant API, I had to first visit https://console.actions.google.com and start a “New Project.” Next, I followed the steps to register the model of my device. Then, I received and downloaded the “OAuth 2.0 Credentials” for my Raspberry Pi. Finally, I activated the activity controls needed for my AI assistant. These crucial steps allowed my Raspberry Pi to be authorized for the use of the Google Assistant API. Once the authorization was complete, I hooked my Raspberry Pi up to my monitor in order to start the configuration process. The terminal commands “arecord -l” and “aplay -l” were used to obtain the card and device numbers assigned to the microphone and speakers. Once these were obtained, I created a “.asoundrc” file in the “/home/pi/” directory in order to put these numbers to use (Figure 1). 4 pcm.!default { type asym capture.pcm "mic" playback.pcm "speaker" } pcm.mic { type plug slave { pcm "hw:<card number>,<device number>" } } pcm.speaker { type plug slave { pcm "hw:<card number>,<device number>" } } Figure 1. (“Building Your Own Raspberry Pi Google Assistant.”) This allowed the Raspberry Pi to use the correct input and output devices needed for my AI assistant to work properly. Next, a “googleassistant” directory was needed in order to store the OAuth 2.0 Credentials in a .json format. Then, I installed the Python 3 Virtual Environment, which needed to be activated in order to install and authenticate the Google Assistant Library. This was accomplished by using the “pip” and “setuptools” packages. More specifically, the “google- oauthlib-tool” generated a URL used to obtain an authentication code that links and saves your Google Credentials on your Raspberry Pi. The last part of the configuration required a lengthy command that brought the Raspberry Pi AI Assistant to life. This command was as follows: “googlesamples-assistant-pushtotalk –project-id <projectid> --device-model-id <deviceid>” (“Building Your Own Raspberry Pi Google Assistant.”). Then, by pressing “Enter,” the assistant was able to listen for voice commands through the USB microphone. Once the Raspberry Pi AI Assistant was activated, next came the execution. This process was a lot simpler in that it only requires a couple commands to get the assistant up and running. 5 Opening a new terminal window and using the command “source env/bin/activate” got the Python 3 Environment back up and running. Then, the command “googlesamples-assistant-pushtotalk,” a shortened version of the one used in the configuration process, was used to finally execute the Raspberry Pi AI Assistant which was now able to accept tasks. In conclusion, the Raspberry Pi can be used to create many different useful technologies. And most of all, it can be a very educational tool for people experimenting with things pertaining to Computer Science. In my case, I used multiple different sources in order to further educate myself on the topic of Artificial Intelligence and to also help me learn how to use my Raspberry Pi in order to create my own Google Home, which I refer to as my Raspberry Pi AI Assistant. 6 References Gus. “Building Your Own Raspberry Pi Google Assistant.” Pi My Life Up, 10 July 2019, pimylifeup.com/raspberry-pi-google-assistant/. Guillaume. “List of Personal Assistant Projects.” List of Personal Assistant Project - Raspberry Pi Forums, 2015, www.raspberrypi.org/forums/viewtopic.php?t=186114. Heath, Nick. “Raspberry Pi Add-on Lets You Build Your Own AI Assistant Powered by Amazon, Google and Microsoft.” TechRepublic, TechRepublic, 25 Aug. 2017, www.techrepublic.com/article/raspberry-pi-add-on-board-lets-you-build-your-own-ai- assistant-powered-by-amazon-google-and/. Heath, Nick. “Pi Home, a Raspberry Powered Virtual Assistant.” Instructables, Instructables, 16 Mar. 2019, www.instructables.com/id/Pi-Home-a-Raspberry-Powered-Virtual-Assistant/. Shankar, Ravi. “DIY Google AI Assistant Using A Raspberry Pi.” C# Corner, 2019, www.c- sharpcorner.com/article/diy-google-ai-assistant-using-a-raspberry-pi2/. Youngblood, Tim. “The Open-Source Google Assistant Joins the Raspberry Pi AI Movement - News.” All About Circuits, 2017, www.allaboutcircuits.com/news/the-open-source- google-assistant-joins-the-raspberry-pi-ai-movement/. Adhikari, Richard. “Raspberry Pi Fans Can Build Their Own AI Voice Assistant.” LinuxInsider.com, 2017, www.linuxinsider.com/story/84517.html. “What Is Artificial Intelligence? How Does AI Work?: Built In.” What Is Artificial Intelligence? How Does AI Work? | Built In, 2020, builtin.com/artificial-intelligence. Rohde, Klaus, et al. “Benefits & Risks of Artificial Intelligence.” Future of Life Institute, 2019, futureoflife.org/background/benefits-risks-of-artificial-intelligence/?cn-reloaded=1. 7 “Artificial Intelligence – What It Is and Why It Matters.” SAS, 2020, www.sas.com/en_us/insights/analytics/what-is-artificial-intelligence.html. West, Darrell M. “What Is Artificial Intelligence?” Brookings, Brookings, 25 Oct. 2019, www.brookings.edu/research/what-is-artificial-intelligence/. Frankenfield, Jake. “How Artificial Intelligence Works.” Investopedia, Investopedia, 29 Jan. 2020, www.investopedia.com/terms/a/artificial-intelligence-ai.asp. .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us