Arduino Morse Code Practice Oscillator Project

Last week we went over how to build the 555 practice oscillator. This was a very reliable chip; but, 50 years later, we have many more options. This week we will be building the Arduino Morse Code Practice Oscillator. The Arduino being used in this project is the Arduino UNO. Building the oscillator with the Arduino is just as easy as the 555; but, it has to be programed after construction is complete.

Programing is simple. It requires the Arduino programing software to be installed on your computer. The program can be copied and pasted into the arduino software. There is a spot notated in the program for note/pitch. This value can be changed to vary the note that is played when the key is pressed.

Advertisements
Arduino Board
Pin 2 is connected to 3.5mm jack for key. Pin 3 is connected to a transistor that drives piezo.

We will be using Pin 2 for our key and Pin 3 for or piezo or speaker. For this example, I am using a piezo but a speaker sounds much better. When this is permanently mounted pins will be used for a speaker connector. This project will also be expanded in future posts.

Using a speaker, sound quality better. Using a piezo keeps it compact.
Advertisements

Arduino Code

const int keyPin = 2; // the number of the straight key pin
int audio3 = 3; // output on pin 3
int note = 587; // oscillator note/pitch

// variables will change:
int buttonState = 0; // variable for reading if key is pressed

void setup() {
// initialize the keyPin pin as an input:
pinMode(keyPin, INPUT);

}

void loop() {
// read the state of the keyPin value:
buttonState = digitalRead(keyPin);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn Speaker on:
tone(audio3, note);
} else {
// turn Speaker off:
noTone(audio3);
}
}

Advertisements

Ready to Solder onto a permanent board

https://km4nmp.com/2019/03/24/555-morse-code-practice-oscillator/

https://www.arduino.cc/

https://www.arduino.cc/en/Tutorial/toneMelody

https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/

https://www.tutorialspoint.com/arduino/arduino_tone_library.htm

Latest Posts

3 thoughts on “Arduino Morse Code Practice Oscillator Project

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close