Play Frequency Tones Using A Simple Keyboard And Arduino

Photo of Ron

Made by Ron / Music / Sensors / Voice

About the project

In this tutorial we will learn how to play a diferent frequency tones with the Arduino. Watch the Video!

Project info

Difficulty: Easy

Platforms: ArduinoVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Arduino UNO Arduino UNO x 1
Jumper wires (generic) Jumper wires (generic) x 1
Piezo buzzer module Piezo buzzer module x 1
Capacitive Touch Keyboard Capacitive Touch Keyboard x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

In this tutorial we will learn how to play a diferent frequency tones with the Arduino.

Watch the Video!

Supplies

Step 1: What You Will Need

1 / 4

  • Arduino UNO or any other Arduino board
  • Buzzer module
  • Small Keyboard (Or any other keyboard) in our case we are using a touch keyboard with 4 keys.
  • Jumper wires

Step 2: Circuit

  • Connect Arduino pin 5V to Keyboard Pin [Vcc] and Piezo module pin [Vcc]
  • Connect Arduino pin GND to Keyboard Pin [GND] and Piezo module pin [GND]
  • Connect Arduino digital pin 8 to Piezo module pin [S]
  • Connect Arduino digital pin 2 to Keyboard Pin [Out1]
  • Connect Arduino digital pin 3 to Keyboard Pin [Out2]
  • Connect Arduino digital pin 4 to Keyboard Pin [Out3]
  • Connect Arduino digital pin 5 to Keyboard Pin [Out4]

Step 3: Start Visuino, and Select the Arduino UNO Board Type

1 / 2

The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 4: In Visuino Add, Set & Connect Components

1 / 2

  • Add "" components
  • Double click on the "PlayFrequency1" component and
  • In the Elements window drag 4X "Play tone state" to the left side, and for each one in the properties set a diferent frequency: 260, 290,330,350
  • Or set some other frequencies that you prefer.
  • Close the Elements window.
  • Connect Arduino Digital pin 2 [Out] to PlayFrequency1 > Play Tone State1 pin [In]
  • Connect Arduino Digital pin 3 [Out] to PlayFrequency1 > Play Tone State2 pin [In]
  • Connect Arduino Digital pin 4 [Out] to PlayFrequency1 > Play Tone State3 pin [In]
  • Connect Arduino Digital pin 5 [Out] to PlayFrequency1 > Play Tone State4 pin [In]
  • Connect PlayFrequency1 pin Out to Arduino Digital pin 8 [In]

Step 5: Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 6: Play

If you power the Arduino module, and press a button on the keyboard the buzzer module will play a tone.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.eu

Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...