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

    GPy influences measured Voltage

    Scheduled Pinned Locked Moved GPy
    10 Posts 3 Posters 31 Views 3 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.
    • D Offline
      Danny Helwegen
      last edited by

      Hi all,

      I'm quite new to microcontrollers so don't understand everything about them at the moment. The target with the current GPy in combination with an expansion board is to read out 2 analog signals ranging from 0 to 3 Volt. When I measure the output from the device it equals about 0.5 V, however when I connect the wire of the device to the GPy, then the measured voltage is around 1.4V.

      What causes this increase in measured voltage and how can I solve it?

      By searching on the internet I thought that it might be due to the high input impedance of the GPy and that the solution might be a voltage follower or a buffer amplifier. However, I am not sure about this.

      Thanks in advance.

      Danny

      J robert-hhR 2 Replies Last reply Reply Quote 0
      • J Offline
        jcaron @Danny Helwegen
        last edited by

        @Danny-Helwegen can you provide a schematic? Actually two would be better (one for each measurement), indicating where you make the measure.

        D 1 Reply Last reply Reply Quote 0
        • D Offline
          Danny Helwegen
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • D Offline
            Danny Helwegen @jcaron
            last edited by

            Hey @jcaron , thanks for the reply. I've included a schematic for both scenario's. I hope that this helps to understand the situation. I've connected the device to Pin 18 on the GPy. Situation 2.png Situation 1.png

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

              @Danny-Helwegen Can you show the piece of code you use to read the ADC voltage? Did you set the attenuation value to 11dB? Which Pin do you use? Some pins are internally used.

              P.S.: A digital volt meter usually has a high impedance as well, like 10MOhm.
              P.P.S.: The ADC of ESP32 is notoriously bad. You will need some filtering by a capacitor of a few nF immediately at the input to GND. The 150Ohm resistor is fine.

              1 Reply Last reply Reply Quote 1
              • J Offline
                jcaron @Danny Helwegen
                last edited by jcaron

                @Danny-Helwegen How is pin 18 configured? Did you set it as an input? Did you disable pull-ups? What is the device, and what's the purpose of the 150 ohm resistor?

                Also, which pin is "pin 18"? There are multiple numbering schemes for the GPy pins. On the pin-out diagram, which is it?

                • Pin 18/P9/GPIO12, on the left, fourth from bottom?
                • Pin 10/P18/GPIO34, on the right, sixth from bottom?
                • Another one?
                1 Reply Last reply Reply Quote 0
                • D Offline
                  Danny Helwegen
                  last edited by

                  Hey @jcaron and @robert-hh , sorry for the late reply. Sadly I wasn't able to reply faster.

                  The answers to your questions:

                  • The purpose of the 150 ohm resistors is to convert the signal from 4-20mA to 0-3V
                  • I did not define it as an input (see code below)
                  • It is Pin 10/P18/GPIO34

                  Code:

                  import pycom
                  import time
                  
                  import machine
                  from machine import ADC
                  adc = ADC()
                  adc_box     = adc.channel(pin='P18', attn=ADC.ATTN_11DB)
                  
                  while True:
                      pycom.rgbled(0x00FF00) # Green Led
                      volt_box    = adc_box.voltage()     # [mV]     
                  
                      print(time.time(), volt_box)
                  
                      pycom.heartbeat(False) # No Led     
                      time.sleep(1)
                  

                  @robert-hh , what do you mean with the ADC of ESP32 is notoriously bad, would you recommend to use another device for this purpose? E.g. Arduino or Teensy?

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

                    @Danny-Helwegen The code looks fine so far. And according to the GPy Pinout there is nothing internally connected to GPIO34 besides the MCU. The FiPy has the LTE modem output connected to GPIO34.
                    There was quite some discussion about the ESP32's ADC. It is quite noisy and not very linear, especially at the ends of the range. But with 4-20 mA you would anyhow discard the low end. Considering the noise, the effective resolution is about 9 bit. You can drop the noisy by averaging, increasing the resolution.
                    But it's still not clear why the voltage across the 150 Ohm resistor increases when you connect it to the GPy. Is the output of the device floating (no reference to GND)?

                    D 1 Reply Last reply Reply Quote 0
                    • D Offline
                      Danny Helwegen @robert-hh
                      last edited by

                      @robert-hh The output of the device is connected to the ground of the PyCom, together with the ground of the power supply.

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

                        @Danny-Helwegen I understand, but that was not the intention of my question. You could try the following:
                        Disconnect the device from the GPy and measure the current that flows from either output of the device to GND of GPY, with the other device output floating and the GPY's USB port connected to your PC. The current should be 0. If not, the device has internal connections to GND, which can have the effect you see.

                        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