Difference between revisions of "Buzzer (RTTTL)"

From Let's Control It
Jump to navigation Jump to search
 
(31 intermediate revisions by the same user not shown)
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:
+
<span style="color:red">This is at the moment only available in the "test" build, not in normal build.</span> 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 6: Line 6:
 
* '''b''' - tempo ('''b'''eat)
 
* '''b''' - tempo ('''b'''eat)
  
After that the actual tune is then created
+
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 =
 
= Hardware =
You can use a buzzer speaker or a piezo element to play tones.
+
You can use a buzzer, a speaker or a piezo element to play tones.
 +
 
 +
[[File:buzzer.jpg|320px]]
 +
[[File:Small_speaker.jpg|320px]]
 +
[[File:Piezo_element.jpg|320px]]
 +
 
 +
The wiring is pretty simple, for the buzzer:
 +
    '''ESP'''            '''Buzzer'''
 +
    GPIO    <-->  I/O
 +
 +
    '''Power'''
 +
    3.3V    <-->  VCC
 +
    GND    <-->  GND
  
[[File:buzzer.jpg|420px]]
+
For speaker and piezo element:
[[File:Piezo_element.jpg|420px]]
+
    '''ESP'''            '''Speaker/piezo'''
 +
    GPIO    <-->  Positive (red)
 +
    GND    <-->  Negative (black)
  
 
= ESP Easy =
 
= 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.
 
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.
  
== Tones ==
+
== Melodies and ringtones ==
 +
 
 +
From ESP Easy v2.0.0 its possible to play melodies via [https://en.wikipedia.org/wiki/Ring_Tone_Transfer_Language#Technical_specification RTTTL] ('''don't forget to remove the spaces and replace # with -''', this might be fixed in future releases):
 +
<pre style="color: #0077dd">
 +
http://<ESP IP address>/control?cmd=rtttl,14:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6
 +
</pre>
 +
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:
 +
<pre style="color: #0077dd">
 +
On System#Boot do
 +
  rtttl,14:d=10,o=6,b=180,c,e,g
 +
endon
 +
</pre>
  
Besides RTTTL it's also possible to '''play a single tone''' on a pin, via a speaker or piezo element:
+
[http://www.picaxe.com/RTTTL-Ringtones-for-Tune-Command/ A place to find more tunes], all saved as txt files.
  
'''<nowiki>http://<ESP IP address>/control?cmd=tone,14,1300,200</nowiki>'''
+
== Tones ==
  
Plays a 1300 hz tone for 200 ms on gpio-14h
+
Besides RTTTL it's also possible to '''play a single tone''' on a pin, via a buzzer, speaker or piezo element:
  
== Melodies and ringtones ==
+
<pre style="color: #0077dd">
 +
http://<ESP IP address>/control?cmd=tone,14,1300,200
 +
</pre>
  
From ESPEasy v2.0.0-dev6 (in the testing plugin set) its also possible to play melodies via [[https://en.wikipedia.org/wiki/Ring_Tone_Transfer_Language#Technical_specification RTTTL]]
+
Plays a 1300 hz tone for 200 ms on GPIO-14
  
(don't forget to remove the spaces)
+
= Commands =
  
'''<nowiki>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-</nowiki>'''
 
  
 +
{| class="wikitable sortable"
 +
|-
 +
! style="width: 13%|Command
 +
! GPIO
 +
! style="width: 35%|Value
 +
! Extra information
 +
|-
  
This plays a melody on pin 14.
+
| tone,<gpio>,<value>
 +
| '''12...16'''
 +
| '''<tone>,<duration>'''
 +
| You should try to use GPIO 12...16 since these generally aren't used. The recommended tone range is '''20...13000''' but you could try tones outside this range. Duration is set in ms.
 +
|-
  
You can also use these from rules. We use it to let our alarm system give feedback to the user via a piezo speaker.
+
| rtttl,<gpio>,<value>
 +
| '''12...16'''
 +
| '''d=<duration>,o=<octave>,b=<tempo>,<notes...>'''
 +
| You should try to use GPIO 12...16 since these generally aren't used.
 +
|-
  
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
 

Latest revision as of 15:51, 12 March 2018

Introduction

This is at the moment only available in the "test" build, not in normal build. 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, a speaker or a piezo element to play tones.

Buzzer.jpg Small speaker.jpg Piezo element.jpg

The wiring is pretty simple, for the buzzer:

    ESP            Buzzer
    GPIO    <-->   I/O

    Power
    3.3V    <-->   VCC
    GND     <-->   GND

For speaker and piezo element:

    ESP            Speaker/piezo
    GPIO    <-->   Positive (red)
    GND     <-->   Negative (black)

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 ESP Easy v2.0.0 its possible to play melodies via RTTTL (don't forget to remove the spaces and replace # with -, this might be fixed in future releases):

http://<ESP IP address>/control?cmd=rtttl,14:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6

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

A place to find more tunes, all saved as txt files.

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-14

Commands

Command GPIO Value Extra information
tone,<gpio>,<value> 12...16 <tone>,<duration> You should try to use GPIO 12...16 since these generally aren't used. The recommended tone range is 20...13000 but you could try tones outside this range. Duration is set in ms.
rtttl,<gpio>,<value> 12...16 d=<duration>,o=<octave>,b=<tempo>,<notes...> You should try to use GPIO 12...16 since these generally aren't used.