GPy influences measured Voltage



  • 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



  • @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.



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



  • @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)?



  • 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?



  • @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?


  • @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.



  • 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



  • This post is deleted!


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


Log in to reply
 

Pycom on Twitter