Introduction: Play the French Can Can Using an Arduino and Buzzer



Bonjour!

Make your Arduino play the French Can Can using a buzzer. No pliers. No fires. It's so straight forward that it's as scandalous the Can Can implies.

This instructable covers some introductory electronics info, and focuses on writing scripts using the Arduino IDE to make an Arduino play basic musical tones.

Step 1: Ingredients

The following ingredients are needed to make an Arduino play the Can Can:

Arduino
I bought mine here at sparkfun.com as part of a starter kit (also includes the buzzer used in this instructable).

Buzzer (CEM-1203 used in this instructable)
This particular buzzer can be found here at sparkfun.com for under $2.00.

100R Resistor
Prevents damage to the Arduino (more details later)

Breadboard (mini breadboard used in this instructable)
Allows testing of electronic components without soldering

Two Jumper Wires
Connect the Arduino with electric components on breadboard

USB Cable
Allows code (known as sketches) to be loaded to the Arduino from the computer

Arduino IDE
This program allows you to script sketches and load them to the Arduino. It can be found here at arduino.cc for Mac, Linux, and PC.

Finesse

One cannot play the Can Can without finesse!

Step 2: Identify and Research the Questions

Before embarking on any idea for a project, it may be good to figure out what questions need to be answered, and answer those questions before blowing something up.

Questions that came to mind for this project:

-How do I plug the buzzer into the Ardiuno without making something explode?
-How do I make the buzzer make noise?
-How do I load code to the Arduino?
-How do I make the buzzer make musical tones?
-How do I play the Can Can?
-How may I make things more interesting after things work?

Search engines are your friend.

I received an Arduino and buzzer in a starter kit, and had no idea how to plug things in or get things buzzing. Searches on Google helped find information I needed to get started.

Forums

The Arduino.cc forums is a very helpful location to get answers from the people who know things about Arduino.

Chat

As long as you're not a help vampire, chat can be a great resource to get simple answers. The IRC channel #arduino is a great place for Arduino lovers to discuss topics in real time. There are several IRC chat programs available for Mac, Linux, and PC.

Step 3: Figure Out Hardware Requirements

It's important to find out how to plug things in before turning on the power. With LEDs for example, plugging them in backwards and/or without a resistor in place could burn out the LED, making it useless.

The CEM-1203 buzzer used in this instructable will need a resistor as well for the Arduino's sake. Without a resistor, there will be too much current for the Arduino's AVR (Advanced RISC Architecture) to handle. We know this because of Ohm's law, reading the hardware documentation, and asking the experts.

Ohm's Law (and variations)

