Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 12, 2018, 01:04:52 13:04


Login with username, password and session length


Pages: [1]
Print
Author Topic: Wake up microcontroller with "charlieplexed-light" keypad  (Read 1556 times)
0 Members and 1 Guest are viewing this topic.
visenri
Inactive

Offline Offline

Posts: 4

Thank You
-Given: 0
-Receive: 1


« on: September 24, 2018, 06:58:58 18:58 »

Hello.
I've been hacking a hama IR universal remote because I want it to do some special things impossible with the original electronics.

Basically I'm going to reuse the PCB, buttons and housing and replace the microcontroller with a microchip PIC16, but i found something unusual in the keyboard matrix.

It uses a simplified charlieplexed keyboard that I would call Charlieplexed-light, because it uses the same concept but without diodes.

This reduces the total keys possible to half compared to the original charlieplexed design, but even then it's able to provide more keys than standard matrix keyboard.

In this case, using 9 microcontroller pins, 36 keys should be possible, but only 24 keys are really used.

Normally in a remote control like this I would have used a normal matrix and before entering the CPU in sleep mode I would set all columns to outputs (with low state) and configure all rows to trigger an interrupt on pin change (inputs with pull-up).

The problem is I can't do that with this keyboard design, because I can't find a static I/O configuration of the 9 pin to be able to wake up when any key is pressed.

The only way I can provide a similar functionality is to sleep, wake up every few ms and then scan the matrix to see if any key is pressed.

The fastest way (minimum number of wake ups per second) I found is a cycle of 3 scans setting to output low some pins and reading the rest.

I've not been able to do less than 3 scans to check if any key is pressed.

My question is:
Any idea to keep the CPU always in sleep like I use to do with the normal matrix keyboard? Or at least to reduce the number of scans? Remember that I'm not interested in knowing the exact key, just waking up the cpu no matter what key is pressed (later, when the cpu is running, it's no problem to scan the matrix as required to get the exact key).

I've attached a file with a matrix diagram indicating the key combinations used:
  • The matrix shows each wire labeled with a color name (ORANGE, PINK, LIGHT-BLUE...up to 9).
  • Dark red and dark blue indicate invalid combinations.
  • Black cells show unused combinations.
  • In each row-column I indicate with a 0,1 or 2 which signals are set at output low at each scan cycle.
  • The valid cells have the color of the first scan that is able to detect that key (0 green, 1 yellow, 2 red).

Thank you in advance!
« Last Edit: October 09, 2018, 08:24:14 08:24 by visenri » Logged
visenri
Inactive

Offline Offline

Posts: 4

Thank You
-Given: 0
-Receive: 1


« Reply #1 on: September 25, 2018, 05:35:35 17:35 »

I've attached a picture of reverse engineered wiring.
« Last Edit: October 07, 2018, 01:16:34 13:16 by visenri » Logged
rtm
Junior Member
**
Offline Offline

Posts: 45

Thank You
-Given: 42
-Receive: 54



« Reply #2 on: October 04, 2018, 06:21:09 06:21 »

As I understand, you are making matrix 4x9 to get 36 pins. It will use 9+4=13 in/out pins of PIC16. As it really is in PIC16F84A.

Next, you are planning to configure 4 pins as outputs and 9 pins as inputs before going to sleep mode. And the problem is that controller has only 4 pins that could be set to interrupt-on-change mode, but you need 9.

The solution is very simple. Change the matrix. Set 9 pins as outputs, and 4 pins as inputs. Set all 9 outputs to zero and 4 inputs to pull-up mode before going to sleep mode. These 4 inputs must be PORTB<7:4> pins and they will wake up controller from sleep mode after any key pressing. Next you can instantly change configuration of the matrix to 4 outputs and 9 inputs, make all 12 reading for 3 scan cycles, define the pressed key, and next change back to 4 inputs and 9 outputs matrix, and finally go to sleep.
« Last Edit: October 04, 2018, 06:33:01 06:33 by rtm » Logged
visenri
Inactive

Offline Offline

Posts: 4

Thank You
-Given: 0
-Receive: 1


« Reply #3 on: October 04, 2018, 06:20:27 18:20 »

