Help Choosing Keypad and Display for Cobra II Board

Hello everyone

I am embarassed to waste your time with probably obvious question, but I am having trouble finding keypads with gadgeteer compatibility.

So far I can only find normal keypads from other websites like this 4x4 (16 key) matrix keypad with 8 pinouts 16 Key 4x4 Alpha Numeric Keypad or other 4x4 common-point keypads which use a seperate pinout for each key and sometimes an extra 2 pinouts (so 16 to 18 pinouts).

For the 4x4 matrix keypad I assume it needs to be connected to 8 seperate GPIO pins on the Cobra II board.
Will this be easy to wire up and program for (I heard that sometimes matrix keypads are a pain to program for) or should I go for a common-point 4x4 keypad and use up extra GPIO pins?

Also the description says, current rating 20mA at 24V DC, but the GPIO pins are rated at 3.3V.
Will this still work if I run it off the Cobra II board?

The Cobra II has a total of 72 GPIO pins with 7 GPIO pins in each of the two Y sockets and 3 GPIO pins in each of the three X sockets (so far 23 GPIO) but where are the rest located? According to the Cobra II schematic I cannot see any expansion headers labelled as GPIO (but I see two labelled as I2C).

I want to use a 20x4 LCD Text Display like this one I2C 20x4(2004) LCD Display for Arduno - DFRobot
with the 4x4 Keypad. (I prefer 4 lines of text display instead of only 2 lines sold by ghielectronics because it can show more on screen at once).

But the 20x4 LCD has two I sockets which make a problem because Cobra II only has one I letter plug and one set of I2C pins on the expansion header (equivalent to one I letter plug).

Does anyone have advice on how to connect the two I sockets directly to the Cobra II board by using the breakout modules and some wiring?

What would be the best way to use both a 20x4 LCD and 4x4 keypad on the Cobra II?

I think most efficient would be to use something like HD44780 Module (now discontinued) to convert standard 20x4 LCD pinouts to a single Gadgeteer Y socket output (which would then be easy to connect and program for same as 16x2 Gadgeteer LCD).

For this can someone please give me instructions for how to make my own HD44780 Module (now discontinued) using breakout modules and resistors/transistors?
I tried to understand the schematic for it but the resistor DNP (do not place), resistor 0 ohms, ‘pick one’, and ‘which type of transistor to use’ are confusing for me.

Any help or suggestions welcome, and thank you


Graphics LCD perhaps ?

Honestly the price on 20x4 LCDs are pretty high, compared to a graphics LCD. TE35 from GHI (out of stock, I know) is only $50.
You get a touch screen ! Glide (GHI open source graphics interface for netmf) plus this could make a pretty good interface for the probe :slight_smile:

I have a few 20x4’s I use in parallel mode and you only need like 9 or so pins - in your Cobra you have oodles, just not easily connectable in sockets. The I2C adapted ones like the DFR one you link to, probably only needs one I socket to operate (confirmed, I checked their schematic, looks like they’ve just doubled up the connections not sure why?). I have an adapter I made up that has contrast and backlight control via PWM pins and Resistor-Capacitor RC circuits, and then the ~9 other pins, all only a 0.1" header that piggy-backs onto the LCD. Seems to work ok in the limited testing I’ve done - you could wire that to the long 0.1" header.

I have no experience with keypads. The old KP16 module from GHI (no longer produced) used a hybrid logic gate to reduce the pins required;

1 Like

Hi Brett

Thanks for suggestion of a graphics display, I did think about that but I would like to try making it in an old-fashioned style (at least initially) because I like this sort of look and have a bit of familiarity with programing text displays.

I would like to learn using Glide and develop touchscreen features but I think I will save this for a different project, since the probe probably does not have enough application variety for using the touchscreen to maximum capabilities.

What do you mean by using 20x4 LCDs in parallel mode? Do you mean like connect 4 different LCDs to the same pins and have them display same thing at once?

For 20x4 LCD will I get regular functionality using just the I plug or will I lose some capabilities (since I think the I plug doesn’t use all 9 pins)?

