Programm displaying morse communication via Arduino?

Hello!

I am a bit lost and really need help and/or advice going forward.
I am trying to help a friend who was diagnosed with locked-in-syndrom.
While almost completely paralyzed, he is fully aware and able to move his thumb slightly which is why I would like to establish morse communication!

Through the great Arduino community, I was able to build a morse module (with a touch sensor) and, using Vladimir Krsmanovic' sketch, the program recognizes the morse patterns and writes the corresponding letter into the serial monitor.

Now I need to ditch the serial monitor-approach (since it's not practical enough) and provide him with a proper windows program which displays the morse alphabet on the left and the Arduinos input on the right-hand side.

This would enable him to see the morse-alphabet, put in the needed combination of code and see the corresponding letter simultaneously appear on the right-hand side of the display.

He needs the program to be able to practise and train his muscles.
In time the error rate will go down and we can move onto scrolling devices and the like but for now we'd need something like this:

The program would differentiate short and long pauses between signals, either starting a new letter or a new word.

Essentially I need almost exactly what Vladimir Krsmanovic' sketch is already doing but I need it displayed in a graphic interface!
(However I don't need the program controlling the arduino!)

How do I do this?
Which language should I use?
How do I make the program use the USB-port for input?
How to I make the program talk to the Arduino?
Can you point me to anything similar?

Thank you for taking the time to read this!
Any knowledge that could help is very much appreciated!

Fintopolis

This is the aforementioned adapted sketch I've been using:

//Made by Vladimir Krsmanovic
const int TouchSensor = 3;    
const int ledPin = 13;      
const int buzzer = 12;

int ledState = HIGH;         
int TouchSensorState = LOW;             
int lastTouchSensorState = LOW;  
int doesitwork = LOW;  // variable used for debuging early versions of the code

int pause_value = 250;  // depending on your skill and how fast your fingers are you can change this value to make typing a message faster or slower
long signal_length = 0;
long pause = 0;

String morse = "";
String dash = "-";
String dot = "*";

boolean cheker = false;
boolean linecheker = false;

long lastDebounceTime = 0;  
long debounceDelay = 50;    
void setup()
{
  Serial.begin(9600);
  
  pinMode(TouchSensor, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(buzzer, OUTPUT);
  
  
  while(!digitalRead(TouchSensor))
    ;
  
}

void loop() {
 
  TouchSensorState = digitalRead(TouchSensor);

  
  
  if (TouchSensorState && lastTouchSensorState)       // basic state machine depending on the state of the signal from the button
  {
    ++signal_length;       
    if (signal_length<2*pause_value)        //this help to notice that there is a change in the signal length aka that its not a dot anymore but a dash
    {                                       // best use for the measuring of signal_length would be use of the millis() but this was used  for simplicity 
    tone(buzzer, 400) ;
    }
    else
    {
      tone(buzzer, 300) ;
      }
  }
  else if(!TouchSensorState && lastTouchSensorState)          //this part of the code happens when the button is released and it send either * or - into the buffer
  {
     
     if (signal_length>50 && signal_length<2*pause_value )
     {
       morse =  morse + dot;
     } 
      else if (signal_length>2*pause_value)
      {
        morse = morse +  dash;
      }
    signal_length=0; 
    digitalWrite(13, LOW); 
    noTone(buzzer); 
  }
  else if(TouchSensorState && !lastTouchSensorState)          // this part happens when the button is pressed and its use to reset several values
  {
    pause=0;
    digitalWrite(13, HIGH);  
    cheker = true;
    linecheker = true;
  }
  else if (!TouchSensorState && !lastTouchSensorState)
  {  
    ++pause;
    if (( pause>3*pause_value ) && (cheker))
    { 
      printaj(morse);
      cheker = false;
      morse = "";
    }
    if ((pause>15*pause_value) && (linecheker))
    {
      Serial.println();
      linecheker = false;
    }
  }
  lastTouchSensorState=TouchSensorState;
  delay(1);
}
void printaj(String prevodilac)   //ugly part of the code but it works fine
{                                 //compare morse string to known morse values and print out the letter or a number 
                                  //the code is written based on the international morse code, one thing i changed is that insted of typing a special string to end the line it happens with enough delay  
  if (prevodilac=="*-")
    Serial.print("A");
  else if (prevodilac=="-***")  
    Serial.print("B");
  else if (prevodilac=="-*-*")  
    Serial.print("C");
  else if (prevodilac=="-**")  
    Serial.print("D");
  else if (prevodilac=="*")  
    Serial.print("E");
  else if (prevodilac=="**-*")  
    Serial.print("F");
  else if (prevodilac=="--*")  
    Serial.print("G");
  else if (prevodilac=="****")  
    Serial.print("H");
  else if (prevodilac=="**")  
    Serial.print("I");
  else if (prevodilac=="*---")  
    Serial.print("J");
  else if (prevodilac=="-*-")  
    Serial.print("K");
  else if (prevodilac=="*-**")  
    Serial.print("L");
  else if (prevodilac=="--")  
    Serial.print("M");
  else if (prevodilac=="-*")  
    Serial.print("N");
  else if (prevodilac=="---")  
    Serial.print("O");
  else if (prevodilac=="*--*")  
    Serial.print("P");
  else if (prevodilac=="--*-")  
    Serial.print("Q");
  else if (prevodilac=="*-*")  
    Serial.print("R");
  else if (prevodilac=="***")  
    Serial.print("S");
  else if (prevodilac=="-")  
    Serial.print("T");
  else if (prevodilac=="**-")  
    Serial.print("U");
  else if (prevodilac=="***-")  
    Serial.print("V");
  else if (prevodilac=="*--")  
    Serial.print("W");
  else if (prevodilac=="-**-")  
    Serial.print("X");
  else if (prevodilac=="-*--")  
    Serial.print("Y");
  else if (prevodilac=="--**")  
    Serial.print("Z");

  else if (prevodilac=="*----")  
    Serial.print("1");
  else if (prevodilac=="**---")  
    Serial.print("2");
  else if (prevodilac=="***--")  
      Serial.print("3");
  else if (prevodilac=="****-")  
    Serial.print("4");
  else if (prevodilac=="*****")  
    Serial.print("5");
  else if (prevodilac=="-****")
    Serial.print("6");
  else if (prevodilac=="--***")  
    Serial.print("7");
  else if (prevodilac=="---**")  
    Serial.print("8");
  else if (prevodilac=="----*")  
    Serial.print("9");
  else if (prevodilac=="-----")  
    Serial.print("0");
  
  Serial.print(" ");
    
  prevodilac=""; 
}

It's a fine project to help Your friend.
The main idea is communication.
Using Morse code isn't really any help I think.
Suppose that one kind of button pressing advances a pointer across a keyboard layout and another type of pressing sends that character.....

Yes, like if he can “press and hold” the highlight moves over the abc etc and when he releases selects

Hi @fintopolis, great project!

The choice of language usually depends on the pre- knowledge:

If it is C++ Microsoft Visual Studio C++ could be a good tool.

If it is Delphi/FreePascal Lazarus is easy to handle.

And there's also Python available.

All these languages do have libraries for serial communication that can interface with the Arduino, read, display and evaluate the data.

As mentioned by the other members already, you can also use the Arduino serial link to control an input array of characters without complete Morse coding, e.g. by using different, easy to learn codes for left, right, up, down, enter and delete... You could even couple it with a library of words to speed up inputs ...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.