As I understand, you are making matrix 4x9 to get 36 pins. It will use 9+4=13 in/out pins of PIC16. As it really is in PIC16F84A.

Next, you are planning to configure 4 pins as outputs and 9 pins as inputs before going to sleep mode. And the problem is that controller has only 4 pins that could be set to interrupt-on-change mode, but you need 9.

The solution is very simple. Change the matrix. Set 9 pins as outputs, and 4 pins as inputs. Set all 9 outputs to zero and 4 inputs to pull-up mode before going to sleep mode. These 4 inputs must be PORTB<7:4> pins and they will wake up controller from sleep mode after any key pressing. Next you can instantly change configuration of the matrix to 4 outputs and 9 inputs, make all 12 reading for 3 scan cycles, define the pressed key, and next change back to 4 inputs and 9 outputs matrix, and finally go to sleep.

You are describing the classic matrix approach. As I said this is not a normal matrix, it's a half-charlieplexed matrix.

In this kind of matrix any pin can be connected to any pin with a switch, so you get more buttons for the same pin count.

Half-charlieplexed matrix:
  • buttons = (N2-N)/2
  • Where N is the total number of pins used.

Compare this to the
Classic matrix
  • buttons = R*C
  • Where R is the number of columns and C the number of rows (total number of pins used: R+C).

In this case the remote uses 9 pins in total to get 24 keys (from a possible maximum of 36). The best classic matrix key count using 9 pins would be = 5x4=20 keys.

With the half-charlieplexed matrix, to do a full key scan, one pin must be configured at a time as an output and read all the others.

The problem is, i can't find a static input/output setting to detect any switch in sleep with a pin-change interrupt.

So, a periodic wake up is needed instead of a pin-change interrupt.

The fastest way (minimum time awake) I found is a cycle of 3 scans setting to output low multiple pins and reading the rest (see attached matrix in first post).


So my questions are still the same:

Any idea to keep the CPU always in sleep like I use to do with the normal/classic matrix keyboard? Or at least to reduce the number of scans? Remember that I'm not interested in knowing the exact key, just waking up the cpu no matter what key is pressed (later, when the cpu is running, it's no problem to scan the matrix as required to get the exact key).


By the way: The PIC will be a PIC16LF1824 or PIC16LF18324 (both with 14 pin count: 9 for keys, 1 for led, 2 for ir-led and 2 for power supply).

« Last Edit: October 07, 2018, 01:16:41 13:16 by visenri » Logged
bobcat1
Active Member
***
Offline Offline

Posts: 177

Thank You
-Given: 2128
-Receive: 37


« Reply #4 on: October 06, 2018, 02:19:59 14:19 »

Hi
Ti have nice application not SLVA821 showing how to put a micro (any) to slip using few hardware parts
this method use one I/O to shut down the micro and no I/O to wake it up.
Hope it can help you 
I have use it in one of my designs and it work well while not using the original components

All the best

Bobi
Logged
visenri
Inactive

Offline Offline

Posts: 4

Thank You
-Given: 0
-Receive: 1


« Reply #5 on: October 07, 2018, 02:33:23 14:33 »

Sorry, the thread title is wrong.

Obviously, it should say: Wake up microcontroller with "charlieplexed-light" keypad (instead of display)

I edited the original post title.

Hi
Ti have nice application not SLVA821 showing how to put a micro (any) to slip using few hardware parts
this method use one I/O to shut down the micro and no I/O to wake it up.
Hope it can help you 
I have use it in one of my designs and it work well while not using the original components

The Application note SLVA821 from TI is interesting but has nothing to do with my question.
Logged
Parmin
Hero Member
*****
Offline Offline

Posts: 565

Thank You
-Given: 390
-Receive: 131


Very Wise (and grouchy) Old Man


« Reply #6 on: October 07, 2018, 05:26:41 17:26 »

I think you have to make this into two separate steps:
1. wake up by interrupt
2. scan matrix once you are awake.

Should not be too much of a problem since usually buttons are pressed longer than the cycle time required to do the steps above.
Logged

If I have said something that offends you, please let me know, so I can say it again later.
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC