Arduino DUE + Data logging shield won't work with keypad

Hi there,
I am re-building the project I did some years ago. This time it will be much simpler (or so I thought).
I am using: Arduino DUE, Data logging shield + SD, 4x4 Keypad (from a phone, but it seems to work fine). It will be a phone-like experience (I have an amp and speaker ready).
When I connect the keypad through a Data logging shield, pin no. 7 would stop receiving the input. That means only the first two columns of the keypad numbers are functioning (1, 2, 4, 5, 7..).
But all tests show that pin 7 is working fine (e.g. button-LED test).
EDIT: It seems that the problem is somewhere else: changing the input to other pins - same result with only two columns working.
This is how I connect DUE to Data shield: Adafruit Data Logging Shield with DUE ... everything's OK!!!
Keypad code I am using to test:

If I unplug all SPI pins from the shield - the input works sometimes. Very weird. I have tried with multiple shields and Arduinos - same result.

What could cause that? Thanks for any input :slight_smile:

Please show a complete schematic with all 3 components.
You need 8 wires for the keypad so there is info missing from this question.
Sounds like your pin assignments might be overlapping.

1 Like

Thanks for the reply, sure - attaching the image of the wiring.
All pin numbers are replicated on the shield.
Pin 2-9 - Keypad:
2 - C4
3 - C3
4 - C2
5 - C1
6 - R4
7 - R3
8 - R2
9 - R1

11 - MOSI pin on SPI
12 - MISO pin on SPI
13 - SCK pin on SPI

Can you share your code too, please?

Sure, it's the same code from the example:

#include <Keypad.h>

const int ROW_NUM = 4; //four rows
const int COLUMN_NUM = 4; //four columns

char keys[ROW_NUM][COLUMN_NUM] = {
  {'1','2','3', 'A'},
  {'4','5','6', 'B'},
  {'7','8','9', 'C'},
  {'*','0','#', 'D'}

byte pin_rows[ROW_NUM] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte pin_column[COLUMN_NUM] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );

void setup(){

void loop(){
  char key = keypad.getKey();

  if (key){

And the data logger runs on its own?
Never used one.

In the code before I am not accessing the data logger shield. Just connecting through it. So that's why I suspect it's something to do with the hardware.

How long is the cable to your keypad?

It's two cables connected. In total I think 50cm.
But tried with different, shorter cables - no luck.

Do you have code that access the data logger and uses the keypad?

Also, did you attach the pin headers to the shield yourself?

No, at this point I want to test the keypad only. I've tested the data logger-SD with a separate code - all worked fine.
Pin headers were already attached- I've tested with the multimeter - seemed all good.
My suspicion is Shield ISP somehow clashes with the input pins (very weird).

I get your desire for developing one piece at a time, it's a good plan.

The reason I'm asking is because I'm curious if it's doing something since it's being powered, and all those pins are just floating. This is undesirable.

In this case I would investigate by adding the code to use the logger. That doesn't mean that you have to use it but I think you should create all of the variables and all of the setup for the logger.

Does the DUE even have SPI on pins 11-13? I think no.

Good catch. It's really set up for an Uno.

There are jumpers from the ICSP to pins 11-13, but what about the existing pins? There's a thread about it linked in the first post, but a lengthy read. But I would worry about what is connected to pin 7 on the shield.

Good suggestions! I just checked the thread - I thought we found the solution! BUT...No.
I've bend 11-13 pins to be disconnected from DUE - same result.
When connecting the keypad to DUE in any of the ways without the Data shield - works perfectly!

OK, I just connected the keypad to pins 38-52 (even numbers only). Works fine! I can stick with that :slight_smile:

But another problem - I cannot see the SD card anymore (Damn, I hate this shield). It seems the problem might be with Chip Select pin 10. But even after resetting it to HIGH and LOW (or how you do chipselect reset?) - the same result. I have reinserted the 11-13 pins to DUE btw

EDIT. Solved the issue of 10 pin not being chip select:

#define SS          10 //slave select

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.