Close
0%
0%

Playing Music with RTL8722DM

A simple project that plays any music or tone with Ameba RTL8722DM

Public Chat
Similar projects worth following
Pulse-Width Modulation (PWM) can be implemented on the Ameba in several ways. PWM signal is a digital square wave, where the frequency is constant, but that fraction of the time the signal is on (the duty cycle) can be varied between 0 and 1.
The programming language makes PWM easy to use; calling AnalogWrite(pin,dutyCycle).

Ameba RTL8722DM is a low-power dual-band WLAN and Bluetooth Low Energy SoC by Realtek. The RTL8722DM also include memory for Wi-Fi protocol functions and application making it simple for anyone to develop various kind of IoT applications. At the same time it has a wide range of peripheral interfaces. With all these interfaces, it can connect to most of the electronics components like LEDs, temperature and humidity sensors, and so on.

A sound is composed of volume, tone and timbre. Volume is determined by the amplitude of the sound wave. Tone is determined by the frequency of the sound wave. Timbre is determined by the waveform of the sound wave.

In this example, we use PWM to control the buzzer to emit sound with desired tone. As PWM outputs square wave, if we wish to emit tone C4 (frequency=262Hz), we have to make PWM to output square wave with wavelength 1/262 = 3.8ms:

In this project we are going to use PWM to output sound wave with different frequency, so as to play music with the buzzer.

More Resources:

If you need additional technical documents or the source code for this project. Please visit the official websites and join the Facebook group and forum.

  • 1 × Ameba RTL8722DM microcontroller
  • 1 × Buzzer Electronic Components / Misc. Electronic Components
  • 2 × Jumper wire Fiber Optics / Emitters

  • 1
    Setup

    First, make sure that the correct Ameba development board is selected in "Tools" -> "Board"

    Next, Connect the buzzer to the PWM output pin shown in the wiring diagram below:

  • 2
    Programming

    The programming of the Ameba RTL8722DM can be done using Arduino IDE which makes it very easy to write code and upload code to the Ameba Board.

    To open the example code in Arduino IDE, Open "File" -> "Examples" -> "AmebaHttp" -> "SimpleHttpExamples"

  • 3
    Final Results!

    Verify and Upload the code on the Arduino IDE and press the reset button on Ameba.

    Once the upload is complete. You can hear the buzzer playing music.

View all 3 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates