Arduino CW Keyer

capture_001_12112014_205711

Here is the simplest version of a keyer program. Doing nothing but sense the dot contact closure of the paddle, and send the same signal out to a TX key line.

Nice accessory for the next Straight Key Night?

Welcome Back!

capture_001_11112014_191441

It seemed that my board has recovered by downloading a short test program right after the reset. There was a short window of time in which the board is recognized as a USB device, so perhaps my last program downloaded was doing something bad.

I did not have lines 1, 11, and 13 in the program, but if there is no INT signal applied to the CPU, nothing should go wrong, I suppose.

Leonardo, are you still there?

DSC_9494_rot

While I was running a program, my Leonardo board quit responding abruptly, and the board is no more recognized as a USB device.

The other two boards, Uno compatible ones, are OK, so this should not be a problem with my PC.

The Magic Flute

713omyHigJL._SY606_

When I am extremely or exceptionally unbuy, I start watching a blue-ray disk for some operas.

To tell you the truth, however, I have never completed watching an opera until the very end. Today I aborted after around 90 min, although the run time of the video is 182 min.

http://www.youtube.com/watch?v=fas6zUDa5t8

Contact Bounce

capture_001_08112014_001207

This is a short program to measure the contact bounce of a paddle.

capture_002_08112014_001234

The five digit numbers shows the time in milliseconds. I am manually sending a single dot, of the duration 834 mS, 1052 mS, etc., so there should ideally be only one FALLING EDGE to be detected by an interrupt handler.

Pull Up! Pull Up!

capture_001_06112014_214322

Usually you need either a pull-up or a pull-down resistors for you input pins. With my old K3NG CW Keyer I forgot the details and thought I put some resistors on the board. But actually, the internal pull-up resistors were used for which some care is necessary for your code like:

pinMode(pin, INPUT);           // set pin to input
digitalWrite(pin, HIGH);       // turn on pullup resistors

Or more simply,

pinMode(pin, INPUT_PULLUP);

Anyway, a single touch to the paddle causes several interrupts since there is no circuit implemented on the board to take care of the contact bounce.

Use the Source, Luke!

It is always nice to have the source code with you.

K3NG kindly announces that It’s open source code so you can fully customize it to fit your needs and also perhaps learn from it or find coding ideas for other projects.

So here comes my learning process…

% wc k3ng_keyer.ino
9911  28900 339911 k3ng_keyer.ino

But the main program, k3ng_keyer.ino, has almost 10k lines, so you may hesitate to dive into the code.

gccegg-65

If you comment out all the #define FEATURE_SOMETHING lines, and run the gcc preprocessor only (use -E option) to delete the #ifdef #endif stuff, there remains only 2268 lines, and the main part of the program looks like:

capture_001_05112014_183730

Now, you are tempted to use the source!

Some parts which I found to be interesting are:

capture_002_05112014_195833

capture_004_05112014_200218

Fair is foul, and foul is fair: (2)

HarmOsziFunktionen
http://en.wikipedia.org/wiki/Quantum_harmonic_oscillator

Once you noticed the relationship:

capture_001_04112014_213600

the problems with the perturbations proportional to either x^2 or x^4 are also easy to solve.

capture_002_02112014_214350

capture_002_04112014_214532

By applying the operator x to the state n, you will have the states n+1 and n-1. Therefore, if the operator is x^2, what you will have are the states n+2, n, and n-2.

I will leave it to you what you will get with the operator x^4, and compute the first and the second order energy shift for each case of the perturbations.

K3NG Arduino CW Keyer and Serial Port

capture_001_03112014_193354

Some latest versions of the program do not run properly on my Leonard board.

I suppose there is something wrong with the serial port, but I still can not localize the problem. Replacing “Serial” with “Serial1” improves the situation a little but not completely…

Fair is foul, and foul is fair:

MacbethAndBanquo-Witches

http://en.wikipedia.org/wiki/Macbeth

So perhaps something very easy for one is very difficult for others, and vice versa.

7d435462d91594eed0a07d47c36a5cbd

http://en.wikipedia.org/wiki/Perturbation_theory_(quantum_mechanics)

The equation itself should not be difficult to understand even for undergraduate students, but it took me several hours to solve a simple example such as:

capture_002_02112014_214350

The problem is a harmonic oscillator (the first and second terms of the right-hand side) with a perturbation proportional to x (the third term).

If you only notice that the operator x can be replaced by the lowering and raising operators, you will immediately get:

capture_004_02112014_221429

This is because there are only two non-zero terms in the summation (the third term of the right-hand side of the first equation). Although k goes from 0 to infinity, non-zero terms appear only when k=n-1 and k=n+1.