Board index FlightGear Development

Hardware, Space Shuttle Data Entry Keypad (I2C)

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby japreja » Wed Sep 26, 2018 1:05 am

I have started a hardware project for the Thorsten's Space Shuttle, It is an I2C "Data Entry Keypad" non-illuminated, that communicates to a micro-controller that in turn will communicate to flightgear over serial/virtual com port. I am wiring this as though it was the AFT keypad (only one electrical connection per button contact as opposed to two connections per button on the C2 panel) They both work the same way just the communications channels are different on the actual shuttle.

This is essentially an 4x8 matrix keypad using tactile switches connected to an MCP23017 IC, The images below show the project before the appropriate capacitors, resistors, and wiring connections are completed. The keypad, for those of you that don't know, functions in a row, column fashion to determine which key is pressed. A micro controller must energize each row and column in a specific sequence to detect a capacitance change to determine which key is pressed. Common pitfalls of matrix keypads are an effect called "Ghosting" when multiple keys are pressed, there is a specific pattern of this ghosting and those key sequences can be ignored.

This is a prototype in the works :)

Image Image
japreja
 
Posts: 330
Joined: Thu May 07, 2015 11:05 pm
Location: MT, USA
OS: Windows 10 Pro 64bit

Re: Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby japreja » Sun Sep 30, 2018 3:10 pm

Just got the buttons wired, soldered, and checked with a multi-meter. No shorts :) (Just a side note: The reason I am making this is because I have 10,000 of these buttons :shock: yes 10,000)

The blue wires are the columns, the red are the rows.

Image

I have intent to purchase a few customized PCB's specifically for the Data Entry Keypad through OshPark and would like to know from the community if I should just make a mini panel C2 or just the keypads. The highest cost for the entire panel C2 is the toggle switches at $2-$3 each for DPDT and $8-$10 for DP3T, I haven't priced the thumb wheels, button caps, or the panel to put it all in.

A maximum of 8 of these IC's can be connected on the same bus (Each with 16 IO for a total of 16 x 8 = 128 buttons/switches/signals) I could use 2 of these IC's per keypad for just the buttons and wire each button separately without using a matrix layout. If I want to make the 3 keypads, and the switches in the center it would take all 8, leaving no room for any LED's/Lighting without using an additional I2C bus. I am concerned with the data rate when constantly polling each row/column of each keypad as a matrix so I think for speed I should rewire the board with two MCP23017's per keypad and just look and wait for interrupts from each IC, (more data lines but allows for bus idle time when the keypads are not being used). Only disadvantage is more traces on the PCB.
japreja
 
Posts: 330
Joined: Thu May 07, 2015 11:05 pm
Location: MT, USA
OS: Windows 10 Pro 64bit

Re: Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby japreja » Tue Oct 23, 2018 12:12 am

Finally got this all wired up! This configuration allows for up to 64 keys on an Arduino Uno, maybe other micros too, using the keypad library from https://github.com/joeyoung/arduino_keypads . I used the 64 Key layout so I can expand this with both Data Entry Keypads at a later time.


Here are some updated photos of the wiring, I wish I would have placed the connectors on the bottom :( but it will still work.

Image Image
japreja
 
Posts: 330
Joined: Thu May 07, 2015 11:05 pm
Location: MT, USA
OS: Windows 10 Pro 64bit

Re: Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby Thorsten » Tue Oct 23, 2018 6:09 am

That's a really nice piece of HW... (wish I had once of those...)
Thorsten
 
Posts: 9994
Joined: Mon Nov 02, 2009 8:33 am

Re: Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby japreja » Tue Oct 23, 2018 11:13 am

Here is the Circuit (BTW you will need an Arduino, I am using an UNO) and Keyboard mappings. The mapping only allows a single character so I had to improvise!

Image Image Image

and here is the Arduino code (You need some specific libraries I will comment on after the code snippet)

Code: Select all
/* file CustomKeypad_MC17 Feb 2/13
Modified by japreja (Jorge Joaquin Pareja) as a Shuttle Data Entry Keypad
||@file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
    Use with I2C i/o G. D. (Joe) Young Feb 28/12

    Use with MCP23008 I2C i/o G. D. (Joe) Young Jul 29/12
    Use with MCP23016 I2C i/o G. D. (Joe) Young Feb 2/13
    Use with MCP23017 I2C i/o G. D. (Joe) Young May 19/14
*/
#include <Keypad_MC17.h>
#include <Keypad.h>        // GDY120705
#include <Wire.h>

#define I2CADDR 0x20

const byte ROWS = 8; //four rows
const byte COLS = 4; //five columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'J','I','H','G'}, //0
  {'C','B','A','K'}, //1
  {'F','E','D','L'}, //2
  {'3','2','1','M'}, //3
  {'6','5','4','N'}, //4
  {'9','8','7','O'}, //5
  {'+','0','-','P'}, //6
  {'S','.','R','Q'}  //7
};
byte rowPins[ROWS] = {7, 6, 5, 4, 3, 2, 1, 0}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {11, 10, 9, 8}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad_MC17 customKeypad = Keypad_MC17( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS, I2CADDR);