voltage = current * resistance
resistance = voltage / current
current = voltage / resistance (we're interested in this one right now)

Using Hardware Documentation

According to the buzzer documentation located here, the 'coil resistance' is 42R +- (plus or minus) 6.3. The max amount of current the Arduino AVR can handle is 40mA, found here in section 28.

Asking the Experts

It was helpful to ask experts questions who helped fill in the gaps. To fill in the voltage part of the formula, it is known that the supplied power through the Arduino is 5 volts.

The Resulting Math

current = 5 volts / 42 amps resistance = .119A, or 119mA (milliamps)

Ouch! That makes 79mA too much current for the Arduino. Using the buzzer like this could damage the Arduino long term.

Add a Resistor


We'll need to add a 100R resistor (100.0 Ohms, the 'R' is treated like a decimal e.g. 5R5 = 5.5).

100 resistor amps resistance + 42 buzzer amps resistance = 142A

5 / 142 = 35.2mA

We can work with this! Also, I was able to use a 330R resistor that came with my Arduino starter kit. It's more resistance than needed, and results in a softer buzz. (Special thanks to Eduardo for supplying the 100R resistor used in this intructable!)

Now that the hardware requirements are figured out, it's time to connect things in the next step.


Step 4: Plug in the Buzzer

Direction to Plug Things In

The direction things are plugged in matters in many cases. In general, the '-' negative side goes to ground, and the '+' side goes to the power source. This is not so much the case in this instructable. The resistor may be plugged in any direction, resisting the same either way. The buzzer will also buzz in any direction. For consistency, we'll be plugging the negative side of the buzzer toward the GND (ground) pin. If there were multiple buzzers, they'd all have to be plugged in the same direction.

Make Connections

Connect a wire (blue wire in photo below) from pin 4 to the breadboard.

Connect the other side of the wire to the 100R resistor.

Connect the 100R resistor to the buzzer.

Conntect the buzzer to the other (yellow in photo) wire.

Connect the wire to the GND pin on the Arduino.

Cool off with a glass of cold water... far away from the Arduino.

Step 5: Create Starting Sketch

To answer the question, "How do I make the buzzer make noise?", I did a Google Search for [CEM-1203 arduino make noise]. Near the top there was a blog link labeled Buzzer Arduino Example Code written by Ron Faludi. Ron shared his code here (Thanks Ron! You're awesome!). 

Copy between the lines:

----------------copy after this line----------------

// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com

void setup() {
  pinMode(4, OUTPUT); // set a pin for buzzer output
}

void loop() {
  buzz(4, 2500, 500); // buzz the buzzer on pin 4 at 2500Hz for 1000 milliseconds
  delay(1000); // wait a bit between buzzes
}

void buzz(int targetPin, long frequency, long length) {
  long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
  //// 1 second's worth of microseconds, divided by the frequency, then split in half since
  //// there are two phases to each cycle
  long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
  //// multiply frequency, which is really cycles per second, by the number of seconds to
  //// get the total number of cycles to produce
 for (long i=0; i < numCycles; i++){ // for the calculated length of time...
    digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram
    delayMicroseconds(delayValue); // wait for the calculated delay value
    digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram
    delayMicroseconds(delayValue); // wait againf or the calculated delay value
  }
}

----------------copy before this line----------------

Copy and paste this code into the Arduino IDE, and save the sketch as some descriptive name like 'buzzerExample'. Descriptive names will help in the future once you have many files in one place to sort through.

Step 6: Load Sketch and Make Noise



Connect the Arduino to the computer using the USB cable.

With the Arduino IDE window active, select Tools > Board > [your Arduino board here]. In my case it was 'Arduino Duemilanove or Nano w/ ATmega328'.

Then select Tools > Serial Port > [your Arduino connected USB port here]. This step was trial and error for me, selecting a different port until the code loaded to the Arduino without error (see below).

Click the Upload icon to load the sketch to the arduino. If you see an error message, select a different port and try again at Tools > Serial Port > [your Arduino connected USB port here].

If it worked out, you should see one or more LEDs on the Arduino flash a few times as it loads, then a wonderful repeating BEEP! Magnifique!

Step 7: Understand the Starting Sketch

Here's a quick run down of the code that was just uploaded section by section.

----------------
// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com
----------------

The above section is ignored by the compiler. Any line starting with '//' is ignored, used for making comments. Commenting the code is great for describing what's going on for your future reference, and for others looking at your code.

----------------
void setup() {
    pinMode(4, OUTPUT); // set a pin for buzzer output
}
----------------

Anything run in the built in setup() funtion is only run once when the Arduino is booted. pinMode(11, OUTPUT); sets pin 11 on the Arduino as an output pin. The guts of every function, setup() included, are held between the opening '{' and closing '}'.

----------------
void loop() {
    buzz(4, 2500, 500); // buzz the buzzer on pin 4 at 2500Hz for 500 milliseconds
    delay(1000); // wait a bit between buzzes
}
----------------

The built in loop() function is run over and over as long as the Arduino is powered. In this example, the custom buzz() function is called (see below), followed by Arduino's built in delay() function. The delay() function pauses the script for a specified number of miliseconds. In this case, 1000 miliseconds, or 1 second.

----------------
void buzz(int targetPin, long frequency, long length) {
    ...
}
----------------

The buzz() function is a custom function that Ron created, requiring three arguments: targetPin, frequency, and length. Each argumant is given a data type (int, long, and long). See Ron's code comments in the sketch (or image in this step) for details on how the buzz is generated. More information about data types and scripting is available here.

Step 8: Play Musical Notes



Since the buzz() function in the example sketch allows a pitch frequency to be specified, it's time to look up what frequencies make musical notes and test out a musical scale.

Searching Google for [musical note frequencies] revealed this great chart containing the frequencies of a large musical range. That helped answer the question, "How do I make the buzzer make musical tones?".

One sketch to play an octave of notes could look like this:

----------------copy after this line----------------

// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com

// Additions by Christopher Stevens
// http://www.christopherstevens.cc

void setup() {
    pinMode(4, OUTPUT); // set a pin for buzzer output
}

void loop() {
    buzz(4, 996, 1000); //pin, note frequency, play length in miliseconds
    buzz(4, 1050, 1000);
    buzz(4, 1110, 1000);
    buzz(4, 1180, 1000);
    buzz(4, 1250, 1000);
    buzz(4, 1320, 1000);
    buzz(4, 1400, 1000);
    buzz(4, 1490, 1000);
    buzz(4, 1580, 1000);
    buzz(4, 1670, 1000);
    buzz(4, 1770, 1000);
    buzz(4, 1870, 1000);
    delay(1000); // wait a bit between buzzes
}

void buzz(int targetPin, long frequency, long length) {
    long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
    //// 1 second's worth of microseconds, divided by the frequency, then split in half since
    //// there are two phases to each cycle
    long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
    //// multiply frequency, which is really cycles per second, by the number of seconds to
    //// get the total number of cycles to produce
    for (long i=0; i < numCycles; i++){ // for the calculated length of time...
        digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram
        delayMicroseconds(delayValue); // wait for the calculated delay value
        digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram
        delayMicroseconds(delayValue); // wait againf or the calculated delay value
    }
}

----------------copy before this line----------------

That would work, but looking up the frequencies on a chart every time a note is created would be too cumbersome for some. The sketch below adds an array of frequencies for reference, and a new playNote() function that plays a referenced frequency in the array by number, and calls the buzz function with that frequency.

One note about arrays, is that they start with 0, not 1. So the first item in noteFreqArr below would be referenced as noteFreqArr[0], the second would be noteFreqArr[1], and so on.

----------------copy after this line----------------

// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com

//referenced from http://www.phy.mtu.edu/~suits/notefreqs.html
//starting with F noteFreqArr[0]
int noteFreqArr[] = {
49.4, 52.3, 55.4, 58.7, 62.2, 65.9, 69.9, 74, 78.4, 83.1, 88, 93.2,
98.8, 105, 111, 117, 124, 132, 140, 148, 157, 166, 176, 186,
198, 209, 222, 235, 249, 264, 279, 296, 314, 332, 352, 373,
395, 419, 444, 470, 498, 527, 559, 592, 627, 665, 704, 746,
790, 837, 887, 940, 996, 1050, 1110, 1180, 1250, 1320, 1400, 1490,
1580, 1670, 1770, 1870, 1990, 2100};

void setup() {
    pinMode(4, OUTPUT); // set a pin for buzzer output
}

void playNote(int noteInt, long length, long breath = 0) {
    length = length - breath;
    buzz(4, noteFreqArr[noteInt], length);
    if(breath > 0) { //take a short pause or 'breath' if specified
        delay(breath);
    }
}

void loop() {
    playNote(52, 1000);
    playNote(53, 1000);
    playNote(54, 1000);
    playNote(55, 1000, 100);
    playNote(56, 1000);
    playNote(57, 1000);
    playNote(58, 1000);
    playNote(59, 1000, 100);
    playNote(60, 1000);
    playNote(61, 1000);
    playNote(62, 1000);
    playNote(63, 1000, 100);
    delay(1000); // wait a bit between buzzes
}

void buzz(int targetPin, long frequency, long length) {
    long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
    //// 1 second's worth of microseconds, divided by the frequency, then split in half since
    //// there are two phases to each cycle
    long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
    //// multiply frequency, which is really cycles per second, by the number of seconds to
    //// get the total number of cycles to produce
    for (long i=0; i < numCycles; i++){ // for the calculated length of time...
        digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram
        delayMicroseconds(delayValue); // wait for the calculated delay value
        digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram
        delayMicroseconds(delayValue); // wait againf or the calculated delay value
    }
}

----------------copy before this line----------------

Cool! Now to make some music in the next step...

Step 9: Play the Can Can



It's time to make some music! Using a grand piano (or Garage Band in my case), listen to the different notes you want to create. Play the song by ear, or look it up on sheet music. For each note you wish to create, count from the first note in the array, F, to figure out which note integer in the array matches the note being played on the piano.

NoteInt Example: 

G = ??: We'll figure this out.
F = 0
Add an octave (12) to make the pitch more pleasing on this buzzer = 12
G is 2 keys higher than F (black and white key) on the keyboard, so add 2 = 14
G = 14

For play length in this example:

a sixteenth note = 250 miliseconds
an eighth note = 500 miliseconds
a quarter note = 1000 miliseconds
a half note = 2000 miliseconds
a whole note = 4000 miliseconds

Also, the default 'breath' length in the playNote() function has been changed to 20, to give a slight pause between each note to give a 'tee-tee-tee-tee' effect when playing. Here are the results:

----------------copy after this line----------------


// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com

// Additions by Christopher Stevens
// http://www.christopherstevens.cc

//referenced from http://www.phy.mtu.edu/~suits/notefreqs.html
//starting with F noteFreqArr[1]
int noteFreqArr[] = {
49.4, 52.3, 55.4, 58.7, 62.2, 65.9, 69.9, 74, 78.4, 83.1, 88, 93.2,
98.8, 105, 111, 117, 124, 132, 140, 148, 157, 166, 176, 186,
198, 209, 222, 235, 249, 264, 279, 296, 314, 332, 352, 373,
395, 419, 444, 470, 498, 527, 559, 592, 627, 665, 704, 746,
790, 837, 887, 940, 996, 1050, 1110, 1180, 1250, 1320, 1400, 1490,
1580, 1670, 1770, 1870, 1990, 2100};

void setup() {
  pinMode(4, OUTPUT); // set a pin for buzzer output
}

void playNote(int noteInt, long length, long breath = 20) {
  length = length - breath;
  buzz(4, noteFreqArr[noteInt], length);
  if(breath > 0) { //take a short pause or 'breath' if specified
    delay(breath);
  }
}

void loop() {
  //main course
  playNote(24,500);
 
  playNote(17,1000);
  playNote(19,250);
  playNote(22,250);
  playNote(21,250);
  playNote(19,250);
  playNote(24,500);
  playNote(24,500);
  playNote(24,250);
  playNote(26,250);
  playNote(21,250);
  playNote(22,250);
  playNote(19,500);
  playNote(19,500);
  playNote(19,250);
  playNote(22,250);
  playNote(21,250);
  playNote(19,250);
  playNote(17,250);
  playNote(29,250);
  playNote(28,250);
  playNote(26,250);
  playNote(24,250);
  playNote(22,250);
  playNote(21,250);
  playNote(19,250);
 
  playNote(17,1000);
  playNote(19,250);
  playNote(22,250);
  playNote(21,250);
  playNote(19,250);
  playNote(24,500);
  playNote(24,500);
  playNote(24,250);
  playNote(26,250);
  playNote(21,250);
  playNote(22,250);
  playNote(19,500);
  playNote(19,500);
  playNote(19,250);
  playNote(22,250);
  playNote(21,250);
  playNote(19,250);
  playNote(17,250);
  playNote(24,250);
  playNote(19,250);
  playNote(21,250);
  playNote(17,250);
  delay(250);
}

void buzz(int targetPin, long frequency, long length) {
  long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
  //// 1 second's worth of microseconds, divided by the frequency, then split in half since
  //// there are two phases to each cycle
  long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
  //// multiply frequency, which is really cycles per second, by the number of seconds to
  //// get the total number of cycles to produce
  for (long i=0; i < numCycles; i++){ // for the calculated length of time...
    digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram
    delayMicroseconds(delayValue); // wait for the calculated delay value
    digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram
    delayMicroseconds(delayValue); // wait againf or the calculated delay value
  }
}

----------------copy before this line----------------


The Arduino is now playing the Can Can, but it is still... blah blah. The next step gives the notes a bit more texture.

Step 10: Enhance, Texturize, Dance!



Now that the Arduino plays the Can Can, it's time to finish with finesse!

To make things more interesting, the playNote() function in the code below plays each note in 4 octaves, sequencing through octaves rapidly to give an interesting texture to the sound. Additionally, 4 play modes have been added to play the main course of the Can Can in different octave patterns. The possibilities are almost limitless. Try it out and enjoy!

----------------copy after this line----------------

// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com

// Additions by Christopher Stevens
// http://www.christopherstevens.cc

//referenced from http://www.phy.mtu.edu/~suits/notefreqs.html
//starting with F noteFreqArr[1]
int noteFreqArr[] = {
49.4, 52.3, 55.4, 58.7, 62.2, 65.9, 69.9, 74, 78.4, 83.1, 88, 93.2,
98.8, 105, 111, 117, 124, 132, 140, 148, 157, 166, 176, 186,
198, 209, 222, 235, 249, 264, 279, 296, 314, 332, 352, 373,
395, 419, 444, 470, 498, 527, 559, 592, 627, 665, 704, 746,
790, 837, 887, 940, 996, 1050, 1110, 1180, 1250, 1320, 1400, 1490,
1580, 1670, 1770, 1870, 1990, 2100};

long mode = 0;

void setup() {
  pinMode(4, OUTPUT); // set a pin for buzzer output
}

void playNote(long noteInt, long length, long mode, long breath = 25) {
  length = length - breath;
 
  long noteInt2 = noteInt + 12; //1 octave up
  long noteInt3 = noteInt + 24; //2 octaves up
  long noteInt4 = noteInt + 36; //3 octaves up
 
  long playLoop = length / 100; //divide length by 4, for use in play sequence
 
  if(mode == 0) { //mode 0 sequence
    for (long i=0; i < playLoop; i++){
      buzz(4, noteFreqArr[noteInt], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt2], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt3], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt4], 20);
      delay(5);
    }
  } else if(mode == 1) { //mode 1 sequence
    for (long i=0; i < playLoop; i++){
      buzz(4, noteFreqArr[noteInt3], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt4], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt3], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt4], 20);
      delay(5);
    }
  } else if(mode == 2) { //mode 2 sequence
    for (long i=0; i < playLoop; i++){
      buzz(4, noteFreqArr[noteInt3], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt3], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt3], 20);
      delay(5);
      buzz(4, noteFreqArr[noteInt2], 20);
      delay(5);
    }
  } else if(mode == 3) { //mode 3 sequence
    for (long i=0; i < playLoop; i++){
      buzz(4, noteFreqArr[noteInt4], 40);
      delay(5);
      buzz(4, noteFreqArr[noteInt2], 40);
      delay(5);
    }
  }
  if(breath > 0) { //take a short pause or 'breath' if specified
    delay(breath);
  }
}

