Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    How to set the Pin mode for machine.deepsleep?

    Scheduled Pinned Locked Moved LoPy
    18 Posts 5 Posters 1.2k Views 5 Watching
    Loading More Posts
    • 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.
    • robert-hhR Offline
      robert-hh @KenM
      last edited by

      @KenM My best experience with going to sleep is by setting pins, which drive external loads, to input mode before going to deep_sleep. Then it is guaranteed to be in high impedance state. Unless of course you need it to drive something, which of course then consumes power.

      K 1 Reply Last reply Reply Quote 0
      • K Offline
        KenM @robert-hh
        last edited by KenM

        @robert-hh
        Changed the code to

        from machine import Pin
        RelayPin=Pin('P20', mode=Pin.IN)
        

        Didn't change it, well, P20 is always draining current now, not only in machine.sleep and machine.deepsleep.

        robert-hhR 1 Reply Last reply Reply Quote 0
        • robert-hhR Offline
          robert-hh @KenM
          last edited by

          @KenM In that case you most probably have an problem in the circuitry. Do you have the choice to connect the LED to GND instead of 3.3v. I'm suspecting a current through the ESD protection diodes, when during deepsleep the I/O circuitry is switched off. Whether that works for you final set-up, is another story.

          K 1 Reply Last reply Reply Quote 0
          • K Offline
            KenM @robert-hh
            last edited by KenM

            @robert-hh
            I can change the board to source it instead of drain it but I was hoping this could be fixed in software, my I2C pins with external pull-ups don't draw current.
            As test I tried to init P20 as part of the I2C but that didn't change the behavior of P20. (same for P19)

            robert-hhR 1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @KenM
              last edited by

              @KenM Cyn you tell which direction is the current flow of P20 is?

              K 1 Reply Last reply Reply Quote 0
              • K Offline
                KenM @robert-hh
                last edited by

                @robert-hh
                It's sinking to ground through the external led/diode from 3.3V so there is only one direction possible.

                robert-hhR 1 Reply Last reply Reply Quote 0
                • robert-hhR Offline
                  robert-hh @KenM
                  last edited by robert-hh

                  @KenM I made a test myself, using a 1k resistor between 3.3V and P20:

                  • after boot: 78µA
                  • When set to OUT, value=1: 5.2 µA
                  • when set to OUT, value = 0: 3.2 mA
                  • When set to IN: 0 µA

                  In any IN/OUT/value setting: Current during deepsleep: 0 µA.
                  I tested also P10. Same behavior.
                  So there may be some other reason.

                  K 1 Reply Last reply Reply Quote 0
                  • K Offline
                    KenM @robert-hh
                    last edited by

                    @robert-hh
                    That good news and bad news
                    You used this code above with the same firmware version like mine on a lopy4 on an extension board?

                    robert-hhR 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @KenM
                      last edited by

                      @KenM I use 1.20.1r1, but a homebrew extension board, with absolute no connection to P20 or P10, unless I wire some.

                      K 1 Reply Last reply Reply Quote 0
                      • K Offline
                        KenM @robert-hh
                        last edited by

                        @robert-hh
                        I did cut the connection of P20 to the expansion board but kept the connection of P20 to my board, and it work perfect now :)

                        I will need to check if I lost some functionality of the expansion board.

                        All wasted time, because pycom refuses to give the schematic of the expansion board...

                        Thanks for doing some compare tests.

                        J 1 Reply Last reply Reply Quote 0
                        • J Offline
                          jcaron @KenM
                          last edited by

                          @KenM Welcome to the pin cutters club (https://forum.pycom.io/topic/1673/pysense-pinout-wake-on-pin/19) :-/

                          1 Reply Last reply Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post

                          Pycom on Twitter

                          Pycom