Play Frequency Tones Using a Simple Keyboard & Arduino

by RonFrtek in Circuits > Arduino

577 Views, 1 Favorites, 0 Comments

Play Frequency Tones Using a Simple Keyboard & Arduino

Play Frequency Tones Using a Simple Keyboard & Arduino

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

Watch the Video!

What You Will Need

pctdetail.772-140.1.jpg
piezo.jpg
FZEK4WBK3XGYAP0.LARGE.jpg
FMT2X9VKEY93G5P.jpg
VisuinoAdvrtisementVersion8.jpg
  • 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

Circuit

2021-05-19_15-07-23.jpg

  • 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]

Start Visuino, and Select the Arduino UNO Board Type

FCH7XQEK5ADILIH.LARGE.jpg
F311FBVK5AHN5HJ.LARGE.jpg

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

In Visuino Add, Set & Connect Components

2021-07-28_20-42-34.jpg
2021-07-28_20-48-05.jpg
2021-07-28_20-48-18.jpg
play-tone.png
2021-05-19_14-59-28.jpg
  • Add "Play Frequency Tone" component
  • 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]

Generate, Compile, and Upload the Arduino Code

FOQOHC1KLWB8FIX.jpg

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.

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 Instructable, you can download it and open it in Visuino: https://www.visuino.eu