Basic Arduino Keyer

Several posts back, we made an Arduino Morse code oscillator. These are great if you are only using a standard straight key. To use a paddle you need a keyer. Today we will build a Basic Arduino Keyer. Construction of the keyer is very similar to the Arduino Oscillator. The main difference is the addition of the extra pin. Most of the changes are in the programming.

Advertisements
Advertisements
//Basic Arduino Keyer 6/9/19
//https://MacarrLabs.com/
//https://KM4NMP.com/
//Author Matthew Carr KM4NMP
//common plug pinouts are:
//  Tip – left lever, or left side of single lever, normally Dot
//  Ring – right lever, or right side of single lever, normally Dash
//  Shaft – common

int LeftPin = 2;  //left paddle push pin
int RightPin = 3; //right paddle push pin
int LeftPinState = 0;
int RightPinState = 0;
int audio = 12;   //audio out pin
int note = 600;   //note pitch change for a different tone
int dotTime;
int dashTime;

Advertisements
void setup() {
  Serial.begin(9600);        //for debugging
  pinMode(LeftPin, INPUT);   //set pin as input
  pinMode(RightPin, INPUT);  //set pin as input
  dotTime = 125;             //dot time in milliseconds
  dashTime = dotTime * 3;
}

void loop() {
  LeftPinState = digitalRead(LeftPin);
  RightPinState = digitalRead(RightPin);

  if (LeftPinState == 1) {
    Serial.print("left ");         //for debugging
    Serial.println(LeftPinState);  //for debugging
    tone(audio, note);             //start tone
    delay(dotTime);                //tone length
    noTone(audio);
  }

  if (RightPinState == 1) {
    Serial.print("Right ");         //for debugging    
    Serial.println(RightPinState);  //for debugging
    tone(audio, note);              //start tone
    delay(dashTime);                //tone length
    noTone(audio);
  } 
  delay(dotTime);                   //time between tones
}
Advertisements

Links

https://km4nmp.com/2019/03/31/arduino-morse-code-practice-oscillator-project/

https://km4nmp.com/2019/04/06/arduino-oscillator-with-morse-code-decoder/

https://www.arduino.cc/

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

Latest Posts

Advertisements

8 thoughts on “Basic Arduino Keyer

  1. Have you tried the KC4IFB iambic sketch?

    Like

    1. No I will have to look it up

      Like

      1. http://www.arrl.org/news/i-qex-i-the-september-october-2009-issue
        QEX issues are not available for download, but I once found a copy on the net by Googling.
        I think anyone can download the code from the QEX software page
        http://www.arrl.org/files/file/QEX%20Binaries/09_September/9x09_Chapman.zip
        THat’s what started me on building Arduino keyers. It is unclear if there is copyright baggage. I have tried several times to contact Chapman with no response.

        Liked by 1 person

      2. Looks interesting. I don’t have a subscription but was able to see several articles about it just by googling. I found one you wrote. I kinda like the crayon box. Over time I will be adding more functions to this project. Too bad, he won’t reply. I have copyrights on my pages but usually have no issue with other sites referring to my content as long as they credit me and have a link to the original content.

        Like

  2. wonderful 73 de F8EZZ

    Liked by 1 person

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 )

Google photo

You are commenting using your Google 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