void loop() {
  //main course
  playNote(12, 500, mode);
 
  playNote(5, 1000, mode);
  playNote(7, 250, mode);
  playNote(10, 250, mode);
  playNote(9, 250, mode);
  playNote(7, 250, mode);
  playNote(12, 500, mode);
  playNote(12, 500, mode);
  playNote(12, 250, mode);
  playNote(14, 250, mode);
  playNote(9, 250, mode);
  playNote(10, 250, mode);
  playNote(7, 500, mode);
  playNote(7, 500, mode);
  playNote(7, 250, mode);
  playNote(10, 250, mode);
  playNote(9, 250, mode);
  playNote(7, 250, mode);
  playNote(5, 250, mode);
  playNote(17, 250, mode);
  playNote(16, 250, mode);
  playNote(14, 250, mode);
  playNote(12, 250, mode);
  playNote(10, 250, mode);
  playNote(9, 250, mode);
  playNote(7, 250, mode);
 
  playNote(5, 1000, mode);
  playNote(7, 250, mode);
  playNote(10, 250, mode);
  playNote(9, 250, mode);
  playNote(7, 250, mode);
  playNote(12, 500, mode);
  playNote(12, 500, mode);
  playNote(12, 250, mode);
  playNote(14, 250, mode);
  playNote(9, 250, mode);
  playNote(10, 250, mode);
  playNote(7, 500, mode);
  playNote(7, 500, mode);
  playNote(7, 250, mode);
  playNote(10, 250, mode);
  playNote(9, 250, mode);
  playNote(7, 250, mode);
  playNote(5, 250, mode);
  playNote(12, 250, mode);
  playNote(7, 250, mode);
  playNote(9, 250, mode);
  playNote(5, 250, mode);
  delay(250);
 
  if(mode == 0) {
    mode = 1;
  } else if(mode == 1) {
    mode = 2;
  } else if(mode == 2) {
    mode = 3;
  } else if(mode == 3) {
    mode = 0;
  }
}

