Skip to content

CrazyRobMiles/RaspberryPi-DialTelephone

Repository files navigation

Raspberry Pi

Red Phone Make an old-style dial telephone into something a bit more interesting.

YouTube Screenshot

To find out more about the device click on the image above to see a short video.

Building the device

The parts you'll need are as follows:

  • An old-style telephone with a dial. The author used a 746 model he picked up in a second-hand shop.

  • I think the phone should be red, like the original “batphone” but the software will work with other colours.

  • A Raspberry Pi Zero 2. Any colour you like.

  • Two power switches for the bell. The author used a design which had dual D4184 MOSFETs. This can be driven directly by the GPIO signals from the Raspberry Pi.

  • A power supply to convert 12 volts to 35 volts for the bell.

  • A power supply to convert 12 volts to 5 volts for the Raspberry Pi.

  • A 12-volt power supply for the above.

  • A Raspberry Pi GPIO breakout board to mount all the components.

  • A USB audio adapter and micro-USB “on the go” cable to connect it.

Circuit diagram

The Raspberry Pi GPIO pins are shown on the circuit diagram. There is also a USB sound interface plugged into the Raspberry Pi "On the Go" usb socket via a suitable adapter.

Packaging the components

pi holder There is a 3D printable design for the Raspberry Pi holder in the holder folder. built system This is the built system.

Setting up the Raspberry Pi

Steps to install software:

Make an sd card for your Pi

  1. Start the Raspberry Imager program on your machine and put the microSD card into the drive on your computer.
  2. Select the OS to be installed. Make sure you are not installing a desktop. You will be using your Raspberry Pi without a screen, keyboard or mouse. (I used Debian Bullseye Light)
  3. Set the advanced options in the Imager program. Now make the folling settings.
    1. Hostname (I called mine "theredphone")
    2. Enable SSH (password authentication)
    3. User: xxxx Password: xxxxxx (don't use x, put in your own words) I created a user called rob (it's used in the ssh command a few steps down)
    4. Set Wi-Fi credentials and locale
    5. Save the options so you can use them again if you need to
  4. Make the image.

Configure your Pi

  1. Remove the SD card from your computer, plug it into your Raspberry Pi and turn the Pi on. Wait a few minutes until the green led on the Pi seems to settle down a bit.
  2. Now log in from your computer. You'll need a command prompt to do this. The commands given are from Microsoft PowerShell. You will be setting up a secure shell, so use the command ssh:
    ssh theredphone.local -l rob
    
  3. Use the name of the computer and the username that you set in the steps above. Say yes to set up the connection if it is the first time you've connected.
  4. Give your password when it is requested.
  5. Once you've logged in you should update your computer:
    sudo apt update
    
  6. Now set up SSL to allow your remote machine to connect to the PI.
    1. On the Pi
      1. Check for existing SSH

        ls ~/.ssh
        
      2. If this comes back with some files they are already there. Otherwise:

        ssh-keygen
        
      3. Use the defaults

    2. On your remote machine
      1. Copy your keys over:

        cat ~/.ssh/id_rsa.pub | ssh rob@theredphone.local 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'
        
      2. I used the username and the address of the pi I’m setting up. Enter the password for the user (in my case rob)

    3. Now you can test the connection. Open another terminal window on your remote machine and connect directly to the pi with no password:
      ssh theredphone.local -l rob
      
    4. This should open a remote terminal session with no password required. If this works you will be able to use remote development with Visual Studio Code.

Install git

  1. Now we need to install git on your machine:
    sudo apt-get install git -y
    
  2. Next we need to configure the username and email values for the Git installation on the machine. Use your email and username as appropriate.
    git config --global user.name "Rob Miles"
    git config --global user.email rob@robmiles.com
    

Install node

  1. Now install nodejs and npm:
    sudo apt install nodejs
    sudo apt install npm
    

Install audio output and speech

  1. Install the audio headers for the espeak:
    sudo apt-get install libasound2-dev
    
  2. Now install espeak:
    sudo apt-get install espeak
    
  3. Now set up the audio playback. This is going to make the USB sound adapter the default audio device. If you try to run the server without the audio interface plugged in the phone software will fail:
    sudo nano /usr/share/alsa/alsa.conf
    
    1. Find:
      defaults.ctl.card 0
      defaults.pcm.card 0
      
    2. Change to:
      defaults.ctl.card 1
      defaults.pcm.card 1
      
    3. reboot the machine
      sudo reboot
      

Start developing with Visual Studio Code

Will be developing the code on our PC or laptop. The version of Visual Studio Code on that device will communicate with remote connection software running on the Raspberry Pi.

  1. Open Visual Studio Code on your PC or laptop.
  2. Make sure to turn off things that slow us down.
    1. Select the Extensions tab and enter the following into the extensions search window:
      @builtin typescript
      
    2. Two plugins should be found. Click the gear icon and select "Disable Workspace" from the menu for each. You will lose a few useful features when editing the code, but at least the Raspberry Pi won't freeze up.
  3. Ensure you have Remote Development installed on your machine. If you don't, open extensions and install it. If it is installed you will have a green icon in the bottom left of your Visual Studio Window. Click this to open a remote development window.
  4. Select "Connect to Host - Remote SSH" from the menu which appears. The first time you make the connection you will be asked to enter the username and address of your machine. I used rob@redphone.local - you use the one you set.
  5. Create a new remote connection (rob@theredphone.local)
  6. Now clone the repository.
    1. Select "Clone a repository" from the start page of Visual Studio Code and open the following repository:
    https://github.com/CrazyRobMiles/RaspberryPi-DialTelephone
    
  7. Now we need to install all the libraries in the project (we only need to do this once)
    npm install
    
  8. Now open a terminal window and start the server:
    node redserver.js
    

The server should start up and you can interact with the phone. Web Interface If you want to make the server run automatically when the Raspberry Pi starts you can do this by editing the rc.local file. Have fun

Rob Miles

About

Put a Raspberry Pi inside an old telephone to make it fun.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published