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

    ADC sensors on external PSU

    Scheduled Pinned Locked Moved Discussion
    adcexternal sensorpower supply5v input
    12 Posts 2 Posters 526 Views 2 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.
    • A Offline
      Alephus
      last edited by Alephus

      Im trying to read values from a few sensors that require 5V to work, so i know i cannot power them directly from my lopy4 board.

      Ive tryed 2 setups:
      -sensors connected to a 5v 2A usb adaptor, and the Lopy4 on an expansion board connected to another diferent usb adaptor. Sensors are only connected to the lopy4 trough the ADC pins.

      -sensors and lopy4 powered trough same usb adaptor (lopy4 powered trough Vin and Ground).

      In the first scenario, the sensors output is correct (read from multimeter) however when trying to read on Lopy4 it reads as 0v

      In the second scenario, the lopy can read values correctly but the values the sensors are outputting are wayy off scale (like 3 volts higuer)

      Obviously im doing something wrong, just not sure what?

      Also, is there a diference from powering the lopy from usb and from Vin?

      Best regards

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

        @Alephus Did you connect the GND pins of both LoPy4 and Sensor?

        1 Reply Last reply Reply Quote 0
        • A Offline
          Alephus
          last edited by

          @robert-hh

          When using the 2 diferent power supplies, i did try with the ground conected betwen the board and the sensors, but again, in that scenario the sensor output jumps from about 0,5V (correct) to about 3,7V (wrong). ![alt text]https://imgur.com/a/b51djfw(image url)

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

            @Alephus In case of two different power supplies you have to connect the GND wires. Otherwise it cannot work. And what you get is the consistent to the second scenario. Which sensor are you using? And where do you get the 0.5V?

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              Alephus @robert-hh
              last edited by

              @robert-hh

              i was using 2 sensores but reduced to just 1 for testing. The sensor is a SEN0219 Co2 sensor. It uses 5v and should output betwen 0 and 2v.

              0,5v is a very accurate reading for the enviorement we are in however having an output of 3,7v when the max is 2V is... wrong.

              Im not sure what im doing wrong.

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

                @Alephus Which pin of the LoPy4 are you using?

                A 1 Reply Last reply Reply Quote 0
                • A Offline
                  Alephus @robert-hh
                  last edited by

                  @robert-hh

                  Lopy4:
                  Vin : 5v input (5v @ 2A Usb wall charger)
                  GND : Ground (Gnd Usb wall charger)
                  P20 : sensor output

                  SEN0219:

                  • : 5v input (5v @ 2A Usb wall charger)
                  • : Ground (Gnd Usb wall charger)
                    Out: connected to P20 on lopy4
                  robert-hhR 1 Reply Last reply Reply Quote 0
                  • robert-hhR Offline
                    robert-hh @Alephus
                    last edited by

                    @Alephus What is the voltage at P20, taken with your multimeter, when the sensor is not connected, but the port is configured? It should be almost 0.
                    How did you configure P20? It should be something like:

                    from machine import ADC
                    adc = ADC()
                    adc_c = adc.channel(pin='P20', attn=ADC.ATTN_11DB)
                    

                    You may also try other Pins in the range P13 up to P20

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

                      @robert-hh

                      Regarding code, its exactly that since i know im reading up to 2v and normal adc without the attn only reads up to 1,1v

                      Regarding volts at the Pin im gonna read it and post here as soon as possible (had to leave for about 1, 2h)

                      In my head this situation makes no sense

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        Alephus @robert-hh
                        last edited by

                        @robert-hh the voltage is as you sayd, basicly 0. (0.06v) i literaly have no idea whats wrong. Is it the sensors? Is it the lopy? Even other pins do the same

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

                          @Alephus Connecting the sensor to the input should not raise the voltage measure at that connection. So it must be something else in the set-up.

                          A 1 Reply Last reply Reply Quote 0
                          • A Offline
                            Alephus @robert-hh
                            last edited by

                            @robert-hh said in ADC sensors on external PSU:

                            @Alephus Connecting the sensor to the input should not raise the voltage measure at that connection. So it must be something else in the set-up.

                            after a while i did a few more tests and found something:

                            • of all ADC1 pins, all behave properly except P19 and P20 (guess wich 2 i was using)
                            • a friend analized my problem as well and detected that those 2 pins where not "floating", and after analazing the datasheet he assumes its because they are the only ones with pullup/pulldown internal resistors.

                            So for now i have a solution however i still dont understand is why, after all, they are tecnicaly valid Pins pins in the datasheet

                            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