void buzz(int targetPin, long frequency, long length) {
  long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
  //// 1 second's worth of microseconds, divided by the frequency, then split in half since
  //// there are two phases to each cycle
  long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
  //// multiply frequency, which is really cycles per second, by the number of seconds to
  //// get the total number of cycles to produce
  for (long i=0; i < numCycles; i++){ // for the calculated length of time...
    digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram
    delayMicroseconds(delayValue); // wait for the calculated delay value
    digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram
    delayMicroseconds(delayValue); // wait againf or the calculated delay value
  }
}

----------------copy before this line----------------


All finished! Now get on the floor, stage, or furniture of choice, and celebrate with dance!

Step 11: Credits and Resources

Sources

Buzzer Arduino Example Code by Rob Faludi
http://www.faludi.com/2007/04/23/buzzer-arduino-example-code/

Physics of Music - Notes by B. H. Suits, Physics Department, Michigan Technological University
http://www.phy.mtu.edu/~suits/Physicsofmusic.html

Arduino.cc
http://www.arduino.cc

Special Thanks

Special thanks to Royalty Free Classical Music for a discounted rate on music to use in the video tutorial that accompany this instructable.
http://www.RoyaltyFreeClassicalMusic.co.uk

Special thanks to Eduardo Alves for supplying the 100R resistor used in this instructable!

