This project has been a really fun but long process on both the fabrication and the programming side. Helen and I are incredibly proud of how it turned out despite all the obstacles with COVID-19 and relocating several times within the process.
As a reminder: We're making a keyboard that can be used only with your feet. You scroll through the characters with a pedal, select with a big button, and delete with another. AS NEXT STEPS: add a shift button for special characters.
I'll start with the structure. As you could probably tell by the previous posts on this project we had very ambitious ideas for the shape of the product. In the end we had to scale down considerably due to resources and the COVID-19 situation. This is what we ended up with, ideally when we see each other again the pedal will be to the right of the white button:
Before getting to this point we tested several positions for the components, initially as a one-foot product and then as a two-feet keyboard.
Eventually we landed on this one we made because it seemed to be the one people agreed on the most. In an ideal world we would've made a customizable product so people could tailor it to what is most comfortable for them.
The way we made this was by laser-cutting the board (MDF) with the holes for the two buttons using this illustrator file. After that we glued two pieces of the material to either end with the angle that we wanted and using square dowels on the corners. After it dried we sanded the edges.
In the beginning we thought of leaving the board bare or painting it but one of our classmates suggested covering it with carpet which was a great idea for comfort and it tells people where this product lives (on the floor) and also adds something else that could be customized in the event that it were to be mass-produced.
-- Video of the program working --
Circuit:
On to the Code:
//This part of the code includes the HID Project library
--------------------------------------------------------------------------
//Pedal Keyboard
#include "HID-Project.h"
----------------------------------------------------------------------
This part declares the pins for the buttons and the pedal inputs
//Inputs // Variables will change: const int buttonPin = 2; const int selectPin = 3; const int deletePin = 4; //const int ledPin = 13; int buttonPushCounter = 0; // counter for the number of button presses int buttonState = 0; // current state of the button int buttonSelect = 0; int buttonDelete = 0; int lastButtonState = HIGH; // previous state of the button int lastButtonStateD = HIGH;
-------------------------------------------------------------------------------------------
This value set the debounceDelay which is the time to stabilize the difference between the previous and the latest state
const int debounceDelay = 4; --------------------------------------------------------------------------------------------------------
This array declares the whole set of characters that are going to be printed for the scroll of the pedal char myArray[] = "ABCDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890@!#$%&/()=.,-?*+ "; char wordSend[20]; int posLetters[15]; int temp = -1 ; void setup() { // initialize the button pin as a input:
-----------------------------------------------------------------------------------
Here is the initialization of the pins as inputs pinMode(buttonPin, INPUT_PULLUP); // initialize the LED as an output: // pinMode(ledPin, OUTPUT); // initialize serial communication pinMode(deletePin, INPUT); pinMode(selectPin, INPUT); Serial.begin(9600); while (!Serial); Serial.println("Start"); } void loop() {
--------------------
First we read all the button states from the pins // read the pushbutton input pin: buttonState = digitalRead(buttonPin); // PedalButton buttonSelect = digitalRead(selectPin); buttonDelete = digitalRead(deletePin);
Then we compare the button state with the previous state
// compare the buttonState to its previous state to scroll the pedal if (buttonState == LOW) { // if the current state is HIGH then the button went from off to on: temp = temp + 1; Keyboard.write (8); Keyboard.write( myArray[temp]); Serial.println(myArray[temp]); delay(500); if (temp == sizeof(myArray)) { temp = -1; } --------------------------------------------------------------
Here we compare the button state for the select button
if (buttonSelect != lastButtonState) { // wait until button state stabilizes: delay(debounceDelay); if (buttonSelect == HIGH) { //Keyboard.write(32); temp = 0; Keyboard.write(myArray[temp]); } lastButtonState= buttonSelect; } -------------------------------------------------------------- Here we compare the button state for the delete button if (buttonDelete != lastButtonStateD) { delay(debounceDelay); if (buttonDelete == HIGH) { Keyboard.write(8); } lastButtonStateD= buttonDelete; } }
First we made the scroll pedal button with an array and detecting the button state
Then we added the select button, to be able to change letter to letter as we scroll to write a word
And finally we add the delete button to delete letter by letter of a word
Difficulties
- It's hard to set up an external device as a keyboard in english
- It's difficult to set a keyboard in a different language that is not the one on the OS (Operative System)
- The softness and speed of the scrolling letters becomes hard depending of the pedal touch.
- It's difficult to control the whole process with just one foot
- It's better and we naturally use two feet
- The ergonomic position for the design will depend on each person
- The keyboard functions are specific for each action, delete does not work the same as backspace and it will depend on which action we want to do on the keyboard.
留言