void setup(){
//  Wire.begin( );
  customKeypad.begin( );        // GDY120705
  Serial.begin(9600);
}

void loop(){
  char customKey = customKeypad.getKey();
 
  if (customKey != NO_KEY){
    Serial.println(customKey);
  }
}


You will need one managed library, and one set of unmanaged libraries installed for the Arduino IDE. For the managed library, follow these instructions:

http://playground.arduino.cc/code/Keypad#Download

For the unmanaged library set, you will need to clone https://github.com/joeyoung/arduino_keypads and place each of the libraries in your library path for your system. Create a new sketch and past in my code above to test the Keypad in the serial monitor!
japreja
 
Posts: 330
Joined: Thu May 07, 2015 11:05 pm
Location: MT, USA
OS: Windows 10 Pro 64bit

Re: Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby japreja » Tue Oct 23, 2018 11:19 am

Thorsten wrote in Tue Oct 23, 2018 6:09 am:That's a really nice piece of HW... (wish I had once of those...)


I may be able to send you one or two to toy with, this is just a prototype and I should have done a few things differently. I dont have any, but I should have used an MCP23S17(SPI) as opposed to an MCP23017(I2C). The reason being is that I2C only allows 8 of these IC's per bus, where the SPI device can use an unlimited amount provided that they each have seperate Chip Select lines.
japreja
 
Posts: 330
Joined: Thu May 07, 2015 11:05 pm
Location: MT, USA
OS: Windows 10 Pro 64bit

Re: Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby daweed » Tue Oct 23, 2018 2:51 pm

Hello,

if really no choice using I2C devices, you can have a try with the TCA9548A 1-to-8 I2C multiplexer! , giving 8 I2C channel , enabling to set up 8 x 8 MCP23017
That the way i am actually looking to setup on my own interface, but that will need the multipexing channel management in the code.
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery
daweed
 
Posts: 264
Joined: Thu Dec 11, 2014 10:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Windows 10 Familly

Re: Hardware, Space Shuttle Data Entry Keypad (I2C)

Postby japreja » Wed Oct 24, 2018 9:23 am

Just for the Matrix Keypad with Anti-Ghosting Diodes the total price will be about $45 (Just an estimate) without shipping, $40 without the diodes. This board will measure 3.5 inches by 2.35 inches! I can reduce the cost by removing the gap between the buttons, I think that could take off an inch to an inch and a half, which reduces board costs, but might look awkward since it would be square :/. Connector should mount from the bottom.

Breakdown: Using Oshpark, I have to buy 3 boards at a time (unpopulated) which is about $42, 100 Diodes (MINIMELF) about $6, 100 Buttons $30. About $75 for just the parts for 3 boards /3 = 25. My time for my work per board $20. The 40 pin connector will be left un-populated. Still non of which includes shipping for the components.

This does not include the interface IC, MCP23017 or MCP23S17, those can be a separate module to give anyone more options. Is it worth it???

Image
japreja
 
Posts: 330
Joined: Thu May 07, 2015 11:05 pm
Location: MT, USA
OS: Windows 10 Pro 64bit


Return to Development

Who is online

Users browsing this forum: No registered users and 10 guests