Unusual behavior when controlling a Button Matrix
$begingroup$
I have a 4x4 matrix for 16 buttons. Each row/column is directly connected to the pins of an unknown microcontroller. When I connect the pins directly to each other, the microcontroller behaves correctly, as if the respective button was pressed.
I want to control the pins directly with an Arduino or connect them directly to GND/VCC. However, when I turn them on this way, the microcontroller either:
- does nothing
- behaves as if several buttons are pressed at once.
Why is that? Am I missing something, like pullup-resistors?
The microcontroller supports certain button presses at the same time. I think it has to do with the row scanning. <- This turned out to be true, the microcontroller checked one row at the time. So it was necessary to activate the column pin only when the right row was selected.
arduino pullup button pulldown matrix
$endgroup$
add a comment |
$begingroup$
I have a 4x4 matrix for 16 buttons. Each row/column is directly connected to the pins of an unknown microcontroller. When I connect the pins directly to each other, the microcontroller behaves correctly, as if the respective button was pressed.
I want to control the pins directly with an Arduino or connect them directly to GND/VCC. However, when I turn them on this way, the microcontroller either:
- does nothing
- behaves as if several buttons are pressed at once.
Why is that? Am I missing something, like pullup-resistors?
The microcontroller supports certain button presses at the same time. I think it has to do with the row scanning. <- This turned out to be true, the microcontroller checked one row at the time. So it was necessary to activate the column pin only when the right row was selected.
arduino pullup button pulldown matrix
$endgroup$
$begingroup$
To scan matrix keyboards I use timer interrupts , in each I read the input first then change the output , this allows for the largest latency for the inputs and as a consequence higher values for pull up/down resistors and lower current consumption. In this scenario Arduino have the time to output the right signal but no guarantee that everybody does-it this way.
$endgroup$
– Dorian
Dec 3 '18 at 11:10
add a comment |
$begingroup$
I have a 4x4 matrix for 16 buttons. Each row/column is directly connected to the pins of an unknown microcontroller. When I connect the pins directly to each other, the microcontroller behaves correctly, as if the respective button was pressed.
I want to control the pins directly with an Arduino or connect them directly to GND/VCC. However, when I turn them on this way, the microcontroller either:
- does nothing
- behaves as if several buttons are pressed at once.
Why is that? Am I missing something, like pullup-resistors?
The microcontroller supports certain button presses at the same time. I think it has to do with the row scanning. <- This turned out to be true, the microcontroller checked one row at the time. So it was necessary to activate the column pin only when the right row was selected.
arduino pullup button pulldown matrix
$endgroup$
I have a 4x4 matrix for 16 buttons. Each row/column is directly connected to the pins of an unknown microcontroller. When I connect the pins directly to each other, the microcontroller behaves correctly, as if the respective button was pressed.
I want to control the pins directly with an Arduino or connect them directly to GND/VCC. However, when I turn them on this way, the microcontroller either:
- does nothing
- behaves as if several buttons are pressed at once.
Why is that? Am I missing something, like pullup-resistors?
The microcontroller supports certain button presses at the same time. I think it has to do with the row scanning. <- This turned out to be true, the microcontroller checked one row at the time. So it was necessary to activate the column pin only when the right row was selected.
arduino pullup button pulldown matrix
arduino pullup button pulldown matrix
edited Dec 3 '18 at 10:25
2080
asked Dec 3 '18 at 6:09
20802080
304
304
$begingroup$
To scan matrix keyboards I use timer interrupts , in each I read the input first then change the output , this allows for the largest latency for the inputs and as a consequence higher values for pull up/down resistors and lower current consumption. In this scenario Arduino have the time to output the right signal but no guarantee that everybody does-it this way.
$endgroup$
– Dorian
Dec 3 '18 at 11:10
add a comment |
$begingroup$
To scan matrix keyboards I use timer interrupts , in each I read the input first then change the output , this allows for the largest latency for the inputs and as a consequence higher values for pull up/down resistors and lower current consumption. In this scenario Arduino have the time to output the right signal but no guarantee that everybody does-it this way.
$endgroup$
– Dorian
Dec 3 '18 at 11:10
$begingroup$
To scan matrix keyboards I use timer interrupts , in each I read the input first then change the output , this allows for the largest latency for the inputs and as a consequence higher values for pull up/down resistors and lower current consumption. In this scenario Arduino have the time to output the right signal but no guarantee that everybody does-it this way.
$endgroup$
– Dorian
Dec 3 '18 at 11:10
$begingroup$
To scan matrix keyboards I use timer interrupts , in each I read the input first then change the output , this allows for the largest latency for the inputs and as a consequence higher values for pull up/down resistors and lower current consumption. In this scenario Arduino have the time to output the right signal but no guarantee that everybody does-it this way.
$endgroup$
– Dorian
Dec 3 '18 at 11:10
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
The question is: how are you "controlling" the wires using an arduino? The microcontroller is probably pulling the rows (or columns) up (or down) one at a time, an then checking the voltage on the other axis to detect button presses in that row/column.
To emulate this using an arduino, you would have to monitor the energized axis, and then output to the sensing axis in a synchronized fashion. Depending on how the unknown microcontroller is programmed, this may be very difficult, because it could read very soon after energizing. Perhaps too fast for your arduino to react.
It's also worth noting that other arrangements exist besides row/column. Are you sure this is how the keypad is arranged?
$endgroup$
$begingroup$
This is exactly what I just did, it works! Setting all column pins to LOW, reading which of the row pins was set to LOW, and then setting the right column pin to HIGH only when the right row was reached, otherwise keep it LOW. I was concerned that the Arduino might be too slow, since the microcontroller seems to run with 12MHz. But the row sampling/strobe interval seems to be large enough! Thank you!
$endgroup$
– 2080
Dec 3 '18 at 10:22
$begingroup$
Luckily the column and row pins were sequential and separate on the controller. I created an input matrix and also measured all pins over time, so I knew which ones were outputs with pullups. So I could be quite sure it was that way.
$endgroup$
– 2080
Dec 3 '18 at 10:28
add a comment |
$begingroup$
The keyboard use multiplexing, see here the theory.
What can you do ?
First you need identify the inputs and the outputs and find out if the unknown processor drives the outputs in positive or negative logic. This should be easy since you already made some tests and the board still works. In positive logic an input connected to VDD would show as many buttons pressed at once. In negative logic an input connected to GND will show as many buttons pressed at once. An output will do nothing connected to VCC or GND. Since I suppose you can see the rows and the columns you only need to do this test for one line of each. Even if you didn't burned an output yet please use a small resistor for tests (470 ohm will do). The example in the link is in positive logic (an active input/output is high)
You can try to simulate the keyboard behavior by connecting four arduino inputs to the processor keyboard outputs and four arduino outputs to processor keyboard inputs but it's unlikely that this will work reliably since for a simulated key press the output should follow the connected input very fast. A microcontroller with CLC engine like some microchip PIC-s have can do that but Arduino not.
You can use an optocoupler matrix, if the matrix is in positive logic connect the phototransistor collector to output emitter to input and in reversal if in negative logic. If it works than you can use also multiplexing to drive the optocouplers as you see in the end of the article from the above link. You can find very cheap quad optocouplers like this one, you will need four of them, less then 10$ for all.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "135"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f410136%2funusual-behavior-when-controlling-a-button-matrix%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
The question is: how are you "controlling" the wires using an arduino? The microcontroller is probably pulling the rows (or columns) up (or down) one at a time, an then checking the voltage on the other axis to detect button presses in that row/column.
To emulate this using an arduino, you would have to monitor the energized axis, and then output to the sensing axis in a synchronized fashion. Depending on how the unknown microcontroller is programmed, this may be very difficult, because it could read very soon after energizing. Perhaps too fast for your arduino to react.
It's also worth noting that other arrangements exist besides row/column. Are you sure this is how the keypad is arranged?
$endgroup$
$begingroup$
This is exactly what I just did, it works! Setting all column pins to LOW, reading which of the row pins was set to LOW, and then setting the right column pin to HIGH only when the right row was reached, otherwise keep it LOW. I was concerned that the Arduino might be too slow, since the microcontroller seems to run with 12MHz. But the row sampling/strobe interval seems to be large enough! Thank you!
$endgroup$
– 2080
Dec 3 '18 at 10:22
$begingroup$
Luckily the column and row pins were sequential and separate on the controller. I created an input matrix and also measured all pins over time, so I knew which ones were outputs with pullups. So I could be quite sure it was that way.
$endgroup$
– 2080
Dec 3 '18 at 10:28
add a comment |
$begingroup$
The question is: how are you "controlling" the wires using an arduino? The microcontroller is probably pulling the rows (or columns) up (or down) one at a time, an then checking the voltage on the other axis to detect button presses in that row/column.
To emulate this using an arduino, you would have to monitor the energized axis, and then output to the sensing axis in a synchronized fashion. Depending on how the unknown microcontroller is programmed, this may be very difficult, because it could read very soon after energizing. Perhaps too fast for your arduino to react.
It's also worth noting that other arrangements exist besides row/column. Are you sure this is how the keypad is arranged?
$endgroup$
$begingroup$
This is exactly what I just did, it works! Setting all column pins to LOW, reading which of the row pins was set to LOW, and then setting the right column pin to HIGH only when the right row was reached, otherwise keep it LOW. I was concerned that the Arduino might be too slow, since the microcontroller seems to run with 12MHz. But the row sampling/strobe interval seems to be large enough! Thank you!
$endgroup$
– 2080
Dec 3 '18 at 10:22
$begingroup$
Luckily the column and row pins were sequential and separate on the controller. I created an input matrix and also measured all pins over time, so I knew which ones were outputs with pullups. So I could be quite sure it was that way.
$endgroup$
– 2080
Dec 3 '18 at 10:28
add a comment |
$begingroup$
The question is: how are you "controlling" the wires using an arduino? The microcontroller is probably pulling the rows (or columns) up (or down) one at a time, an then checking the voltage on the other axis to detect button presses in that row/column.
To emulate this using an arduino, you would have to monitor the energized axis, and then output to the sensing axis in a synchronized fashion. Depending on how the unknown microcontroller is programmed, this may be very difficult, because it could read very soon after energizing. Perhaps too fast for your arduino to react.
It's also worth noting that other arrangements exist besides row/column. Are you sure this is how the keypad is arranged?
$endgroup$
The question is: how are you "controlling" the wires using an arduino? The microcontroller is probably pulling the rows (or columns) up (or down) one at a time, an then checking the voltage on the other axis to detect button presses in that row/column.
To emulate this using an arduino, you would have to monitor the energized axis, and then output to the sensing axis in a synchronized fashion. Depending on how the unknown microcontroller is programmed, this may be very difficult, because it could read very soon after energizing. Perhaps too fast for your arduino to react.
It's also worth noting that other arrangements exist besides row/column. Are you sure this is how the keypad is arranged?
answered Dec 3 '18 at 9:47
DrewDrew
1,7031513
1,7031513
$begingroup$
This is exactly what I just did, it works! Setting all column pins to LOW, reading which of the row pins was set to LOW, and then setting the right column pin to HIGH only when the right row was reached, otherwise keep it LOW. I was concerned that the Arduino might be too slow, since the microcontroller seems to run with 12MHz. But the row sampling/strobe interval seems to be large enough! Thank you!
$endgroup$
– 2080
Dec 3 '18 at 10:22
$begingroup$
Luckily the column and row pins were sequential and separate on the controller. I created an input matrix and also measured all pins over time, so I knew which ones were outputs with pullups. So I could be quite sure it was that way.
$endgroup$
– 2080
Dec 3 '18 at 10:28
add a comment |
$begingroup$
This is exactly what I just did, it works! Setting all column pins to LOW, reading which of the row pins was set to LOW, and then setting the right column pin to HIGH only when the right row was reached, otherwise keep it LOW. I was concerned that the Arduino might be too slow, since the microcontroller seems to run with 12MHz. But the row sampling/strobe interval seems to be large enough! Thank you!
$endgroup$
– 2080
Dec 3 '18 at 10:22
$begingroup$
Luckily the column and row pins were sequential and separate on the controller. I created an input matrix and also measured all pins over time, so I knew which ones were outputs with pullups. So I could be quite sure it was that way.
$endgroup$
– 2080
Dec 3 '18 at 10:28
$begingroup$
This is exactly what I just did, it works! Setting all column pins to LOW, reading which of the row pins was set to LOW, and then setting the right column pin to HIGH only when the right row was reached, otherwise keep it LOW. I was concerned that the Arduino might be too slow, since the microcontroller seems to run with 12MHz. But the row sampling/strobe interval seems to be large enough! Thank you!
$endgroup$
– 2080
Dec 3 '18 at 10:22
$begingroup$
This is exactly what I just did, it works! Setting all column pins to LOW, reading which of the row pins was set to LOW, and then setting the right column pin to HIGH only when the right row was reached, otherwise keep it LOW. I was concerned that the Arduino might be too slow, since the microcontroller seems to run with 12MHz. But the row sampling/strobe interval seems to be large enough! Thank you!
$endgroup$
– 2080
Dec 3 '18 at 10:22
$begingroup$
Luckily the column and row pins were sequential and separate on the controller. I created an input matrix and also measured all pins over time, so I knew which ones were outputs with pullups. So I could be quite sure it was that way.
$endgroup$
– 2080
Dec 3 '18 at 10:28
$begingroup$
Luckily the column and row pins were sequential and separate on the controller. I created an input matrix and also measured all pins over time, so I knew which ones were outputs with pullups. So I could be quite sure it was that way.
$endgroup$
– 2080
Dec 3 '18 at 10:28
add a comment |
$begingroup$
The keyboard use multiplexing, see here the theory.
What can you do ?
First you need identify the inputs and the outputs and find out if the unknown processor drives the outputs in positive or negative logic. This should be easy since you already made some tests and the board still works. In positive logic an input connected to VDD would show as many buttons pressed at once. In negative logic an input connected to GND will show as many buttons pressed at once. An output will do nothing connected to VCC or GND. Since I suppose you can see the rows and the columns you only need to do this test for one line of each. Even if you didn't burned an output yet please use a small resistor for tests (470 ohm will do). The example in the link is in positive logic (an active input/output is high)
You can try to simulate the keyboard behavior by connecting four arduino inputs to the processor keyboard outputs and four arduino outputs to processor keyboard inputs but it's unlikely that this will work reliably since for a simulated key press the output should follow the connected input very fast. A microcontroller with CLC engine like some microchip PIC-s have can do that but Arduino not.
You can use an optocoupler matrix, if the matrix is in positive logic connect the phototransistor collector to output emitter to input and in reversal if in negative logic. If it works than you can use also multiplexing to drive the optocouplers as you see in the end of the article from the above link. You can find very cheap quad optocouplers like this one, you will need four of them, less then 10$ for all.
$endgroup$
add a comment |
$begingroup$
The keyboard use multiplexing, see here the theory.
What can you do ?
First you need identify the inputs and the outputs and find out if the unknown processor drives the outputs in positive or negative logic. This should be easy since you already made some tests and the board still works. In positive logic an input connected to VDD would show as many buttons pressed at once. In negative logic an input connected to GND will show as many buttons pressed at once. An output will do nothing connected to VCC or GND. Since I suppose you can see the rows and the columns you only need to do this test for one line of each. Even if you didn't burned an output yet please use a small resistor for tests (470 ohm will do). The example in the link is in positive logic (an active input/output is high)
You can try to simulate the keyboard behavior by connecting four arduino inputs to the processor keyboard outputs and four arduino outputs to processor keyboard inputs but it's unlikely that this will work reliably since for a simulated key press the output should follow the connected input very fast. A microcontroller with CLC engine like some microchip PIC-s have can do that but Arduino not.
You can use an optocoupler matrix, if the matrix is in positive logic connect the phototransistor collector to output emitter to input and in reversal if in negative logic. If it works than you can use also multiplexing to drive the optocouplers as you see in the end of the article from the above link. You can find very cheap quad optocouplers like this one, you will need four of them, less then 10$ for all.
$endgroup$
add a comment |
$begingroup$
The keyboard use multiplexing, see here the theory.
What can you do ?
First you need identify the inputs and the outputs and find out if the unknown processor drives the outputs in positive or negative logic. This should be easy since you already made some tests and the board still works. In positive logic an input connected to VDD would show as many buttons pressed at once. In negative logic an input connected to GND will show as many buttons pressed at once. An output will do nothing connected to VCC or GND. Since I suppose you can see the rows and the columns you only need to do this test for one line of each. Even if you didn't burned an output yet please use a small resistor for tests (470 ohm will do). The example in the link is in positive logic (an active input/output is high)
You can try to simulate the keyboard behavior by connecting four arduino inputs to the processor keyboard outputs and four arduino outputs to processor keyboard inputs but it's unlikely that this will work reliably since for a simulated key press the output should follow the connected input very fast. A microcontroller with CLC engine like some microchip PIC-s have can do that but Arduino not.
You can use an optocoupler matrix, if the matrix is in positive logic connect the phototransistor collector to output emitter to input and in reversal if in negative logic. If it works than you can use also multiplexing to drive the optocouplers as you see in the end of the article from the above link. You can find very cheap quad optocouplers like this one, you will need four of them, less then 10$ for all.
$endgroup$
The keyboard use multiplexing, see here the theory.
What can you do ?
First you need identify the inputs and the outputs and find out if the unknown processor drives the outputs in positive or negative logic. This should be easy since you already made some tests and the board still works. In positive logic an input connected to VDD would show as many buttons pressed at once. In negative logic an input connected to GND will show as many buttons pressed at once. An output will do nothing connected to VCC or GND. Since I suppose you can see the rows and the columns you only need to do this test for one line of each. Even if you didn't burned an output yet please use a small resistor for tests (470 ohm will do). The example in the link is in positive logic (an active input/output is high)
You can try to simulate the keyboard behavior by connecting four arduino inputs to the processor keyboard outputs and four arduino outputs to processor keyboard inputs but it's unlikely that this will work reliably since for a simulated key press the output should follow the connected input very fast. A microcontroller with CLC engine like some microchip PIC-s have can do that but Arduino not.
You can use an optocoupler matrix, if the matrix is in positive logic connect the phototransistor collector to output emitter to input and in reversal if in negative logic. If it works than you can use also multiplexing to drive the optocouplers as you see in the end of the article from the above link. You can find very cheap quad optocouplers like this one, you will need four of them, less then 10$ for all.
edited Dec 3 '18 at 10:50
answered Dec 3 '18 at 10:44
DorianDorian
1,9472314
1,9472314
add a comment |
add a comment |
Thanks for contributing an answer to Electrical Engineering Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f410136%2funusual-behavior-when-controlling-a-button-matrix%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
To scan matrix keyboards I use timer interrupts , in each I read the input first then change the output , this allows for the largest latency for the inputs and as a consequence higher values for pull up/down resistors and lower current consumption. In this scenario Arduino have the time to output the right signal but no guarantee that everybody does-it this way.
$endgroup$
– Dorian
Dec 3 '18 at 11:10