I am developing a "smart" alarm clock. I need to determine how to I will generate the alarm sounds. The main requirement is the ability to generate loud sounds and to vary the sound volume. One option is to use a PIC18Fxx processor (already part of the circuit) to generate the alarm tones and then feed them through an audio amplifier IC and small speaker. I could use a digital potentiometer to vary sound volume, however if I could get the same effect by using the PIC's 10-bit PWM peripherals it would be ideal. Does anyone have code examples or strategies for creating such sound effects using a PIC processor? Thanks
Creating sound effects with PIC microcontroller
Started by ●October 8, 2005
Reply by ●October 8, 20052005-10-08
["Followup-To:" header set to sci.electronics.misc.] On 2005-10-08, techman41973@yahoo.com <techman41973@yahoo.com> wrote:> I am developing a "smart" alarm clock. I need to determine how to I > will generate the alarm sounds. The main requirement is the ability to > generate loud sounds and to vary the sound volume. One option is to use > a PIC18Fxx processor (already part of the circuit) to generate the > alarm tones and then feed them through an audio amplifier IC and small > speaker. I could use a digital potentiometer to vary sound volume, > however if I could get the same effect by using the PIC's 10-bit PWM > peripherals it would be ideal. > Does anyone have code examples or strategies for creating such sound > effects using a PIC processor? Thanksmap out the wave form you want and send it to the PWM, connect the PWM to the amplifier, with a bit of work (and if the chip and PWM is fast enough) you can even go polyphonic. to reduce the volume either shift the values right before outputting them or use a lower waveform map. I have a code example, but it's for AVR 90S2313 (10MHz) Bye. Jasen
Reply by ●October 8, 20052005-10-08
<techman41973@yahoo.com> wrote in message news:1128749857.235058.172930@g14g2000cwa.googlegroups.com...>I am developing a "smart" alarm clock. I need to determine how to I > will generate the alarm sounds. The main requirement is the ability to > generate loud sounds and to vary the sound volume. One option is to use > a PIC18Fxx processor (already part of the circuit) to generate the > alarm tones and then feed them through an audio amplifier IC and small > speaker. I could use a digital potentiometer to vary sound volume, > however if I could get the same effect by using the PIC's 10-bit PWM > peripherals it would be ideal. > Does anyone have code examples or strategies for creating such sound > effects using a PIC processor? Thanks >If the sound is just tones or assending/descending tones then I would be tempted to use a pieze instead of a speaker. Nice and loud, only a darlington driver required. As far as varying the volume then this is easilly achievable using one of the PWM modules on the 18F part. Connect the output of the PWM pin through a charging resistor to a capacitor. Connect the capacitor to the power pin of your darlington pair. This will give you control over the voltage presented to the piezo. I have done this before and it works very well. If I remember correctly using a 1K series resistor to 10uF capacitor is perfectly adequate for volume control. If you need PWM code then I should be able to dig some out on Monday. But where would the fun be in that? :-) Have fun Jim www.picmodules.com
Reply by ●October 8, 20052005-10-08
<techman41973@yahoo.com> wrote in message news:1128749857.235058.172930@g14g2000cwa.googlegroups.com...> I am developing a "smart" alarm clock. I need to determine how to I > will generate the alarm sounds. The main requirement is the ability to > generate loud sounds and to vary the sound volume. One option is to use > a PIC18Fxx processor (already part of the circuit) to generate the > alarm tones and then feed them through an audio amplifier IC and small > speaker. I could use a digital potentiometer to vary sound volume, > however if I could get the same effect by using the PIC's 10-bit PWM > peripherals it would be ideal. > Does anyone have code examples or strategies for creating such sound > effects using a PIC processor? ThanksGoogle suggests PICBASIC supports the BASIC SOUND command.
Reply by ●October 8, 20052005-10-08
<techman41973@yahoo.com> wrote in message news:1128749857.235058.172930@g14g2000cwa.googlegroups.com...> I am developing a "smart" alarm clock. I need to determine how to I > will generate the alarm sounds.Record and playback samples... http://centauri.ezy.net.au/~fastvid/picsound.htm
Reply by ●October 9, 20052005-10-09
<techman41973@yahoo.com> wrote in message news:1128749857.235058.172930@g14g2000cwa.googlegroups.com...>I am developing a "smart" alarm clock. I need to determine how to I > will generate the alarm sounds. The main requirement is the ability to > generate loud sounds and to vary the sound volume. One option is to use > a PIC18Fxx processor (already part of the circuit) to generate the > alarm tones and then feed them through an audio amplifier IC and small > speaker. I could use a digital potentiometer to vary sound volume, > however if I could get the same effect by using the PIC's 10-bit PWM > peripherals it would be ideal. > Does anyone have code examples or strategies for creating such sound > effects using a PIC processor? Thanks >www.beyondlogic.org http://www.beyondlogic.org/pic/ringtones.htm works with 16f87x does it in software good for awful sounding phone ring tones works with Hitech compiler or demo version
Reply by ●October 9, 20052005-10-09
On 7 Oct 2005 22:37:37 -0700, techman41973@yahoo.com wrote:>I am developing a "smart" alarm clock. I need to determine how to I >will generate the alarm sounds. The main requirement is the ability to >generate loud sounds and to vary the sound volume. One option is to use >a PIC18Fxx processor (already part of the circuit) to generate the >alarm tones and then feed them through an audio amplifier IC and small >speaker. I could use a digital potentiometer to vary sound volume, >however if I could get the same effect by using the PIC's 10-bit PWM >peripherals it would be ideal. >Does anyone have code examples or strategies for creating such sound >effects using a PIC processor? ThanksThere was an article regarding RC-2 encoding an playback of sound in "Circuit Cellar" a few months ago. Only 2 I/O pins, 2 Resitors and a Capacitor is needed to generate sound. In the original article a 8051 was used, but I have implimented it on an AVR with very good results. Using a PIC plus a reasonably large data flash should be fine. The author of the Circuit Cellar Article, Mariano Barr�n, wrote a PC app which can be used to generate the RC-2 data from a 16-bit mono wave file. Regards Anton Erasmus