Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Playing music with an AVR microcontroller

Loading...

Sign in or sign up now!
26,712
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 5, 2008

Music is sent via UART to the microcontroller which then does the digital to analog conversion with PWM.

Details:

- microcontroller runs at 18.432 MHz
- sound sample rate is 11520 Hz and precision is 8-bit
- UART baudrate is 115200 bps

Category:

Science & Technology

Tags:

License:

Standard YouTube License

Link to this comment:

Share to:

Uploader Comments (mikoro1)

  • Is the speaker connected to the PWN pin? I see you need your computer, but can you put the music on, for exemple a separated memory? I wanna do an electronic drum with a pic or an AVR but I don't understand how to play music with it. I've heard some "Happy birthday" on a pwm, and it's not what I'm looking for.. I ean I don't wanna have a bad sound for the drum sounds..

    (I'm french..)

    Thx

  • @killthebetrayer Bonjour, yes it is. You can definitely put the music on an external memory. Check out the video response by Peterlsza for example.

  • does it work with arduino?

  • @robot797 Can't see any reason why it shouldn't work

  • I did something very similar to this. I was wondering about your electrical connections: Am I seeing wrong, or are you driving the speaker directly from the AVR I/O pin without a transistor. If so, are you sure the pin is not sourcing too much current?

    AVR models I know are rated at 40 mA per I/O and a speaker this size is typically 8 ohm/0.5W. With these numbers, even at 2.7V, you are outside specifications for both (338 mA, 0.9W)...

  • Yeah, you're right. But it worked, at least for the few hours a played with it. I later did a version with an op-amp in between which had much better sound output. And the controller didn't heat up as much... :)

Top Comments

  • nice project - gay sound

  • Hi, check the AVRFreaks site - especially the forums and its tutorial section.

see all

All Comments (27)

Sign In or Sign Up now to post a comment!
  • hurray for 8-bit music!

  • sounds decent. what's the PWM frequency? clock divider

  • @mikoro1 WOW I see that i've many things to learn about microcontroller.. I know that an electronic drum is not very easy but I have this idea in my head ..

  • @mikoro1 nice what could i do to do that :P

  • @xcape77 ignorant fuck is ignorant

  • Good job on the avr dude it works amazingly well

    how exactly does youtube know the name of the song if it was IN the video?

    they must have a pretty good sound recognition software,

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more