How to Turn a Rotary Phone into Google Assistant with Raspberry Pi – Tom’s Hardware

Posted: May 3, 2021 at 6:54 am

I have some old telephones lying around - few of them fully functional anymore. I was going to throw out one of them when I realized I could replace the inner wiring with a Raspberry Pi, and have the Google Assistant running on it.

While its certainly easier to call hey google across the room, theres something fun about picking up the phone, asking it a question, and having it immediately respond. This is how to install the Google Assistant on an old rotary telephone with a Raspberry Pi Zero.

This Raspberry Pi project is quite extensive and can take a bit of time, so Ive split it up into four distinct parts:

Before we use a Raspberry Pi as a Google Assistant, we must register the device with Google. This process can be a bit confusing if youve never used Google Cloud Platform before, but the steps should be easy enough to follow.

1. Clone this repository to your raspberry pi.

2. Navigate to https://console.actions.google.com in your browser. This site allows us to manage Google Assistant Actions, as well as register custom Google Assistant devices.

3. Click New Project and fill in the required information. The name doesnt matter - just pick something you can remember.

4. In a new tab, visit this link to Google Cloud Platform, and confirm that the name of the project you just created appears in the top bar - if not, select it. Then, click the Enable button to turn on the API.

5. In your original tab, scroll to the bottom of the page and click Are you looking for device registration? Click here

6. On the next page, click Register Model.

7. Fill in the required information and copy down the Model ID to file - you will need it later.

8. Click Download OAuth 2.0 credentials to download the credentials file your Raspberry Pi will use to make requests.

9. Rename the downloaded file to oauth_config_credentials.json and transfer it to your pi. Place it into the repository folder you cloned in step 1.

10. Back in the browser, after downloading and renaming the credentials, click the Next button.

11. On the Specify traits tab, click Save Traits without adjusting any settings to complete the setup.

Weve now registered a device with Google. Next, its time to authenticate this device so it has access to our Google account and personalized assistant.

1. Navigate to https://console.cloud.google.com/apis/credentials/consent ensuring that the project matches the name you decided in Step 3 of Registering With Google.

2. Select External and click the Create button.

3. Fill in an App name. Once again, this doesnt really matter - but to keep it simple I went with the same name as before.

4. Select your email from the dropdown in User support email. This is in case any users of your app need to contact you, but since we wont be making the app public, theres no need to worry.

5. Add that same email under Developer contact information and click Save and Continue.

6. On the next page, click Add or Remove Scopes to bring up the scopes sidebar.

7. Search for Google Assistant API in the search bar, and check the /auth/assistant-sdk-prototype scope. Then click update, followed by Save and Continue at the bottom of the page.

8. On the next page, click Save and Continue to skip Optional Info.

9. With the setup complete, click OAuth Consent Screen in the sidebar to refresh the page - then Add User under Test Users.

10. Add your Google accounts email, and click save.

11. Next, on your pi navigate to the downloaded repository and run the following command:

12. Follow the link it gives you and complete the Authentication process in your browser. Once the process is complete, copy the code and paste it back in your terminal.

13. If successful, youll see a message indicating credentials saved: followed by a path to the credentials. Use this path to move the credentials into the current directory. Transfer these credentials to your repositorys root directory

Depending on your rotary phone, this process will vary widely. These are the steps that I used, but likely this will require a fair bit of trial and error on your part. Make sure you use a phone you dont care about, as it wont be able to work normally after this.

1. Take the cover off the telephone. You may need to loosen a screw on the bottom.

2. Find and strip the wires connected to the hook switch. Well connect these wires to the pis GPIO pins to determine if the receiver has been picked up or set down.

3. Connect the hook switch wires to GPIO Board pin 18 and ground. You may need to solder the wires from the hook switch to jumper wires to connect them easier, or just attach them together with a bit of electrical tape.

4. Connect your USB audio adapter to the raspberry pi zero. You will need a USB-micro to female USB-A adapter to do this.

5. Solder the microphone and speaker in the handset to two separate 3.5mm cables. These will carry the signal from the pi to the speaker, and from the microphone to the pi. You should be able to connect these within the phone case and use the original handset cord. This will take a bit of trial and error to determine which wires belong to the speaker, and which to the microphone.

6. Connect the 3.5mm cables to the USB audio adapter being mindful to connect them in the proper order.

7. Tuck the pi into the phone, and close up the cover - or keep it open while you debug setting up the assistant. Run the power adapter connected to the pi out the back of the case where the original telephone wire would go.

1. Run the installation script. Itll take care of base and python requirements. If you have a Raspberry Pi Zero, the compilation process can take hours and will appear stuck on a step installing grpc (it just moves very slowly). Id recommend leaving it running over night.

2. Configure your USB audio by running the following command. It will take care of editing your alsamixer config, setting your USB card as your default audio output, and setting volumes for the speaker and microphone.

3. Test and adjust your volumes by running the following command, speaking, and listening through your phones handset. If your volume is not high enough on your microphone or speaker, set it with the alsamixer command.

4. Export your project ID to an environment variable. You can retrieve your project ID by visiting this URL, selecting your project, clicking the three dots next to your profile photo in the top right, and clicking Project Settings

5. Export your model ID from the Registering With Google steps to an environment variable.

6. Run the make run command. It will take care of registering this device, and saving the configuration to disk so you wont need the environment variables in the future.

7. Test your assistant by picking up the phone, and asking it a simple question, like What is the capital of Canada? If all goes well, youll see some logs in the terminal, and the assistant will respond. To ask another question, hang up the receiver and pick it up again.

8. Finally, run the following command to configure the assistant to run on boot.

Visit link:

How to Turn a Rotary Phone into Google Assistant with Raspberry Pi - Tom's Hardware

Related Posts