I like the sound of your adapter which can also control contrast and backlight through programming. Would this be easy to make and how much easier it is compared to making a HD44780 module? Please can you give some instructions for making your adapter or HD44780?

Yes, 20x4 LCD is pretty expensive ( the model with I socket plug is about $25), but if I can make one of the adapter modules then can I just use a regular 9-pin 20x4 LCD which is cheaper like this one for only about $6 ?

Last question for displays is that still the Cobra II datasheet confuses me with the expansion header pins, it labels them as P1.5/PWM2, P0.16/COM2_RXD, P0.15/SPI1_SCK, P0.12/AD6 (in think this is an Analog In?), etc… does this mean I can just use them as labelled for ComRx, PWM, and AD or is there a particular meaning for each label like P0.16 or P4.28 ? Can all of these pins (except 12V 5V etc) be used as GPIO as well?

For keypads should it just be fine to connect them to GPIO pins and power pins to have them operational or is there some specific setup needed?
I think implication is direct GPIO connection is enough.

Thanks again for your help

Jason, are you in Australia? Is that why your RS link came up localised to AU ? PUT YOUR LOCATION IN YOUR PROFILE :slight_smile:

I’m in Sydney. We should talk.

Yes, I live out in Whyalla, Australia so postage from RSonline is cheap.
I thought profile location showed automatically, but I have added it in manually now.
Sydney is a bit far away for just a casual visit, unfortunately.

yes but… the reason I ask is that I can send you stuff, AusPost, cheap. I might have a few things that help you out (like a KP16 module) surplus to requirements that I am happy to pass on to you and save you from buying/shipping in from OS

I’ve been to Whyalla - many years ago, for work, for 3 days or something, never saw the outside of a BHP office unfortunately (that dates it somewhat!). Had you been here in Sydney we could have met up and I could have loaned you things to get working/tinker with.

Anyway, back to topic :slight_smile:

“Parallel” is simply using multiple data lines at the same time (and in contrast “serial” is a single data line that reassembles multiple bits). In the case of HD44780 display boards, they have a 16-pin header (or 14-pin, if no backlight), and always work in one of two “data” modes, one mode is 8-bit parallel mode (8 data bits “wide”) and the other is 4-bit mode (4 data bits wide).

The adapter board for I2C like DFR have is doing the parallel 4-bit mode on your behalf; as is the adapter board for the GHI HD44780 module (but using a different approach). In my custom board, I just expose the 4-line parallel connection. The other control lines (like RS, R/W, EN) are exposed as well - we’re now up to 7 pins. You obviously need VCC and GND (total:9). You can get away without having these, but I like to expose the VO (contrast) pin and a way to turn on the backlight - now at 11 pins. But I wanted PWM control over the contrast and BL level so I incorporated that on the board, and these last two pins now need to be connected to PWM capable pins.

All these options can leverage most of the code in the Gadgeteer driver (or other example drivers you can find out there) except they will likely need tailoring based on how the interface to the chip is configured and how/if you implement BL and Contrast.

Lets talk about datasheet and pin naming.
P1.5/PWM2 means this pin has two functions, it’s a GPIO named P1.5, and it also has a PWM function and is named PWM2.
P0.16/COM2_RXD is GPIO P0.16 as well as being the RX pin on COM2
P0.15/SPI1_SCK is GPIO P0.15 and the SCK signal for SPI1 - so if you use SPI1, you need all the SPI1 pins for SPI, and can’t use any of them for GPIO.
P0.12/AD6 AD6 is Analog In channel 6 (I think… D throws me a little, but I am pretty sure it’s correct)

So basically they’re all GPIOs and optionally may be something else.

How to make an adapter: Depends :slight_smile: I will pretty up my module design and share the files with you. Do you have access to a small CNC and some copper clad PCB material by any chance, and could therefore etch your own ? You could even do most of what my board does on perfboard/stripboard/veroboard if you just wanted to go to 0.1" headers on the edge connector of the Cobra2 - have you decided what you might do there ?