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 FiPy difficulty

    Scheduled Pinned Locked Moved FiPy
    3 Posts 2 Posters 234 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.
    • P Offline
      peter_
      last edited by

      I'm having difficulty getting meaningful ADC values with my FiPy and Expansion board 3. I have a 10k pot connected to ground and 3.3v. The wiper I have tried connecting to many different ADC pins such as P12, P,13, P14, P17, P16.

      The values are pretty static regardless of what the position of the wiper is. Even if I short the input pin directly to the 3.3v there seems to be no change. Here's what I'm using:

      from machine import ADC
      adc = ADC(0)
      adc_c = adc.channel(pin='P13', attn=ADC.ATTN_11DB)
      print(adc_c.voltage())
      
      

      Am I doing something silly here?

      The expansion board firmware(3.1) is up to date. I haven't looked into upgrading the FiPy yet.

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

        @peter_ I Cannot confirm your observation. I extended your little test code as follows (no pot), with a connection between P22 and P13:

        from machine import ADC, DAC
        from time import sleep
        adc = ADC(0)
        adc_c = adc.channel(pin='P13', attn=ADC.ATTN_11DB)
        dac = DAC('P22')        # create a DAC object
        for _ in range( 100):
            dac.write(_ / 100)
            print(adc_c.voltage())
            sleep(0.1)
        

        Not that adc.voltage() requires a calibration for better values, and that the input of the ADC should be low impedance. If you pot has a high impedance, connect a small capacitor (~10 nF) between ADC input and GND,

        1 Reply Last reply Reply Quote 1
        • P Offline
          peter_
          last edited by

          Thanks, I didn't realize the pinout on the expansion board was different from the FiPy. PRINT TOO SMALL :-P

          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