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.
  • 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
                  • 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
                    #31

                    @AWI Yeah, I guess just getting another keypad would be the easiest solution. Pitty though. I like my keypad and the fact that it is self-adhesive on the outside of the case.

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

                      Or I go back to my three proposed solutions. For example solution 3) works fine. I tested it.

                      1 Reply 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
                        #33

                        @AWI I think this Library sounds very promising. What do you think? At least it talks about high and low.

                        http://playground.arduino.cc/Main/I2CPortExpanderAndKeypads

                        AWIA 1 Reply Last reply
                        0
                        • karl261K karl261

                          @AWI I think this Library sounds very promising. What do you think? At least it talks about high and low.

                          http://playground.arduino.cc/Main/I2CPortExpanderAndKeypads

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

                          @karl261 At least it is a more comprehensible library but it does not deal with interrupts (yet).
                          Are you able to do the following experiment?

                          • Using the library you quoted, execute the following sketch
                          #include <Wire.h>
                          #include <i2ckeypad.h>
                          
                          #define ROWS 4
                          #define COLS 3
                          
                          // With A0, A1 and A2 of PCF8574 to ground I2C address is 0x20
                          #define PCF8574_ADDR 0x20
                          
                          
                          i2ckeypad kpd = i2ckeypad(PCF8574_ADDR, ROWS, COLS);
                          
                          void setup()
                          {
                            Serial.begin(9600);
                          
                            Wire.begin();
                          
                            kpd.init();
                             
                          
                            Serial.print("Testing keypad/PCF8574 I2C port expander arduino lib\n\n");
                          
                            pcf8574_write(pcf8574_i2c_addr, 0xf0);
                          
                          }
                          
                          void loop()
                          {
                          }
                          
                          
                          • measure the input/output pins of the pcf8574 (should be 4 pins low/ 4 pins high)
                          • measure the power consumption of the pcf8574 (hope it is next to nothing)

                          IF the above is true we can easily rework te sketch to use the interrupt.

                          karl261K 2 Replies Last reply
                          0
                          • AWIA AWI

                            @karl261 At least it is a more comprehensible library but it does not deal with interrupts (yet).
                            Are you able to do the following experiment?

                            • Using the library you quoted, execute the following sketch
                            #include <Wire.h>
                            #include <i2ckeypad.h>
                            
                            #define ROWS 4
                            #define COLS 3
                            
                            // With A0, A1 and A2 of PCF8574 to ground I2C address is 0x20
                            #define PCF8574_ADDR 0x20
                            
                            
                            i2ckeypad kpd = i2ckeypad(PCF8574_ADDR, ROWS, COLS);
                            
                            void setup()
                            {
                              Serial.begin(9600);
                            
                              Wire.begin();
                            
                              kpd.init();
                               
                            
                              Serial.print("Testing keypad/PCF8574 I2C port expander arduino lib\n\n");
                            
                              pcf8574_write(pcf8574_i2c_addr, 0xf0);
                            
                            }
                            
                            void loop()
                            {
                            }
                            
                            
                            • measure the input/output pins of the pcf8574 (should be 4 pins low/ 4 pins high)
                            • measure the power consumption of the pcf8574 (hope it is next to nothing)

                            IF the above is true we can easily rework te sketch to use the interrupt.

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

                            @AWI Thanks. I am in the train now and I am spending my time to try to understand how things work. I also made some progress in my brain. My idea is similar, but you already have a sketch ready. :-) I will try it out, I guess on Saturday. Until then I will try to deepen my knowledge of the libraries.

                            It is also possible with the "original" library, but you are right: the "new" library is much clearer.

                            1 Reply Last reply
                            0
                            • AWIA AWI

                              @karl261 At least it is a more comprehensible library but it does not deal with interrupts (yet).
                              Are you able to do the following experiment?

                              • Using the library you quoted, execute the following sketch
                              #include <Wire.h>
                              #include <i2ckeypad.h>
                              
                              #define ROWS 4
                              #define COLS 3
                              
                              // With A0, A1 and A2 of PCF8574 to ground I2C address is 0x20
                              #define PCF8574_ADDR 0x20
                              
                              
                              i2ckeypad kpd = i2ckeypad(PCF8574_ADDR, ROWS, COLS);
                              
                              void setup()
                              {
                                Serial.begin(9600);
                              
                                Wire.begin();
                              
                                kpd.init();
                                 
                              
                                Serial.print("Testing keypad/PCF8574 I2C port expander arduino lib\n\n");
                              
                                pcf8574_write(pcf8574_i2c_addr, 0xf0);
                              
                              }
                              
                              void loop()
                              {
                              }
                              
                              
                              • measure the input/output pins of the pcf8574 (should be 4 pins low/ 4 pins high)
                              • measure the power consumption of the pcf8574 (hope it is next to nothing)

                              IF the above is true we can easily rework te sketch to use the interrupt.

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

                              @AWI I found this library:

                              https://github.com/skywodd/pcf8574_arduino_library

                              There is a lot of talk about interrupt functionality and it seems to be somehow implemented. But I don't fully understand how it works. Maybe you can make something out of it?

                              Oh, and maybe in even more detail with some examples, I have not read it yet:

                              https://github.com/RalphBacon/PCF8574-Pin-Extender-I2C

                              ...but it looks like a software interrupt rather than a hardware interrupt??? I am confused.

                              ... at least for the last example: It does not need any library. It's all quite clear in one sketch.

                              AWIA 1 Reply Last reply
                              0
                              • karl261K karl261

                                @AWI I found this library:

                                https://github.com/skywodd/pcf8574_arduino_library

                                There is a lot of talk about interrupt functionality and it seems to be somehow implemented. But I don't fully understand how it works. Maybe you can make something out of it?

                                Oh, and maybe in even more detail with some examples, I have not read it yet:

                                https://github.com/RalphBacon/PCF8574-Pin-Extender-I2C

                                ...but it looks like a software interrupt rather than a hardware interrupt??? I am confused.

                                ... at least for the last example: It does not need any library. It's all quite clear in one sketch.

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

                                @karl261 the last sketch does not work with interrupts. It just mentions them.

                                I would stick with the previous suggestion. Measure the current when you set some outputs to low (low is active 1)

                                karl261K 2 Replies Last reply
                                0
                                • AWIA AWI

                                  @karl261 the last sketch does not work with interrupts. It just mentions them.

                                  I would stick with the previous suggestion. Measure the current when you set some outputs to low (low is active 1)

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

                                  @AWI Yes, I will work with the test sketch on the weekend. It is clear to me now how to set pins of the PCF8574 to HIGH or LOW, and from there we can see.

                                  1 Reply Last reply
                                  0
                                  • AWIA AWI

                                    @karl261 the last sketch does not work with interrupts. It just mentions them.

                                    I would stick with the previous suggestion. Measure the current when you set some outputs to low (low is active 1)

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

                                    @AWI Finally:

                                    Yes, it works as expected. 4 pins are 0 V and 4 pins are 3.3 V. The chip is using 2.5 uA.

                                    I had to change a little bit the library, it did not compile and was slightly outdated, also the function we wanted to use was private, but I just did the changes in the library.

                                    I also needed to update to the latest arduino from 1.6.5 to 1.6.12, because i got an error: collect2.exe: error: ld returned 5 exit status. Now it works.

                                    Where do we go from here?

                                    AWIA 1 Reply Last reply
                                    1
                                    • karl261K karl261

                                      @AWI Finally:

                                      Yes, it works as expected. 4 pins are 0 V and 4 pins are 3.3 V. The chip is using 2.5 uA.

                                      I had to change a little bit the library, it did not compile and was slightly outdated, also the function we wanted to use was private, but I just did the changes in the library.

                                      I also needed to update to the latest arduino from 1.6.5 to 1.6.12, because i got an error: collect2.exe: error: ld returned 5 exit status. Now it works.

                                      Where do we go from here?

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

                                      @karl261 Thats good news! What you now have is 4 rows high/ 4 colums low (or v.v.). Now short a column with a row and and expect :baby: an interrupt (= keypress). If that is the case, you can create (or copy) a routine to read the key or keys pushed.

                                      karl261K 3 Replies Last reply
                                      0
                                      • AWIA AWI

                                        @karl261 Thats good news! What you now have is 4 rows high/ 4 colums low (or v.v.). Now short a column with a row and and expect :baby: an interrupt (= keypress). If that is the case, you can create (or copy) a routine to read the key or keys pushed.

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

                                        @AWI yeah, I kind of thought the same. I'll try to have rows high and colls low and see if the interrupt pin finally triggers. I should have some pull up on the interrupt pin. Then I'll need to see if I need any pull up or down on the other lines..,

                                        Hope I'll get something done this weekend.

                                        1 Reply Last reply
                                        0
                                        • AWIA AWI

                                          @karl261 Thats good news! What you now have is 4 rows high/ 4 colums low (or v.v.). Now short a column with a row and and expect :baby: an interrupt (= keypress). If that is the case, you can create (or copy) a routine to read the key or keys pushed.

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

                                          @AWI Ok, so far so good. If I connect 4 high wires to rows and 4 low wires to columns (or vice versa, no idea) then the interrupt pin indeed changes to 0. If I connect the interrupt pin of the IC to D3of the Arduino and then both through a pull up of 10 kOhm to Vcc, the interrupt is at 3.3 V. If I press a key it goes down to 0.040 V. That should be enough to read it as low.

                                          That sounds good, doesn't it? The question is, whether the key library still works...

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


                                          32

                                          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