DIY Jogging Keyboard

Pictures, plans, gcode, projects, tutorials, ...
All stuff that you do with your machine.

DIY Jogging Keyboard

Postby GTOhlms » 01 Nov 2015, 20:01

Here is a simple jogging keypad I made that acts like a keyboard. I used an Adafruit trinket pro to send the data. Seems to work well and I think it looks pretty professional. It was a really fun project too. Very simple circuitry but good soldering practice.

joggerkeyboard.jpg
joggerkeyboard.jpg (39.05 KiB) Viewed 1514 times


joggerkeyboard2.jpg
joggerkeyboard2.jpg (38.8 KiB) Viewed 1514 times
GTOhlms
 
Posts: 6
Joined: 21 Nov 2014, 19:01
Location: St. Charles MO
Controller: Mk2

Re: DIY Jogging Keyboard

Postby Support » 19 Nov 2015, 10:14

Thank you for your post, maybe you could post files if some other user tries the same project.
Support
 
Posts: 2609
Joined: 07 Apr 2014, 17:39
Controller: Many controllers

Re: DIY Jogging Keyboard

Postby pivolcan » 30 Dec 2015, 08:54

Interesting project.Can you describe project plans.
pivolcan
 
Posts: 18
Joined: 13 May 2015, 16:57
Controller: Mk2

Re: DIY Jogging Keyboard

Postby GTOhlms » 18 Nov 2016, 15:43

Using an Adafruit Trinket, some wires, simple push buttons and some solder, I constructed the keyboard part. Below is the code I used for the controller. I am by no means an expert in C languages or Arduinos so the code does have some redundancies and inefficient parts. The keyboard simply sends keyboard keystrokes and using the User Interface => Keys in USB CNC, you can specify what the keys do. I had a lot fun making this one and it works great really. However, I have since made a new one with a rotary knob that works in a very similar manner.

I don't have a schematic of the wiring or anything, but it was very simple. All of the grounds are wired together and attached to the Adafruit board. Then the remaining lead for the all of the buttons is wired to appropriate pin on the board as specified by the beginning of the code.

Sorry for the late response on this subject.

/*
SIMPLE CODE FOR USB JOG KEYBOARD
*/

#include <ProTrinketKeyboard.h>

// Switches are connected from ground to these defined pins
int PIN_BUTTON_XNEG = 4;
int PIN_BUTTON_XPOS = 5;
int PIN_BUTTON_YNEG = 6;
int PIN_BUTTON_YPOS = 8;
int PIN_BUTTON_ZNEG = 9;
int PIN_BUTTON_ZPOS = 10;
int PIN_BUTTON_SHIFT = 11;
int PIN_BUTTON_ESTOP = 12;
int PIN_BUTTON_CYCLE_START = 14;
int PIN_BUTTON_FEED_HOLD = 15;
int PIN_LED=3;
bool shifton = false;
bool shiftpush = false;
long time = 0;
long debounce = 200;

void setup()
{
// Declare button pins as inputs
pinMode(PIN_BUTTON_XNEG, INPUT);
pinMode(PIN_BUTTON_XPOS, INPUT);
pinMode(PIN_BUTTON_YNEG, INPUT);
pinMode(PIN_BUTTON_YPOS, INPUT);
pinMode(PIN_BUTTON_ZNEG, INPUT);
pinMode(PIN_BUTTON_ZPOS, INPUT);
pinMode(PIN_BUTTON_SHIFT, INPUT);
pinMode(PIN_BUTTON_ESTOP, INPUT);
pinMode(PIN_BUTTON_CYCLE_START, INPUT);
pinMode(PIN_BUTTON_FEED_HOLD, INPUT);
pinMode(PIN_LED, OUTPUT);

// setting input pins to high means turning on internal pull-up resistors
digitalWrite(PIN_BUTTON_XNEG, HIGH);
digitalWrite(PIN_BUTTON_XPOS, HIGH);
digitalWrite(PIN_BUTTON_YNEG, HIGH);
digitalWrite(PIN_BUTTON_YPOS, HIGH);
digitalWrite(PIN_BUTTON_ZNEG, HIGH);
digitalWrite(PIN_BUTTON_ZPOS, HIGH);
digitalWrite(PIN_BUTTON_SHIFT, HIGH);
digitalWrite(PIN_BUTTON_ESTOP, HIGH);
digitalWrite(PIN_BUTTON_CYCLE_START, HIGH);
digitalWrite(PIN_BUTTON_FEED_HOLD, HIGH);

TrinketKeyboard.begin();
}

