• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

Dealing With Keyboard Bounce

Started by Tom Rogers UK, July 15, 2022, 08:03:32 PM

Tom Rogers UK

Dear RDJ Friends I thought now would be the time to share with you an overview of a simple diy interface that I built to overcome keyboard key bounce especially when using the play next key I experienced that the playlist would advance by more than one track. RDJ has a programable set up option to deal with key bounce but to be effective it makes the keyboard typing very slow. My solution is a usb keyboard emulator that has code to de bounce keys. It's only the Play next command that I require to debounce as my set up has a desk box with 2 push buttons that have to be pressed simultaneously to give the Play Next command.  To achieve this I use a Teensy Arduino Board to generate the de bounced f4 key (I have configured my RDJ for f4 to be the Play Next Command). I've had this interface working perfectly for over 4 years now.

Hope this post is of use.

For those interested in doing the same this is the code:

/* Buttons to USB Keyboard Example

   You must select Keyboard from the "Tools > USB Type" menu

   This example code is in the public domain.

#include <Bounce.h>

// Create Bounce objects for each button.  The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
Bounce button0 = Bounce(0, 500);
Bounce button1 = Bounce(1, 500);  // 10 = 10 ms debounce time
Bounce button2 = Bounce(2, 10);  // which is appropriate for
Bounce button3 = Bounce(3, 10);  // most mechanical pushbuttons
Bounce button4 = Bounce(4, 10);
Bounce button5 = Bounce(5, 10);  // if a button is too "sensitive"
Bounce button6 = Bounce(6, 10);  // to rapid touch, you can
Bounce button7 = Bounce(7, 10);  // increase this time.
Bounce button8 = Bounce(8, 10);
Bounce button9 = Bounce(9, 10);

void setup() {
  // Configure the pins for input mode with pullup resistors.
  // The pushbuttons connect from each pin to ground.  When
  // the button is pressed, the pin reads LOW because the button
  // shorts it to ground.  When released, the pin reads HIGH
  // because the pullup resistor connects to +5 volts inside
  // the chip.  LOW for "on", and HIGH for "off" may seem
  // backwards, but using the on-chip pullup resistors is very
  // convenient.  The scheme is called "active low", and it's
  // very commonly used in electronics... so much that the chip
  // has built-in pullup resistors!
  pinMode(0, INPUT_PULLUP);
  pinMode(1, INPUT_PULLUP);
  pinMode(2, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);  // Teensy++ LED, may need 1k resistor pullup
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);

void loop() {
  // Update all the buttons.  There should not be any long
  // delays in loop(), so this runs repetitively at a rate
  // faster than the buttons could be pressed and released.

  // Check each button for "falling" edge.
  // Sends USB Keycode
  // falling = high (not pressed - voltage from pullup resistor)
  //           to low (pressed - button connects pin to ground)
  if (button0.fallingEdge()) {
  }if (button1.fallingEdge()) {