In this tutorial we will learn how to play a diferent frequency tones with the Arduino.
Watch the Video!
Step 1: What You Will Need
Step 1: What You Will Need
- 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
- Visuino software: Download here
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
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
- 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]
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 Instructable, you can download it and open it in Visuino: https://www.visuino.eu
Download keyboard-sound.zip