gtentacle
Published © GPL3+

Adaptive Button Keyboard for Kids with Muscular Conditions

A simple 5 button USB keyboard using Logitech Adaptive Gaming Kit for kids with muscular conditions like myopathy or muscular dystrophy.

BeginnerFull instructions provided1,650
Adaptive Button Keyboard for Kids with Muscular Conditions

Things used in this project

Hardware components

Arduino Micro
Arduino Micro
Arduino micro or any Arduino with ATmega32U4 that makes recognizable as a mouse or keyboard
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×5

Story

Read more

Schematics

Scheme

Considering my lack of experience in electronics, I'm sure there is some way to optimize the scheme. But this is the one that works well for me at the moment.

Rough sketch

Code

Code

Arduino
Note that some variables are in catalan. 'Boto' means 'Button', 'Fila' means 'Row', 'Columna' means 'Column', 'StatusAnterior' means 'LastStatus'
#include "Keyboard.h"

// constants won't change. They're used here to set pin numbers:
const int button1Pin = 2;     // the number of the pushbutton pin
const int button2Pin = 3;     // the number of the pushbutton pin
const int button3Pin = 4;     // the number of the pushbutton pin
const int button4Pin = 5;     // the number of the pushbutton pin
const int button5Pin = 6;     // the number of the pushbutton pin


// variables will change:
int button1State = 0;         // variable for reading the pushbutton status
int button2State = 0;
int button3State = 0;
int button4State = 0;
int button5State = 0;

int boto1status = 0;
int boto2status = 0;
int boto3status = 0;
int boto4status = 0;
int boto5status = 0;
int boto1statusanterior = 0;
int boto2statusanterior = 0;
int boto3statusanterior = 0;
int boto4statusanterior = 0;
int boto5statusanterior = 0;

int fila = 0;
int columna = 0;


void setup() {
  Serial.begin(9600);
  Keyboard.begin();
  // initialize the pushbutton pin as an input:
  pinMode(button1Pin, INPUT);
  pinMode(button2Pin, INPUT);
  pinMode(button3Pin, INPUT);
  pinMode(button4Pin, INPUT);
  pinMode(button5Pin, INPUT);

}

void loop() {


  // PULSACIO FÍSICA DE BOTONS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  
  button1State = digitalRead(button1Pin);
  button2State = digitalRead(button2Pin);
  button3State = digitalRead(button3Pin);
  button4State = digitalRead(button4Pin);
  button5State = digitalRead(button5Pin);

  boto1statusanterior = boto1status;
  boto2statusanterior = boto2status;
  boto3statusanterior = boto3status;
  boto4statusanterior = boto4status;
  boto5statusanterior = boto5status;

  if (button1State == HIGH) {
    boto1status = 1;
    delay (50);
  } else {
    boto1status = 0;
//    delay (50);
  }
  if (button2State == HIGH) {
    boto2status = 1;
    delay (50);
  } else {
    boto2status = 0;
//    delay (50);
  }
  if (button3State == HIGH) {
    boto3status = 1;
    delay (50);
  } else {
    boto3status = 0;
//    delay (50);
  }
  if (button4State == HIGH) {
    boto4status = 1;
    delay (50);
  } else {
    boto4status = 0;
//    delay (50);
  }
  if (button5State == HIGH) {
    boto5status = 1;
    delay (50);
  } else {
    boto5status = 0;
//    delay (50);
  }


// ASSIGNAR FILES O COLUMNES SEGONS EL BOTÓ PULSAT ++++++++++++++++++++++++++++++++++++++++++++++

  if (boto1statusanterior != boto1status) {
    if (boto1status == 0) {
      if (fila == 0) {
        fila = 1;
      } else {
        columna = 1;
      }
    }
  }  
  if (boto2statusanterior != boto2status) {
    if (boto2status == 0) {
      if (fila == 0) {
        fila = 2;
      } else {
        columna = 2;
      }
    }
  }  
  if (boto3statusanterior != boto3status) {
    if (boto3status == 0) {
      if (fila == 0) {
        fila = 3;
      } else {
        columna = 3;
      }
    }
  }  
  if (boto4statusanterior != boto4status) {
    if (boto4status == 0) {
      if (fila == 0) {
        fila = 4;
      } else {
        columna = 4;
      }
    }
  }  
  if (boto5statusanterior != boto5status) {
    if (boto5status == 0) {
      if (fila == 0) {
        fila = 5;
      } else {
        columna = 5;
      }
    }
  }  


// ESCRIU SEGONS FILA I COLUMNA

    if (fila != 0 && columna != 0) {

      ////// VOCALS
      
      if (fila == 1 && columna == 1) {
        Serial.write("A");
        Keyboard.write('a');
      }
      if (fila == 1 && columna == 2) {
        Serial.write("E");
        Keyboard.write('e');
      }
      if (fila == 1 && columna == 3) {
        Serial.write("I");
        Keyboard.write('i');
      }
      if (fila == 1 && columna == 4) {
        Keyboard.write('o');
        Serial.write("O");
      }
      if (fila == 1 && columna == 5) {
        Keyboard.write('u');
        Serial.write("U");
      }      

      ////// CONSONANTS 1
      
      if (fila == 2 && columna == 1) {
        Serial.write("C");
        Keyboard.write('c');
      }
      if (fila == 2 && columna == 2) {
        Serial.write("D");
        Keyboard.write('d');
      }
      if (fila == 2 && columna == 3) {
        Serial.write("L");
        Keyboard.write('l');
      }
      if (fila == 2 && columna == 4) {
        Serial.write("N");
        Keyboard.write('n');
      }
      if (fila == 2 && columna == 5) {
        Serial.write("R");
        Keyboard.write('r');
      }      

      ////// CONSONANTS 2
      
      if (fila == 3 && columna == 1) {
        Serial.write("S");
        Keyboard.write('s');
      }
      if (fila == 3 && columna == 2) {
        Serial.write("T");
        Keyboard.write('t');
      }
      if (fila == 3 && columna == 3) {
        Serial.write("B");
        Keyboard.write('b');
      }
      if (fila == 3 && columna == 4) {
        Serial.write("F");
        Keyboard.write('f');
      }
      if (fila == 3 && columna == 5) {
        Serial.write("G");
        Keyboard.write('g');
      }      
      
      ////// CONSONANTS 3
      
      if (fila == 4 && columna == 1) {
        Serial.write("M");
        Keyboard.write('m');
      }
      if (fila == 4 && columna == 2) {
        Serial.write("P");
        Keyboard.write('p');
      }
      if (fila == 4 && columna == 3) {
        Serial.write("J");
        Keyboard.write('j');
      }
      if (fila == 4 && columna == 4) {
        Serial.write("X");
        Keyboard.write('x');
      }
      if (fila == 4 && columna == 5) {
        Serial.write("Z");
        Keyboard.write('z');
      }      
      
      fila = 0;
      columna = 0;      
    }
    if (fila == 5) {
      Serial.println();          
      Keyboard.write(10);
      fila = 0;
      columna = 0;      
    }

    
}

Credits

gtentacle

gtentacle

1 project • 4 followers

Comments