Difference between revisions of "Buzzer (RTTTL)"

From Let's Control It
Jump to navigation Jump to search
Line 1: Line 1:
 
= Introduction =
 
= Introduction =
RTTTL (Ring Tone Transfer Language) was developed by Nokia to play more "easy on the ear" melodies as ringtones for mobile phones. The tunes over all characteristics are created by using three different commands:
+
RTTTL (Ring Tone [Text] Transfer Language) was developed by Nokia to play more "easy on the ear" melodies as ringtones for mobile phones. The tunes over all characteristics are created by using three different commands:
  
 
* '''d''' - duration
 
* '''d''' - duration
Line 39: Line 39:
  
 
To make a boot-sound on startup, create a rule like this:
 
To make a boot-sound on startup, create a rule like this:
 +
<pre style="color: #0077dd">
 
  On System#Boot do  
 
  On System#Boot do  
 
   rtttl,14:d=10,o=6,b=180,c,e,g
 
   rtttl,14:d=10,o=6,b=180,c,e,g
 
  endon
 
  endon
 
+
</pre>
 
== Tones ==
 
== Tones ==
  
Besides RTTTL it's also possible to '''play a single tone''' on a pin, via a speaker or piezo element:
+
Besides RTTTL it's also possible to '''play a single tone''' on a pin, via a buzzer speaker or piezo element:
  
'''<nowiki>http://<ESP IP address>/control?cmd=tone,14,1300,200</nowiki>'''
+
<pre style="color: #0077dd">
 +
http://<ESP IP address>/control?cmd=tone,14,1300,200
 +
</pre>
  
 
Plays a 1300 hz tone for 200 ms on gpio-14h
 
Plays a 1300 hz tone for 200 ms on gpio-14h

Revision as of 20:19, 19 July 2017

Introduction

RTTTL (Ring Tone [Text] Transfer Language) was developed by Nokia to play more "easy on the ear" melodies as ringtones for mobile phones. The tunes over all characteristics are created by using three different commands:

  • d - duration
  • o - octave
  • b - tempo (beat)

After that the actual tune is then created using standard notes (a, b, c, d, e, f, and g), before the note the duration is set, after the note the octave is set:

<duration><note><octave>

To compose a jingle you separate the notes with a comma.

Hardware

You can use a buzzer speaker or a piezo element to play tones.

Buzzer.jpg Piezo element.jpg

The wiring is pretty simple, for the buzzer:

For piezo element:

ESP Easy

No device is needed, generally you use rules to activate different notifications, or you send commands to activate them. Below you find more information on how to do this.

Melodies and ringtones

From ESPEasy v2.0.0-dev6 (in the testing plugin set) its also possible to play melodies via [RTTTL]

(don't forget to remove the spaces)

http://<ESP IP address>/control?cmd=rtttl,14:d=8,o=5,b=180,c6,b,c6,p,g,g-,p,f,b,c6,p,d6,p,g,p,c6,b,c6,p,d6,p,f,g,g-,4p,g,f,4d-


This plays a melody on pin 14.

You can also use these from rules. We use it to let our alarm system give feedback to the user via a piezo speaker.

To make a boot-sound on startup, create a rule like this:

 On System#Boot do 
   rtttl,14:d=10,o=6,b=180,c,e,g
 endon

Tones

Besides RTTTL it's also possible to play a single tone on a pin, via a buzzer speaker or piezo element:

http://<ESP IP address>/control?cmd=tone,14,1300,200

Plays a 1300 hz tone for 200 ms on gpio-14h