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

    [Pysense] How can I connect a sensor to the external IO Header

    Scheduled Pinned Locked Moved Expansion Board
    pysenseheaderspicinterruptpins
    25 Posts 10 Posters 10.7k Views 10 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.
    • C Offline
      crumble @pierrot10
      last edited by

      @pierrot10 said in [Pysense] How can I connect a sensor to the external IO Header:

      @crumble said in [Pysense] How can I connect a sensor to the external IO Header:

      You build a PCB which you place between the development and the expansion board (like the deepsleep board).

      I meant the form factor of the board, not the deep sleep board itself. Sorry to wrote that not clear.

      1 Reply Last reply Reply Quote 0
      • sebS Offline
        seb @pierrot10
        last edited by seb

        @pierrot10

        time.sleep() is as a delay without saving battery energy?
        That's correct, this is just for waiting a period of time not actually putting the CPU into sleep mode.

        If you are using a LoPy, SiPy or WiPy 2.0 you will require a deepsleep shield or pysense/pytrack in order to use deep sleep properly (The voltage regulator on these devices does not go into low power mode, and therefore uses lots of power in deep sleep mode, the extra boards fix this by removing power from the module). For all other pycom modules the deepsleep function works correctly and no external hardware is required.

        One thing to note when performing deepsleep, upon waking up the device does not continue from where it left off, it restarts just as if you pressed the reset button.

        As for what pins you should avoid using, it goes as follows:

        • The sensors are connected via I2C on SDA=P22 and SCL=P21. You can connect more I2C devices to this.
        • The usb UART is connected to P0 and P1
        • The onboard switch is connected to P14 (if you are not using this then you are ok to connect something else to it)
        • The SD-card is connected on SD_CMD=P4, SD_CLK=P23 and SD_DAT=P8 (Same as above, if you don't use this, it's free to be connected to something else)
        • P13 is used for interrupts from the microcontroller on the pysense (avoid using)
        • P3 is connected to mosfets that disconnect power from the module (avoid using)
        pierrot10P 1 Reply Last reply Reply Quote 0
        • M Offline
          MarcoBenini
          last edited by MarcoBenini

          On Pycom tboards there are two I2C hardware peripherals that can be used (+ 1 bit-banged software driver).

          So You don't need to solder wires, just use the other I2C bus, the "1" one and use two of the GPIO pins that are available in connector of the PySense.

          There are, as other wrote, ADC converters that has an I2C interface, for example, 4 (single ended) channels, there are ADS1015 (12 bit), ADS1115 (16 bit), 18 bit, 24 bit, ...
          The advantage of this solution is that You can find ADC I2C chips with 1, 2 or 4 channels, that can be used single ended or for differential analog input, with programmable gain control, low drift internal voltage reference, ...

          As for the libraries there are a many examples or libraries in Python for several of I2C ADC, or can be derived, for example, from Arduino libraries.

          For example for ADS1x15
          [link text]https://github.com/robert-hh/ads1x15(link url)

          1 Reply Last reply Reply Quote 0
          • pierrot10P Offline
            pierrot10 @seb
            last edited by

            @seb Dear all,
            Thank for your advise. I finally ordered an Extention boead that I just received. I will test my project. I think your previous statements are available for the extention board. Then just would like to have an advise to avoid burning my LoPy4 :o)
            So I can resume as the following
            0_1519420254121_ext.png

            • P21 and P22 are reserved for SDA and SCL (I2C)
            • P13, P15, P17, P18 can be used as ADC

            But does P14 (Switch) and P16 (VBAT) P19 (RTS) and P20 (CTS) can be used as ADC as well, as they look like reserved for VBAT, RTS, CTS, etc...)?

            I supposed I do not need a converted Analog to Digital? Can I directly connect my Analog input?

            I will try this schema which is my favorite
            0_1519420294874_wm1.png
            WMx are the moisture sensor.

            I first will try with one sensor. Then I will conect A1 to P13
            D1 and D2 and two digital output, when D1 is HIGHT, D2 is LOW. D1 must be 3.3V. I will have to programm LyPo4 to altenate D1 and D2 to avoid corrostion and make an average of the result....

            Then I can use P6 and P7 for D1 and D2? P6 and P7 look like free and not use....

            Then later, I will use 3 of the WM. Then I can connect A2 to P15 and A3 to P17
            P18 can be reserved for a 4 sensors.

            IF all is correct, I will have another problem, because I would need (not sure) two more Analog measure. Then can P19 and P20 be used? What will be the impact on RTC and CTS?
            Or, can I use P19 or P20 as digital inpout (waterproof temperature sensor)

            P16 confused me because , its states 'VBAT'. What does it meens? It's a VBAT output?

            I am also a bit confused about P14

            if you are not using this then you are ok to connect something else to it

            P14 could be the output the measure when the button is pressed?
            Or, can I use as Digital Input for Rain gauge (magnetic switch)?

            Many, many thank for your clarification, it's help! (I hope, I was clear :o). )

            Have a nice week-end!

            J D 2 Replies Last reply Reply Quote 0
            • J Offline
              jclo13 @pierrot10
              last edited by

              @pierrot10,could you make it work? I am doing something similar but I am confused about which pins I have to use.

              Thank you in advance

              pierrot10P 1 Reply Last reply Reply Quote 0
              • pierrot10P Offline
                pierrot10 @jclo13
                last edited by

                @jclo13 Hello,
                I am on a good way, but I postponed that project due to other emergency tasks. I planned to be back with Pycom in a couple of weeks. I will update you.

                1 Reply Last reply Reply Quote 0
                • pierrot10P Offline
                  pierrot10 @seb
                  last edited by

                  @seb Dear Seb,
                  But would it possible or recommended to solder header on the side of the LoPy?
                  alt text

                  J S 2 Replies Last reply Reply Quote 0
                  • J Offline
                    jmarcelino @pierrot10
                    last edited by jmarcelino

                    @pierrot10
                    I’m afraid Seb has left Pycom but I’ll answer.

                    Soldering a header to the side could work but not very mechanically stable. If it breaks it may take some of the pads.

                    I would recommend a female long pin stacking header for your application

                    1 Reply Last reply Reply Quote 1
                    • D Offline
                      DDA @pierrot10
                      last edited by

                      @pierrot10
                      I see a problem with the schematics above, when reading multiple WM sensors the ground paths should be isolated:

                      “
                      Sensors must be powered individually, and the ground must be isolated from sensor to sensor. Even if powered individually, an open ground path to another un-powered sensor can't be allowed. This is best accomplished using multiplexers to open and close the appropriate channels.
                      “
                      For additional details please refer to :
                      www.irrometer.com/200ss.html

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        sslupsky @pierrot10
                        last edited by

                        Hi @pierrot10 The internal ADC has very poor performance. The non linearity is poor and it has a high noise floor. I think someone earlier suggested using an external ADC and I think that is very good advice.

                        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
                        • 2
                        • 1 / 2
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom