you are Welcome to robot.lk.
it seems you have to amplify the out put of PIC.
Below cricuit is very easy to build. tryout it.
I'm unable to covert this ASM code to C, because I'm busy with my studies.
[ Post made via Mobile Device ]
Musical DoorBell with PIC16F84A
Re: Musical DoorBell with PIC16F84A
You must be using a type with less sound. Try to find a piezo speaker similar to the one in the following image. This one is very loud and I'm trying to find a way to reduce the volumeSound of the Piezo speaker is very low
-
- Sergeant
- Posts: 20
- Joined: Mon May 23, 2011 7:16 pm
Re: Musical DoorBell with PIC16F84A
Thanks , sure, tomorrow i will try to build that amplifier circuit. and also try to get the same piezo speaker.
Re: Musical DoorBell with PIC16F84A
I don't think you need the amplifier. Just buy a good piezo speaker.
-
- Lieutenant
- Posts: 92
- Joined: Tue Oct 27, 2009 7:50 pm
Re: Musical DoorBell with PIC16F84A
I suggest you to play wave file on pic using PWM. where you can have music whatever you want to play.It is really good to start wave file player using microcontroller.
Re: Musical DoorBell with PIC16F84A
Have you any tutorial, to play wav files using PIC16F84A?SukhdeepMankoo wrote:I suggest you to play wave file on pic using PWM. where you can have music whatever you want to play.It is really good to start wave file player using microcontroller.
[ Post made via Mobile Device ]
-
- Sergeant
- Posts: 20
- Joined: Mon May 23, 2011 7:16 pm
Re: Musical DoorBell with PIC16F84A
Do you have any code and cricuit for that if you have send me pleaseI suggest you to play wave file on pic using PWM. where you can have music whatever you want to play.It is really good to start wave file player using microcontroller.
Thanks
-
- Lieutenant
- Posts: 92
- Joined: Tue Oct 27, 2009 7:50 pm
Re: Musical DoorBell with PIC16F84A
First all you need to read wave file. after reading the wave file, you will get the data. send that data to pwm register or to DAC. will be get the sound on speaker. Note down the link, which tell you the wave file format.
https://ccrma.stanford.edu/courses/422/ ... aveFormat/
read the format and make program to get the information(data) in wave file.
https://ccrma.stanford.edu/courses/422/ ... aveFormat/
read the format and make program to get the information(data) in wave file.
Re: Musical DoorBell with PIC16F84A
Hi guys
So I would like to suggest a more simple solution.
Do a little modification to the main circuit given by Rksk as below. (Only RB0 is connected to the Piezzo speaker and the other end of the speaker is connected to 0V). Keep RB1, RB2 and RB3 unconnected. Don't worry, 1 pin would be enough to power a Piezzo speaker. 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.
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.
deepak, What's the C++ compiler you use for PIC?
By grounding one side of the speaker and a little change to code that operates on RB0, RB1, RB2 and RB3, I think you would be able to get your code working.
Sukhdeep, though PWM is a piece of cake for you, it could be a little difficult for noviceI suggest you to play wave file on pic using PWM. where you can have music whatever you want to play.It is really good to start wave file player using microcontroller.
So I would like to suggest a more simple solution.
Do a little modification to the main circuit given by Rksk as below. (Only RB0 is connected to the Piezzo speaker and the other end of the speaker is connected to 0V). Keep RB1, RB2 and RB3 unconnected. Don't worry, 1 pin would be enough to power a Piezzo speaker. I'm adding the C code for playSound function.
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.
deepak, What's the C++ compiler you use for PIC?
By grounding one side of the speaker and a little change to code that operates on RB0, RB1, RB2 and RB3, I think you would be able to get your code working.
-
- Sergeant
- Posts: 20
- Joined: Mon May 23, 2011 7:16 pm
Re: Musical DoorBell with PIC16F84A
Hi,
One more chip is there 16F628A which is in use but i will try with this one very easy and fine solution. Thanks for C code.
I m using HiTECH C compiler. i have one PIC 16F688 in spare so i m trying to generate sound through this pic. In 16F688 PWM is not present. and for that generating sound is low and not that extend i can use for doorbell.deepak, What's the C++ compiler you use for PIC?
By grounding one side of the speaker and a little change to code that operates on RB0, RB1, RB2 and RB3, I think you would be able to get your code working.
One more chip is there 16F628A which is in use but i will try with this one very easy and fine solution. Thanks for C code.