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 connect a LoPy to a moisture sensor?

    Scheduled Pinned Locked Moved LoPy
    lopysensorsen0193moisture sensor
    15 Posts 4 Posters 4.4k Views 4 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.
    • J Offline
      JeromeMaquoi @robert-hh
      last edited by

      @robert-hh I changed the code but now, it's not working at all. I put your code on the LoPy and here is what I see when I launch it. :/

      0_1509379714724_Capture du 2017-10-30 17:06:24.png

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

        @jeromemaquoi Please update the firmware. You seem to have a state of December 2016.

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          JeromeMaquoi @robert-hh
          last edited by

          @robert-hh Oh yes. Thank you ofr your answers, it works now! :D

          1 Reply Last reply Reply Quote 0
          • G Offline
            gruia.nichita @robert-hh
            last edited by

            @robert-hh Hi, Robert! Why I get the value more than 1000, but in the specification wrote that i can get value to 950.
            Thank you for your answers,
            Nichita

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

              @gruia-nichita This statement is just for the example setup with an arduino and maybe an 10 Bit ADC. Using Lopy, the maximum output value of the ADC in 12 bit mode is 4095.

              G 1 Reply Last reply Reply Quote 0
              • G Offline
                gruia.nichita @robert-hh
                last edited by

                @robert-hh So I have the same result in percentage?

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

                  @gruia-nichita The adc just returns a reading for a voltage. To get a percentage reading, you have to calibrate your set-up with the minimum and maximum reading. You get the minimum reading certainly when you just stick the dry sensor into the air. For the maximum reading you can stick the sensor either into wet soil or salted water. Then the perctentage reading is like:
                  act_reading/(maximum - minimum) * 100
                  assuming there is a linear relation between adc reading and humidity.

                  1 Reply Last reply Reply Quote 1
                  • R Offline
                    Rachelsimida @robert-hh
                    last edited by

                    @robert-hh Hi, I want to know if it is the same principle and operation for me to connect lopy with an ultrasonic sensor. I try your code but it reply nothing on the screen. I have two kind of sensors but I only use one to connect with lopy.
                    This is the model of my 2 senosrs. One is HC-SR04 with 4 feet: trig,echo,vcc,gnd; The other sensor has 3 feet: vcc,gnd,sig.
                    0_1519493728224_1.PNG
                    The screenshot from using the 3 feet sensor. If there is something missing of my code. I am beginner of this.
                    Thank you!

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

                      @rachelsimida Yes, the principle is completely different. While for the humidity sensor you had to take an analog value, you have to determine here the length of a pulse. Would you mind to tell me the type of the other sensor which you try to use here?
                      I must say that w/o a snesor at hand I can give you only vague directions.

                      R 2 Replies Last reply Reply Quote 0
                      • R Offline
                        Rachelsimida @robert-hh
                        last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • R Offline
                          Rachelsimida @robert-hh
                          last edited by

                          @robert-hh Thanks for your reply.
                          I only have two sensors at hand now. No matter which one I use, it's ok. Since the principle is completely different. For the two sensors, do you familiar with them? Can you teach me some direction about how to program if you know. It's hard to find the same topic in the website and I am extremely confused now. Thanks! This is the image of the sensor, which provided by my supervisor.0_1519505277502_hc-sr04-sonar-sensor.jpg
                          0_1519505283547_Ultrasonic_6.png

                          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