Also, mucho special thanks to the helpful people at the Arduino.cc forums, and IRC channel #arduino .

Comments

author
SergioR3 (author)2014-08-23

When you say it would damage the arduino, you mean definitly? or could damage some part of it? I ask because i been connecting the buzzer directly into a digital pin and gnd and never had a problem.

PD: I'm noob at arduino yet.

author
awsomehighvoltage (author)2012-05-15

it sounds a lot better with a regular 8 ohm speaker. no resistor needed.

author
michielrutjes (author)2011-11-27

The guy's name is "Rob", not "Ron" Faludi ;) Excellent instructable!

author
Ninja1507 (author)2011-09-02

Lol crap, all I have is 100- 200k resistors -.- Will get some lower ones later haha. Great ible though, I'm just starting out with arduino so I've been looking around at cheap ideas I can do to get the hang of it before I embark on my own project.

author
imalan54 (author)2011-04-06

Awesome instructable. I just bought a Arduino Duemilanove and tried this.
But instead of a buzzer I used a 8 ohm speaker from a laptop. I added in a 5ohm resistor and it only draws between 26 to 33 ma, and it sounds awesome. Nice job!
AL

author
Emiliano Valencia (author)2011-03-31

Men this is exactly what i was looking for, 5 stars!!!!

Great 'ible!!

author
gabrielsan (author)2011-03-09

Wow, AWESOME. I laugh out loud when the can can started to play, cant believe it. Incredible job!

author
Jedrokivich (author)2011-03-08

Wow, great Instructable! Especially like the "finesse" bit!

author
renatoferreira (author)2010-12-08

OMG!!! I have only a 10R resistor....

author
Dylan552 (author)2010-04-17

 So if my sensor uses 100uA that equals .1mA right?
Second that means i dont need a resistor?
THANKS! :D

author
marc.cryan (author)2009-10-30

Nicely done! 

author
Jodex (author)2009-10-27

Very good instructable!

author
macattackct (author)2009-10-26

there is actually a much easier way to do this.  This was my first project on the Arduino Duecimilia

author
Ultrus (author)macattackct2009-10-26

Hello macattackct,
Writing tutorials and getting feedback helps me learn the stuff. I'd enjoy your input. How would I make it simpler?

About This Instructable

77,551views

32favorites

License:

Bio: Web developer and designer who loves renovating and empowering over-sized web projects. Experience in developing and integrating ground breaking creative solutions online. Enjoys solving complex ... More »
More by Ultrus:Play the French Can Can Using an Arduino and Buzzer
Add instructable to: