The ringtone text transfer language (RTTTL) is a way to represent music data for play on older mobile phones. The format was created by Nokia for thier phones, but it also works with GPIO pins and a piezo buzzer.
This project shows how to use the Raspberry Pi's GPIO pins to play RTTTL on a piezo buzzer. This project was inspired by existing RTTTL implementations, but differs from those in that its user interface is Web enabled.
The application, written in Java, starts an HTTP server. The HTTP server presents the user interface via HTML. The user interface provides a list of built-in RTTTL ditties available for play. The application's interface also accepts user-provided RTTTL sequences, via its on-the-fly input controls.
This guide assumes a Raspberry Pi, with network access, is available.
Need help setting up a network-enabled Raspberry Pi? If so, check out these awesome Raspberry Pi tutorials.
Assembling this project involves connecting a piezo buzzer's leads to Raspberry Pi GPIO pins.
Connecting a piezo buzzer to the Raspberry Pi is a blast, but don't be alarmed. It is also easy to do.
Connect one of piezo leads to ground on the Raspberry Pi. The other piezo lead goes to GPIO pin 22. It is the 8th pin down, in the left column, from the end closest to the SD card slot.
Java 8 is a requirement for this project. The latest version of Raspbian, the recomended OS for this projet, comes pre-bundled with Java 8.
Don't have Java 8 on the Raspberry Pi? Then use these commands to install or update:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install oracle-java8-jdk
The application software for this project is distributted as an executable JAR file.
Download the JAR and copy it to the Raspberry Pi.
If you are not familiar with copying files over the network to a Rasspberry Pi, then see these links for details:
With the JAR file copied over, issue this at the Raspberry Pi's command line interface:
sudo java -jar pisoundo-0.0.1-SNAPSHOT-jar-with-dependencies.jar
Replace pisoundo-0.0.1-SNAPSHOT-jar-with-dependencies.jar with whatever you named the JAR file when copying to the Raspberry PI.
Verify the server application is running and accessible. Browse to this URL, from a device on the same network where the application is running.
- The ‘raspberry-pi' part of the URL should be replaced with the actual IP or hostname of the Raspberry Pi.
- Keep the port number in the URL.
For more detail: Piezo Ring Tones with Raspberry Pi