arduino - danger shield 1.0 - sinus beeps with buzzer

194 views
Skip to first unread message

ohrobot

unread,
May 22, 2008, 2:13:33 PM5/22/08
to NYCResistor:Microcontrollers
hi. since the arduino 102 course i am experimenting with the arduino
and danger shield 1.0 making beeps and beeeeps. i love it. my question
is about the buzzer.

- as i see it the buzzer is connected to a digital output. so it is
only able to respond to HIGH and LOW commands from the digitalWrite
function, right?
- what if i want to make it do sinus bleeps? thus i have to put
differing output voltages on the speaker (not just HIGH/LOW) by
analogWrite. is this possible or do i have to connect another buzzer/
speaker to an analogOutput connector on the arduino board?

i would appreciate any advice.
unsure: is this the right place for my special beginner questions?
just tell me if not.

bernd


greetings back from munich, germany :)

Zach 'Hoeken' Smith

unread,
May 22, 2008, 3:13:17 PM5/22/08
to nycresistormi...@googlegroups.com
it is also hooked up to the PWM pin (3), so you might want to play around with some analogWrite() functions.  you could even go deeper and experiment with the timers directly, however that is definitely an advanced thing.

unfortunately, i dont know much about audio and generating it with the Arduino.  the buzzer was meant to allow people to explore the basics.  please do report back any finding you have.

Sharls Davis Kendy

unread,
May 22, 2008, 4:01:26 PM5/22/08
to nycresistormi...@googlegroups.com
I used the following delayMicroseconds values to make somewhat-accurate notes

Note Hz microseconds

C 523.25 1911
C# 554.37 1803
D 587.33 1702
D# 622.25 1607
E 659.26 1516
F 698.46 1431
F# 739.99 1351
G 783.99 1275
G# 830.61 1203
A 880 1136
A# 932.33 1072
B 987.77 1012
C 1046.5 955

And to make sure that I kept note lengths even, I made a little
function to run my for loop for the appropriate amount of time. I
don't have it in front of me but if you'd like I can post it later on.

-MikeG

Patrick Resing

unread,
May 22, 2008, 7:26:04 PM5/22/08
to nycresistormi...@googlegroups.com
this is easy pwm arduino sound:
http://www.arduino.cc/en/Tutorial/PlayMelody

be sure to change
int speakerOut = 9; 

to

int speakerOut = 3;

for your setup
or

this is more complicated:
http://www.arduino.cc/playground/Code/PCMAudio

--patrick resing



Zach 'Hoeken' Smith <hoe...@gmail.com> wrote:

ohrobot

unread,
Jun 8, 2008, 9:10:28 AM6/8/08
to NYCResistor:Microcontrollers
i made some pictures of my project implanting the arduino + selfmade
shield into a stuffed monster (called KLAWS).
take a look :) http://www.flickr.com/photos/fiesefalle/tags/klaws/
...
it features:
* external USB-connector in the palm
* switch for selecting mouth-speaker or mini-jack as sound emitter
* switchable power-supply (off/USB/9V)
* 3 push buttons
* 3 pots
* arduino making poor beeps, kind of distortion, ..

this is the basis, much much more to do on it. just wanted to show
some results..

bernd
Reply all
Reply to author
Forward
0 new messages