Arduino UNO based Morse Keyer
Автор: Crazy Ham's Electronics
Загружено: 2025-11-30
Просмотров: 200
Описание:
This is a Morse Keyer for paddle key.
Firmware generated by ChatGPT
Link for PA3HCM morse keyer:
https://share.google/KOA97jeNo8VqYpbR0
Code :
/* ============================================================
CW PADDLE KEYER for Arduino UNO
Dot paddle: digital input
Dash paddle: digital input
Key output to transceiver (open collector recommended)
Buzzer output for sidetone
Potentiometer input to adjust speed (WPM)
Iambic Mode B
============================================================ */
const int dotPin = 2; // DOT paddle input
const int dashPin = 3; // DASH paddle input
const int keyOut = 8; // Output to transceiver key jack
const int buzzerOut = 9; // Sidetone buzzer output
const int speedPot = A0; // Potentiometer for speed control
// ----------------------------------------
// Timings
// ----------------------------------------
unsigned int wpm = 15; // Default starting WPM
unsigned int ditTime = 0; // Will be calculated
bool lastDit = false;
bool lastDah = false;
void setup() {
pinMode(dotPin, INPUT_PULLUP);
pinMode(dashPin, INPUT_PULLUP);
pinMode(keyOut, OUTPUT);
pinMode(buzzerOut, OUTPUT);
digitalWrite(keyOut, LOW);
digitalWrite(buzzerOut, LOW);
}
// -----------------------------------------------------
// Generate a keyed element (dit or dah)
// -----------------------------------------------------
void sendElement(unsigned int duration) {
digitalWrite(keyOut, HIGH);
digitalWrite(buzzerOut, HIGH);
delay(duration);
digitalWrite(keyOut, LOW);
digitalWrite(buzzerOut, LOW);
delay(ditTime); // Inter-element spacing
}
// -----------------------------------------------------
// Read paddles with Iambic Mode B latch logic
// -----------------------------------------------------
void loop() {
// Read speed pot (range 5 to 35 WPM)
wpm = map(analogRead(speedPot), 0, 1023, 5, 35);
ditTime = 1200 / wpm; // standard formula for Morse timing
bool dit = !digitalRead(dotPin); // Active LOW
bool dah = !digitalRead(dashPin); // Active LOW
// Iambic latch
if (dit && !lastDit) lastDit = true;
if (dah && !lastDah) lastDah = true;
// -------------------------------------------------
// Process Dit
// -------------------------------------------------
if (lastDit) {
sendElement(ditTime); // dit = 1 unit
lastDit = false;
// Iambic Mode B squeeze: add opposite element if held
if (dah) lastDah = true;
return;
}
// -------------------------------------------------
// Process Dah
// -------------------------------------------------
if (lastDah) {
sendElement(ditTime * 3); // dah = 3 units
lastDah = false;
// Iambic squeeze
if (dit) lastDit = true;
return;
}
// If no paddle pressed, relax CPU
delay(2);
}
--------------------------------------------
Items used
1. Arduino UNO
2. Buzzer
3. Relay 12v
4. Regulator ic 7805
5. Potentiometer 10k two nos
6. Audio ic
Music
YouTube music
Heart and soul
Courtesy
PA3HCM
Ernest Neijenhuis
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: