On Tue, Mar 18, 2014 at 5:25 PM, Dennis Cote <[email protected]> wrote: > On Monday, March 17, 2014 9:11:53 PM UTC-6, Ramon Mendes wrote: >> >> I want play 'beeps' connecting a piezo buzzer to my Beaglebone Black. I am >> very new to eletronics, so I need some help here, don't know how to operate >> these sound devices. >> >> -Eletrical circuit: as for the circuit, I am referring to this >> book/chapter which shows it very well how I should proceed: using a >> transistor.. >> >> -What I don't know is, how do I control the buzzer (say from a C program) >> to emit sound? >> -I guess I should configure and use PWM feature of the processor, am I >> right? >> -And how do I pragmatically control PWM output? >> -How could I make it play an given sound file, like a .midi file? > > > Hi Ramon, > > The piezo buzzer you are using is a digital device. It is either on or off. > When it is on it beeps at a fixed frequency. When it is off it is silent. > > The circuit you have shown uses a transistor to control current through the > buzzer. When the line "from processor" is high, or 3.3 V, the transistor > turns on and draws current through the buzzer. The line "from processor" > would normally be a GPIO (general purpose input/output) pin rather than a > PWM output. > > You can use one of the Python or Bonescript libraries to turn a GPIO pin on > or off to control the buzzer. > > This simple buzzer will not play a sound file or midi file. For that you > would need a PWM output running at a high frequency with its duty cycle > adjusted at the sample rate of your audio signal to produce an average > analog voltage proportional to the audio signal. This would then need to be > low pass filtered to remove the high frequency PWM carrier and amplified to > drive a speaker. This will require much more learning, hardware, and > software on your part.
http://elinux.org/ECE497_BeagleBone_PRU#Building_and_Running_the_Sin_Approximation_Example might be helpful. Also http://www.embedded.com/design/real-time-and-performance/4006419/Low-cost-techniques-for-sound-generation > > HTH > Dennis Cote > > -- > For more options, visit http://beagleboard.org/discuss > --- > You received this message because you are subscribed to the Google Groups > "BeagleBoard" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
