Project tutorial
A Tone Generator With LCD Display!

A Tone Generator With LCD Display! © CC BY

This is a tone selector with the ability to change the buzzer frequency by a potentiometer and to see the result on a 16x2 display.

  • 3,015 views
  • 0 comments
  • 8 respects

Components and supplies

About this project

Tone Selector with LCD

This is a small tone selector with the ability to change the frequency by a potentiometer and to see the result on a 16x2 display. It also has an automatic testing mode at the beginning.

Demo

Please watch the video till the end (less than a minute) to see what it can do:

The project is pretty straight forward:

Arduino reads the analog data from the potentiometer and the program transforms it into a frequency to be played by the buzzer (in a range of 20-2000 Hz). The program provides the thresholds on lower and on higher frequencies.

It starts with a test sequence that it sends to the buzzer a wave of notes and then the program listens to the potentiometer values.

The display shows the frequence played at the moment.

I used a trimmer to adjust the display contrast (at the beginning it usually doesn't show anything because of the too high contrast, so it needs to be adjusted. 

The buzzer is a Elegoo passive buzzer connected using only 2 pins as a standard buzzer (so, any buzzer can be used as well).

The potentiometer is a 10Kohm linear and it works pretty well in this range, but I adjusted the scale on the program so to double it because of the original range too low (0-1024).

The arduino Sketch built-in library "Tone" has been used for the buzzer and the LiquidCrystal library for the 16x2 display.

It can be used as a base to learn synth music or to build a proper synth with other controls for changing the basic square wave and to add some loops like in a sequencer. 

This project can be viewed also on my website: http://www.gianpa.com/a-tone-generator-with-lcd-display/

Login to post a comment...

Code

Arduino CodeArduino
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int ccc = 1;
int sensorPin = A0;
int sensorValue = 0;
int freq = 0;
const int buzzer = 7;

void playTone(int freqq){
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Freq");
  lcd.setCursor(0, 1);
  tone(buzzer, freqq);
  lcd.print(freqq);
}

void setup() {
  pinMode(buzzer, OUTPUT);
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Testing...");
  delay(1000);
  for (int freqq = 256; freqq <= 512; freqq++) {
    playTone(freqq);
    delay(10);
  }
  for (int freqq = 512; freqq >= 256; freqq--) {
    playTone(freqq);
    delay(10);
  }
  noTone(buzzer);
  lcd.setCursor(0, 0);
  lcd.clear();
  lcd.print("Ready in 3");
  delay(1000);
  lcd.clear();
  lcd.print("Ready in 2");
  delay(1000);
  lcd.clear();
  lcd.print("Ready in 1");
  delay(1000);
}

void loop() {
  sensorValue = analogRead(sensorPin);
  freq = ceil(sensorValue/5)*5*2;
  if (freq>2000) {
    freq = 2000;
  }
  if (freq<20) {
    freq = 20;
  }
  playTone(freq);
  delay(20);
}

Schematics

schematics
Buzzerpotentiometerdisplayfrequency bb cx9eioaygw

Comments

Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 455,691 views
  • 42 comments
  • 241 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 285,619 views
  • 95 comments
  • 672 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 231,200 views
  • 38 comments
  • 241 respects

OpenCat

Project in progress by Team Petoi

  • 197,046 views
  • 154 comments
  • 1,370 respects
Add projectSign up / Login