← Home

Real terminal bell

I decided that I didn’t like the sound of the terminal bell on my computer. Wouldn’t it be nicer if it was an actual bell?

So, I got a Raspberry Pi, a servo motor and some lego and built a real terminal one.

I didn’t want to spend long on it, so I used some example Python code from [0] and added a Web server so that I could trigger the bell remotely.

from flask import Flask
import RPi.GPIO as GPIO
import time

# Create Flask app.
app = Flask(__name__)

# Start GPIO up.
servoPIN = 17
GPIO.setup(servoPIN, GPIO.OUT)
p = GPIO.PWM(servoPIN, 50) # GPIO 17 for PWM with 50Hz
p.start(2.5) # Initialization

def hello():
    return "dong"

if __name__ == '__main__':
        app.run(host = '',port=5005)
    except KeyboardInterrupt:

With that in place, I could get the bell to ring using curl.


My son and I then set to work building a lego case.

I use [1] to manage my terminal, so it was a simple case of using the built-in hook feature [2] to run the command when the bell rings, and to disable the bell sound on my mac:

set-hook -g alert-bell 'run-shell "curl"'

Ah… much nicer.

You can see a video and hear it in action at [3]