void loop()
{
TrinketKeyboard.poll();


// Regular Jogging

if (digitalRead(PIN_BUTTON_XNEG) == LOW && shifton == false)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_LEFT);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_XPOS) == LOW && shifton == false)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_RIGHT);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_YNEG) == LOW && shifton == false)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_DOWN);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_YPOS) == LOW && shifton == false)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_UP);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_ZNEG) == LOW && shifton == false)
{
TrinketKeyboard.pressKey(0, KEYCODE_PAGE_DOWN);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_ZPOS) == LOW && shifton == false)
{
TrinketKeyboard.pressKey(0, KEYCODE_PAGE_UP);
TrinketKeyboard.pressKey(0, 0);
}

//Step Mode Jogging

if (digitalRead(PIN_BUTTON_XNEG) == LOW && shifton == true)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_LEFT, KEYCODE_MOD_LEFT_SHIFT);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_XPOS) == LOW && shifton == true)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_RIGHT, KEYCODE_MOD_LEFT_SHIFT);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_YNEG) == LOW && shifton == true)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_DOWN, KEYCODE_MOD_LEFT_SHIFT);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_YPOS) == LOW && shifton == true)
{
TrinketKeyboard.pressKey(0, KEYCODE_ARROW_UP, KEYCODE_MOD_LEFT_SHIFT);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_ZNEG) == LOW && shifton == true)
{
TrinketKeyboard.pressKey(0, KEYCODE_PAGE_DOWN, KEYCODE_MOD_LEFT_SHIFT);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_ZPOS) == LOW && shifton == true)
{
TrinketKeyboard.pressKey(0, KEYCODE_PAGE_UP, KEYCODE_MOD_LEFT_SHIFT);
TrinketKeyboard.pressKey(0, 0);
}

//Functional Controls

if (digitalRead(PIN_BUTTON_ESTOP) == LOW)
{
TrinketKeyboard.pressKey(0, KEYCODE_ESC);
TrinketKeyboard.pressKey(0, 0);
}

if(digitalRead(PIN_BUTTON_SHIFT) == HIGH)
{
shiftpush = false;
}

if (digitalRead(PIN_BUTTON_SHIFT) == LOW && shiftpush == false && millis() - time > debounce)
{
shiftpush=true;
if (shifton == true){
shifton=false;
digitalWrite(PIN_LED, LOW);
}
else if(shifton == false) {
shifton = true;
digitalWrite(PIN_LED, HIGH);
}
time = millis();
}

if (digitalRead(PIN_BUTTON_CYCLE_START) == LOW)
{
TrinketKeyboard.pressKey(0, KEYCODE_S);
TrinketKeyboard.pressKey(0, 0);
}

if (digitalRead(PIN_BUTTON_FEED_HOLD) == LOW)
{
TrinketKeyboard.pressKey(0, KEYCODE_F);
TrinketKeyboard.pressKey(0, 0);
}

}
GTOhlms
 
Posts: 6
Joined: 21 Nov 2014, 19:01
Location: St. Charles MO
Controller: Mk2

Re: DIY Jogging Keyboard

Postby grestscott121 » 21 Jan 2017, 14:07

This looks like a great little addon, been looking at MPGs etc, but with my current budget, they'll have to be a future upgrade.

Stupid question, the Trinket is just emulating keyboard inputs that can be mapped within the software? There's nothing tricky required to interface with the software itself?
grestscott121
 
Posts: 1
Joined: 21 Jan 2017, 13:23
Controller: Mk3

Re: DIY Jogging Keyboard

Postby GTOhlms » 01 Feb 2017, 19:23

grestscott121 wrote:This looks like a great little addon, been looking at MPGs etc, but with my current budget, they'll have to be a future upgrade.

Stupid question, the Trinket is just emulating keyboard inputs that can be mapped within the software? There's nothing tricky required to interface with the software itself?


Thanks! It was a very useful item. I made a new one with a rotary knob and this project provided a great place to start!

Not a stupid question! And yes, it is just a keyboard emulator. Its pretty easy to setup up keyboard commands in the software.

I would say all in with the Trinket, wires, buttons, USB Cable and enclosure I spent about $25-30 USD. It all started with using an external number keypad but I wanted more specific buttons

Good Luck!
GTOhlms
 
Posts: 6
Joined: 21 Nov 2014, 19:01
Location: St. Charles MO
Controller: Mk2


Return to Various projects



Who is online

Users browsing this forum: No registered users and 1 guest