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

    Micro Python ADC Class pin assignments

    Scheduled Pinned Locked Moved Issues & Bugs
    4 Posts 2 Posters 143 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.
    • G Offline
      guyc
      last edited by

      In dealing with the ADC Class function I have the following questions;

      I have 2 prototype designs, 1 based on LoPy and the other on Gpy.
      On the Gpy design I am trying to read the Battery Voltage (range between 5.5v and 3.3v) through a 1M ohm and 47K ohm resistor divider connected to ADC1_CH7 (GPIO35 ESP32 pin 11).

      Can I use the ADC Class Function to read that channel? My code would be;

      adc = machine.ADC()
      BatterySensorPin = adc.channel(pin='P11', attn=machine.ADC.ATTN_11DB)
      BatterySensorPinVoltage = BatterySensorPin.voltage()

      My concern is that when I read the ADC Class documentation it says valid pins are 13-20. Is that a documentation error? If that is correct how are the other available ADC pins read? As an example, in my case how would I read ADC1_CH7 (GPIO35 ESP32 pin 11)?

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

        @guyc ADC 1_7 is GPIO35, and addresses with 'P17' or 'G31'. The 'Pxx' numbers are not the physical chip numbers are not the GPIO numbers are not the 'Gxx' numbers. If you look at the LoPy pinout sheet, they are all printed side-by-side. https://docs.pycom.io/gitbook/assets/lopy-pinout.pdf
        P.S.: Better ignore the 'Gxx' numbers. They are printed on the expansion boards and a constants source of confusion.

        1 Reply Last reply Reply Quote 1
        • G Offline
          guyc
          last edited by

          Thanks for clearing that confusion. I assume that is true for the other functions like the Pin Function?

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

            @guyc Yes, it is. In the repository there are tables which set the Gxx, GPIOxx and Pxx numbers side by side. For Lopy, it's here: https://github.com/pycom/pycom-micropython-sigfox/blob/Dev/esp32/boards/LOPY/pins.csv
            For the other boards the tables are in the respective paths.

            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