Book Image

Learn Robotics Programming

By : Danny Staple
Book Image

Learn Robotics Programming

By: Danny Staple

Overview of this book

We live in an age where the most difficult human tasks are now automated. Smart and intelligent robots, which will perform different tasks precisely and efficiently, are the requirement of the hour. A combination of Raspberry Pi and Python works perfectly when making these kinds of robots. Learn Robotics Programming starts by introducing you to the basic structure of a robot, along with how to plan, build, and program it. As you make your way through the book, you will gradually progress to adding different outputs and sensors, learning new building skills, and writing code for interesting behaviors with sensors. You’ll also be able to update your robot, and set up web, phone, and Wi-Fi connectivity in order to control it. By the end of the book, you will have built a clever robot that can perform basic artificial intelligence (AI) operations.
Table of Contents (21 chapters)

Adding sound input and output to the Raspberry Pi

Before we can use a voice processing/voice assistant, we need to get the basic setup of giving the Raspberry Pi some speakers and a microphone. At the time of writing, there are a number of Raspberry Pi add-ons that can provide this. One simple one, with a microphone array (for better recognition) and a connection to speakers is the Seeed Studio Respeaker 2 HAT, which is widely available.

We will be creating a separate voice assistant board that will communicate with our robot, but we won't be putting it directly on the robot. This is for a few good reasons:

  • Noise: A robot with motors will be a noisy environment. Having a microphone anywhere near the motors will make it close to useless.
  • Power: The voice assistant is listening constantly. The robot has enough demands for power already with the other sensors that are running...