Bell which plays melody with microcontroller
Use this simple schemes for the generation melodies can easily to make the interesting bell. Limitation of complex is in the generation only the rectangular signal. Aside from this, cache of processors demand the compression of noted down melody.
As the example quotes 1,25 the second melodies are noted in 96 bytes ( ta-na-na-na). Units of duration of impulses and period is 22,5us. Processor reads the table. Moves counter period, impulses and cycles. Includes pin P3.7. Every 22,5us decreases the counter impulse and period. When empties the counter impulse turn off pin P3.7. Then the count down by the end of period, reduces the counter cycle and if finished has not repeated the generation peroda until the end all cycle. After this reads the parameter next the impulse, period and cycles also them in the same way executes.
Impuls
(*22,5us)
|
Period
(*22,5us)
|
Cycles of repetitions
|
8
|
24
|
55
|
6
|
24
|
56
|
4
|
24
|
57
|
3
|
24
|
114
|
8
|
26
|
52
|
5
|
26
|
54
|
4
|
26
|
54
|
3
|
26
|
109
|
8
|
29
|
46
|
5
|
29
|
47
|
4
|
29
|
48
|
3
|
29
|
95
|
8
|
32
|
42
|
5
|
32
|
43
|
4
|
32
|
42
|
3
|
32
|
86
|
8
|
36
|
36
|
5
|
36
|
38
|
4
|
36
|
38
|
2
|
36
|
77
|
8
|
38
|
34
|
6
|
38
|
36
|
4
|
38
|
36
|
3
|
38
|
73
|
8
|
43
|
30
|
6
|
43
|
30
|
4
|
43
|
35
|
3
|
43
|
64
|
8
|
48
|
27
|
6
|
48
|
30
|
4
|
48
|
27
|
3
|
48
|
57
|
More skillful programmers easily can make: the howling siren, Nina-Nina siren, melody happy birthday, melody kazachok, melody bells, melody with the wedding etc.. As the power supply was able will use the transformer 9VAC with the full-wave rectifier.
Characteristics:
Power supply: 8-12V=
microcontroller and stabilizer of power supplies: approximately 10mA
Output: loudspeaker 4R / 3W or 8R / 2W
Are interested can get the free program and listing of program.
For own needs have realized expanded the version of doorbell. Problem in next. Existing bells across the tastera feeds with 220VAC. Has needed add another push button does not change existing 220VAC the installation. Depending upon the pressed push button bell has needed play the suitable melody. Solution has been in the use of the small switching power supplies. How switching the power supply has inside the full-wave rectifier no problem if feed only negative or the positive half-wave. Every push button switches on 220VAC the power supply, but across one's diodes lets in only the one polarity half-wave. For the melody number the 1 bell feed the positive half-wave, and for the melody number 2 with the negative half-wave. Across the resistor and two optocouplers processors get the information about the presence of the determined half-wave. Hereby start the generation of suitable melody. Aside from this, monitors the holding of push button also after releasing push button break melody.
|