Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Is it possible to run more than one pin to an interrupt for sleep/wake purposes?

Is it possible to run more than one pin to an interrupt for sleep/wake purposes?

Scheduled Pinned Locked Moved Troubleshooting
55 Posts 7 Posters 14.2k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Nca78N Offline
    Nca78N Offline
    Nca78
    Hardware Contributor
    wrote on last edited by
    #11

    Maybe a stupid question but why don't you change your keypad with a capacitive touch keypad ?
    I have one of these and it's convenient, low power usage in sleep mode and one interrupt pin for keypress on any of the keys. Just make sure you only connect it to 3.3V, for power AND logic.
    http://www.aliexpress.com/item/MPR121-Capacitive-Touch-Keypad-Shield-module-sensitive-key-keyboard/32642505921.html

    karl261K 1 Reply Last reply
    0
    • Nca78N Nca78

      Maybe a stupid question but why don't you change your keypad with a capacitive touch keypad ?
      I have one of these and it's convenient, low power usage in sleep mode and one interrupt pin for keypress on any of the keys. Just make sure you only connect it to 3.3V, for power AND logic.
      http://www.aliexpress.com/item/MPR121-Capacitive-Touch-Keypad-Shield-module-sensitive-key-keyboard/32642505921.html

      karl261K Offline
      karl261K Offline
      karl261
      wrote on last edited by
      #12

      @Nca78 yes, you are absolutely right. Maybe that is what I'll do. Sound much easier. Thanks for the link, I check it out!

      1 Reply Last reply
      0
      • karl261K Offline
        karl261K Offline
        karl261
        wrote on last edited by
        #13

        But in the end, I prefer the keypad I have. It looks nice.

        Maybe this is the simplest solution? It turns the keypad into i2c:
        https://www.hackster.io/venkatesh_rao/i2c-keypad-73a012

        1 Reply Last reply
        0
        • karl261K Offline
          karl261K Offline
          karl261
          wrote on last edited by
          #14

          Wow, this is so cool, the pcf8574 port expander works out of the box. If now even the interrupt works...

          1 Reply Last reply
          0
          • karl261K Offline
            karl261K Offline
            karl261
            wrote on last edited by karl261
            #15

            Ok, in the end I am stuck. So, I got the keypad working, no problem. But I cannot get it to trigger an interrupt. The PCF8574 has an interrupt pin, but it seems this does not work with this keypad. Or at least I could not figure out how to. So, my keypad speaks I2C now, but still has no interrupt capabilites.

            Can anyone advise?

            If not I will need to build the circuit from @AWI. Btw, in that circuit, Are ALL resistors 10 MOhm?

            Or are R1-4 1 MOhm?

            1 Reply Last reply
            0
            • karl261K Offline
              karl261K Offline
              karl261
              wrote on last edited by
              #16

              Few crazy solutions:

              1. I put in an on / off switch. So before I type, I switch the whole thing on, wait until it registers with the gw, and then here we go. And then off. No need to sleep and wait for interrupts.

              2. I can install a button device. So, the thing is sleeping, I press the button, the thing wakes up for 30 secs, that gives me time to type and send, and back it goes to sleep.

              3. I have a 4x4 keypad. So, I don't need the ABCD. I could connect the ABCD in a way, that it acts like button device, so I can trigger the interrupt with ABCD, then type my number, and then it goes back to sleep.

              AWIA 1 Reply Last reply
              0
              • karl261K karl261

                Few crazy solutions:

                1. I put in an on / off switch. So before I type, I switch the whole thing on, wait until it registers with the gw, and then here we go. And then off. No need to sleep and wait for interrupts.

                2. I can install a button device. So, the thing is sleeping, I press the button, the thing wakes up for 30 secs, that gives me time to type and send, and back it goes to sleep.

                3. I have a 4x4 keypad. So, I don't need the ABCD. I could connect the ABCD in a way, that it acts like button device, so I can trigger the interrupt with ABCD, then type my number, and then it goes back to sleep.

                AWIA Offline
                AWIA Offline
                AWI
                Hero Member
                wrote on last edited by AWI
                #17

                @karl261 these options seem all very odd to me. I2c should work, did you activate a pull-up for the interrupt pin? Can you post your sketch and hardware connections?

                karl261K 1 Reply Last reply
                0
                • AWIA AWI

                  @karl261 these options seem all very odd to me. I2c should work, did you activate a pull-up for the interrupt pin? Can you post your sketch and hardware connections?

                  karl261K Offline
                  karl261K Offline
                  karl261
                  wrote on last edited by karl261
                  #18

                  @AWI Thanks for trying to help! Just a quick question first: Do I draw the circuit by hand or is there a good cheap (free) way to do it on the PC? Or tablet?

                  I think it is how the pcf8574 is designed. I detect no change on the interrupt pin. But yes, maybe my wiring is not good.

                  mfalkviddM AWIA 2 Replies Last reply
                  0
                  • karl261K karl261

                    @AWI Thanks for trying to help! Just a quick question first: Do I draw the circuit by hand or is there a good cheap (free) way to do it on the PC? Or tablet?

                    I think it is how the pcf8574 is designed. I detect no change on the interrupt pin. But yes, maybe my wiring is not good.

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #19

                    @karl261 by hand is quick and easy. I like to use Fritzing, which is a free tool.

                    karl261K 1 Reply Last reply
                    0
                    • karl261K karl261

                      @AWI Thanks for trying to help! Just a quick question first: Do I draw the circuit by hand or is there a good cheap (free) way to do it on the PC? Or tablet?

                      I think it is how the pcf8574 is designed. I detect no change on the interrupt pin. But yes, maybe my wiring is not good.

                      AWIA Offline
                      AWIA Offline
                      AWI
                      Hero Member
                      wrote on last edited by
                      #20

                      @karl261 As @mfalkvidd said. just make an simple hand drawing on how you connected the pfc8574 and the int pin. The rest is obvious. The pcf8574 can generate an interrupt on any change of the input pins.

                      1 Reply Last reply
                      0
                      • mfalkviddM mfalkvidd

                        @karl261 by hand is quick and easy. I like to use Fritzing, which is a free tool.

                        karl261K Offline
                        karl261K Offline
                        karl261
                        wrote on last edited by karl261
                        #21

                        @mfalkvidd Cool stuff, thanks!

                        @AWI Here you go. What a chaos... Sorry. :-) I thought of a setup like this. But the interrupt pin of the pcf is not doing anything. Maybe I need another chip?

                        The resistor is 10kOhm.

                        NRF is also connected. And working.

                        The sketch is not ready, but the keyboard works on the serial line.

                        0_1474716234250_Untitled Sketch_Steckplatine.jpg

                        #include <Wire.h>
                        #include <Keypad_I2C.h>
                        #include <Keypad.h>
                        #define I2CADDR 0x38
                        
                        #define MY_DEBUG
                        #define MY_RADIO_NRF24
                        #define MY_NODE_ID 8
                        
                        
                        #include <MySensors.h>
                        #include <SPI.h>
                        
                        
                        unsigned long SLEEP_TIME = 0; // Sleep time between reports (in milliseconds)
                        #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                        #define CHILD_ID 1   // Id of the sensor child
                        
                        const byte ROWS = 4; //four rows
                        const byte COLS = 4; //three columns
                        char keys[ROWS][COLS] = {
                          {'1','2','3','A'},
                          {'4','5','6','B'},
                          {'7','8','9','C'},
                          {'*','0','#','D'}
                        };
                        
                        // Digitran keypad, bit numbers of PCF8574 i/o port
                        byte rowPins[ROWS] = {0, 1, 2, 3}; //connect to the row pinouts of the keypad
                        byte colPins[COLS] = {4, 5, 6, 7}; //connect to the column pinouts of the keypad
                        
                        Keypad_I2C kpd( makeKeymap(keys), rowPins, colPins, ROWS, COLS, I2CADDR, PCF8574 );
                        
                        void setup(){
                            Wire.begin( );
                            kpd.begin( makeKeymap(keys) );
                        //    Serial.begin(9600);
                            Serial.println( "start" );
                            pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                        }
                        
                        void loop(){
                        
                            Serial.println("Waking up");
                        
                            char key = kpd.getKey();
                            
                            if (key){
                            Serial.println(key);
                            }
                        
                            Serial.println("Good Night");
                            delay(100);
                            sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), FALLING, SLEEP_TIME);
                        }
                        
                        AWIA 1 Reply Last reply
                        3
                        • karl261K karl261

                          @mfalkvidd Cool stuff, thanks!

                          @AWI Here you go. What a chaos... Sorry. :-) I thought of a setup like this. But the interrupt pin of the pcf is not doing anything. Maybe I need another chip?

                          The resistor is 10kOhm.

                          NRF is also connected. And working.

                          The sketch is not ready, but the keyboard works on the serial line.

                          0_1474716234250_Untitled Sketch_Steckplatine.jpg

                          #include <Wire.h>
                          #include <Keypad_I2C.h>
                          #include <Keypad.h>
                          #define I2CADDR 0x38
                          
                          #define MY_DEBUG
                          #define MY_RADIO_NRF24
                          #define MY_NODE_ID 8
                          
                          
                          #include <MySensors.h>
                          #include <SPI.h>
                          
                          
                          unsigned long SLEEP_TIME = 0; // Sleep time between reports (in milliseconds)
                          #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                          #define CHILD_ID 1   // Id of the sensor child
                          
                          const byte ROWS = 4; //four rows
                          const byte COLS = 4; //three columns
                          char keys[ROWS][COLS] = {
                            {'1','2','3','A'},
                            {'4','5','6','B'},
                            {'7','8','9','C'},
                            {'*','0','#','D'}
                          };
                          
                          // Digitran keypad, bit numbers of PCF8574 i/o port
                          byte rowPins[ROWS] = {0, 1, 2, 3}; //connect to the row pinouts of the keypad
                          byte colPins[COLS] = {4, 5, 6, 7}; //connect to the column pinouts of the keypad
                          
                          Keypad_I2C kpd( makeKeymap(keys), rowPins, colPins, ROWS, COLS, I2CADDR, PCF8574 );
                          
                          void setup(){
                              Wire.begin( );
                              kpd.begin( makeKeymap(keys) );
                          //    Serial.begin(9600);
                              Serial.println( "start" );
                              pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                          }
                          
                          void loop(){
                          
                              Serial.println("Waking up");
                          
                              char key = kpd.getKey();
                              
                              if (key){
                              Serial.println(key);
                              }
                          
                              Serial.println("Good Night");
                              delay(100);
                              sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), FALLING, SLEEP_TIME);
                          }
                          
                          AWIA Offline
                          AWIA Offline
                          AWI
                          Hero Member
                          wrote on last edited by
                          #22

                          @karl261 Nice Job! I have to dive into the Keypad library to determine if the interrupt is activated... just give me a little longer ..

                          karl261K 1 Reply Last reply
                          0
                          • AWIA AWI

                            @karl261 Nice Job! I have to dive into the Keypad library to determine if the interrupt is activated... just give me a little longer ..

                            karl261K Offline
                            karl261K Offline
                            karl261
                            wrote on last edited by
                            #23

                            @AWI Thanks for the flowers. ;-) Your help is much appreciated!

                            AWIA 1 Reply Last reply
                            0
                            • karl261K karl261

                              @AWI Thanks for the flowers. ;-) Your help is much appreciated!

                              AWIA Offline
                              AWIA Offline
                              AWI
                              Hero Member
                              wrote on last edited by
                              #24

                              @karl261 It is a pretty hard to find where a possible cause is.. :confused:
                              What should happen to generate an interrupt is a change in one of the inputs. In a standard application the outputs (i.e. rows or colums) will be set to low and the inputs (colums or rows) pulled-up.
                              I can't figure out what the state of the row's/ column's is in the idle state from the library. YOu can probably measure if the rows en colums have a different level Sorry for now...

                              karl261K 1 Reply Last reply
                              0
                              • AWIA AWI

                                @karl261 It is a pretty hard to find where a possible cause is.. :confused:
                                What should happen to generate an interrupt is a change in one of the inputs. In a standard application the outputs (i.e. rows or colums) will be set to low and the inputs (colums or rows) pulled-up.
                                I can't figure out what the state of the row's/ column's is in the idle state from the library. YOu can probably measure if the rows en colums have a different level Sorry for now...

                                karl261K Offline
                                karl261K Offline
                                karl261
                                wrote on last edited by karl261
                                #25

                                @AWI I don't recall that columns and rows have a different level. Of what I measured yesterday was that all 8 pins of the keyboard were at 3.3 V. So the only thing that happens is that there will be a connection made between column and row when a key is pressed. It seems that nothing is pulled up or down. :-/

                                So you think the ic can do it? Then we have to re-program the library... :-(

                                http://www.ti.com/lit/ds/symlink/pcf8574.pdf
                                On page 15 is a wiring example. Maybe we can learn something from this. Some pull up missing?

                                EDIT: No, still can"t get it to work. Buh.

                                1 Reply Last reply
                                0
                                • karl261K Offline
                                  karl261K Offline
                                  karl261
                                  wrote on last edited by
                                  #26

                                  No progress....

                                  Maybe this library is better to understand the pcf...

                                  https://github.com/RobTillaart/Arduino/tree/master/libraries/PCF8574

                                  Also here are some explanations (in German) and some code examples (in English)...

                                  http://www.mikrocontroller.net/articles/Port-Expander_PCF8574

                                  AWIA 1 Reply Last reply
                                  0
                                  • karl261K karl261

                                    No progress....

                                    Maybe this library is better to understand the pcf...

                                    https://github.com/RobTillaart/Arduino/tree/master/libraries/PCF8574

                                    Also here are some explanations (in German) and some code examples (in English)...

                                    http://www.mikrocontroller.net/articles/Port-Expander_PCF8574

                                    AWIA Offline
                                    AWIA Offline
                                    AWI
                                    Hero Member
                                    wrote on last edited by
                                    #27

                                    @karl261 There is no clue reading through the articles. I suggest you try to force an interrupt by pulling one pin low in idle. If that works, we go from there.

                                    There are a few 16key & 8key more simple examples ;) with touch keypads

                                    karl261K 2 Replies Last reply
                                    0
                                    • AWIA AWI

                                      @karl261 There is no clue reading through the articles. I suggest you try to force an interrupt by pulling one pin low in idle. If that works, we go from there.

                                      There are a few 16key & 8key more simple examples ;) with touch keypads

                                      karl261K Offline
                                      karl261K Offline
                                      karl261
                                      wrote on last edited by
                                      #28

                                      @AWI I think the problem is with the keypad. Because it is not really putting a signal to its pins. The only thing it does is short circuiting them when a key is pressed... No change in high or low.

                                      I tried for example to pull row 1 to high and column 1 to low. Then the interrupt fires ( I think) but there is no key press detected any more. But I am not sure if the interrupt fires correctly.

                                      I tested some variations last night, but nothing works. It's all still set up on the breadboard, so if you have some suggestions I am happy to try.

                                      AWIA 1 Reply Last reply
                                      0
                                      • karl261K karl261

                                        @AWI I think the problem is with the keypad. Because it is not really putting a signal to its pins. The only thing it does is short circuiting them when a key is pressed... No change in high or low.

                                        I tried for example to pull row 1 to high and column 1 to low. Then the interrupt fires ( I think) but there is no key press detected any more. But I am not sure if the interrupt fires correctly.

                                        I tested some variations last night, but nothing works. It's all still set up on the breadboard, so if you have some suggestions I am happy to try.

                                        AWIA Offline
                                        AWIA Offline
                                        AWI
                                        Hero Member
                                        wrote on last edited by
                                        #29

                                        @karl261 That's how it is supposed to be. When the library "scans" the keyboard it succesively pulls one of the rows (or colums) and check in the colums (or rows) if there is a connection. To have interrupts detected either the rows of colums should be set to low to detect a change. That would mean adapting the library (if possible) -or- (more fun) build your own routine by using Rob Tillaarts basic library from your previous post.
                                        I don't have any PCF8574 to play with...

                                        karl261K 2 Replies Last reply
                                        0
                                        • AWIA AWI

                                          @karl261 That's how it is supposed to be. When the library "scans" the keyboard it succesively pulls one of the rows (or colums) and check in the colums (or rows) if there is a connection. To have interrupts detected either the rows of colums should be set to low to detect a change. That would mean adapting the library (if possible) -or- (more fun) build your own routine by using Rob Tillaarts basic library from your previous post.
                                          I don't have any PCF8574 to play with...

                                          karl261K Offline
                                          karl261K Offline
                                          karl261
                                          wrote on last edited by
                                          #30

                                          @AWI Yes, basically, 4 inputs should be set to high in the library, and 4 inputs to low. Rows and columns. I had a look at the library examples yesterday, but so far it is beyond my programming skills. As far as I understand from all the docs this is theoretically possible.

                                          Then, if done so, the pcf should detect a change in the low/high of the input pins and also detect what key was pressed. Or better the library interprets the received data by i2c correctly.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          30

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular