Musical DoorBell with PIC16F84A
Re: Musical DoorBell with PIC16F84A
LM386 circuit submitted by RKSK is a common one. You would add a 10K resistor in series with the 10uf cap in pin 1,8 to increase the gain from 20x to 200x (Without that you would only get a 20x amplification). However this amplifier is only good for driving a low power speaker from a sound effects module or a noise generator. I have posted a better quality amplifier at Simple 7W Audio Amplifier Circuit Diagram.
You may also look at 120 Watt Audio Power Amplifier Circuit Diagram for more power. There are many other TDA series amplifiers which are easy to make. STK series also have many good power amplifiers.
You may also look at 120 Watt Audio Power Amplifier Circuit Diagram for more power. There are many other TDA series amplifiers which are easy to make. STK series also have many good power amplifiers.
- SemiconductorCat
- Major
- Posts: 455
- Joined: Mon Aug 22, 2011 8:42 pm
- Location: currently in hyperspace
Re: Musical DoorBell with PIC16F84A
Hmm , sounds like not enough experience in Analog and Power Electronics Right?Shane wrote:LM386 circuit submitted by RKSK is a common one. You would add a 10K resistor in series with the 10uf cap in pin 1,8 to increase the gain from 20x to 200x (Without that you would only get a 20x amplification). However this amplifier is only good for driving a low power speaker from a sound effects module or a noise generator. I have posted a better quality amplifier at Simple 7W Audio Amplifier Circuit Diagram.
You may also look at 120 Watt Audio Power Amplifier Circuit Diagram for more power. There are many other TDA series amplifiers which are easy to make. STK series also have many good power amplifiers.
Re: Musical DoorBell with PIC16F84A
No. I think for the circuit mentioned in the main topic, it is enough to have that LM amplifier. Besides we welcome all opinions here rather than only from experts. So it is really important to share ideas within the community. No good to discriminate others.Hmm , sounds like not enough experience in Analog and Power Electronics Right?
-
- Sergeant
- Posts: 20
- Joined: Mon May 23, 2011 7:16 pm
Re: Musical DoorBell with PIC16F84A
Shane wrote:Hi guys
I'm adding the C code for playSound function.Note that, since 's' is the index of frequency table, you can pass 0 to 6 for different frequencies.Code: Select all
// frequency table: periods in thousands of ms #define NFREQ 7 const unsigned char t_period[NFREQ] = {132, 148, 165, 176, 198, 220, 247}; // s - Index of the sound in frequency table // d - Duration of the sound in numbers of periods // t - Duration of silence after the sound (to be multiplied by 10 ms) void playSound (unsigned char s, unsigned char d, unsigned char t){ unsigned char i, t1; t1 = t_period[s]; for (i = 0; i < d; i++){ RB0 ^= 1; // Toggle 1 and 0 Delay_us(t1); } // Turn loudspeaker off RB0 = 0; // Do the silence (if needed) for (i = 0; i < t; i++){ delay10ms(); } }
The above C code will work on HiTECH C compiler. However with little modifications to port writing codes, you can get this working for any platform.
I Used this procedure to produce sound but i m not able to generate a music with this. the sounds are coming but with any songs not able to produce like that. the frequency not matches or some time no sound at all. what to do.
Re: Musical DoorBell with PIC16F84A
This whole discussion was aiming at making a simple Musical door bell. It is definitely not good for any songs type playback. To playback such music, you will have to use a DAC (Digital-to-Analogue converter) chip such as CS4334. I have added a schematic at Making an MP3 player using STA013 & CS4334 chips.
-
- Sergeant
- Posts: 20
- Joined: Mon May 23, 2011 7:16 pm
Re: Musical DoorBell with PIC16F84A
yesss, for Musical door bell only. i am not saying for playback music.Shane wrote:This whole discussion was aiming at making a simple Musical door bell. It is definitely not good for any songs type playback. To playback such music, you will have to use a DAC (Digital-to-Analogue converter) chip such as CS4334. I have added a schematic at Making an MP3 player using STA013 & CS4334 chips.
i am not able to play musical bell. its just making sound or like beeper.
Re: Musical DoorBell with PIC16F84A
Hey Deepak,
This is nothing more than beeping. If you need more quality, you better use PWM to control the frequency. Have a look at the following circuit diagram.
Instead of a piezo speaker, you can use a 8 Ohm speaker here. However with a simple arrangement as below, you can drive a piezo with PWM well. Here is a sample PWM code
Bonus songs:
Mary Had a Little Lamb
Jingle Bells
This is nothing more than beeping. If you need more quality, you better use PWM to control the frequency. Have a look at the following circuit diagram.
Instead of a piezo speaker, you can use a 8 Ohm speaker here. However with a simple arrangement as below, you can drive a piezo with PWM well. Here is a sample PWM code
Code: Select all
/*
Code written by Bobby By, Agatha Lee, Dan Niecestro 02-2009
This code uses a PWM signal from PIC 18F4520 to define the frequencies
that produce the basic notes in one octave of the musical scale,
and plays a simple song on a piezo speaker.
The volume of the speaker can be set by changing the duty cycle value (1~125)
*/
#include <18f4520.h>
#fuses HS,NOLVP,NOWDT,NOPROTECT
#use delay(clock=40000000)
//define timer scaling value for each note
#define C 255
#define D 227
#define E 204
#define F 191
#define G 170
#define A 153
#define B 136
#define C2 127
//
#define x 14 //total number of notes in song to be played - modify for specific song
//the song to be played in this demonstration is "Twinkle Twinkle Little Star"
int song[x]={C, C, G, G, A, A, G, F, F, E, E, D, D, C}; //insert notes of song in array
int length[x]={1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2}; //relative length of each note
int i;
void main() {
setup_ccp1(CCP_PWM); // PWM output on pin 17, RC2/CCP1
set_pwm1_duty(30); // the number changes the volume of the piezo speaker
for (i=0; i<x; i++) { // play x notes inside song array
setup_timer_2(T2_DIV_BY_16, song[i], 16);
//set PWM frequency according to entries in song array
delay_ms(400 * length[i]); //each note is played for 400ms*relative length
setup_timer_2(T2_DIV_BY_16, 1, 16); //the PWM frequency set beyond audible range
//in order to create a short silence between notes
delay_ms(50); //the silence is played for 50 ms
}
}
Mary Had a Little Lamb
Code: Select all
#define x 26
int song[x] = {B, A, G, A, B, B, B, A, A, A, B, B, B, B, A, G, A, B, B, B, A, A, B, A, G, G};
int length[x] = {1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2};
Code: Select all
#define x 25
int song[x] = {E, E, E, E, E, E, E, G, C, D, E, F, F, F, F, F, E, E, E, E, D, D, E, D, G};
int length[x] = {1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2};
Re: Musical DoorBell with PIC16F84A
You can use UM66 for music generation insted of uCs.DeepakPatil23 wrote:for Musical door bell only. i am not saying for playback music.
i am not able to play musical bell. its just making sound or like beeper.
* I posted this topic just to give u a idea about uCs.
[ Post made via Mobile Device ]