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 and ML-020S-O Lux Sensor

    Scheduled Pinned Locked Moved MicroPython
    luxsensoradcanalog read
    2 Posts 2 Posters 195 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.
    • T Offline
      tttadam
      last edited by

      Hello there,

      I have this analog lux sensor, and I am unable to get any resonable value (only 4095 always) out of it based on the sample code. Can you help what did I do wrong?
      Some word about the wiring:
      The light sensor has 3 wires: A white an orange and one uncovered.
      I put the orange in P5 and white to gnd (I tried a reverse also) and I do nothing with the uncovered one.

      import machine
      
      adc = machine.ADC()             # create an ADC object
      apin = adc.channel(pin='P16')   # or P5 on the expansion board
      print(apin())
      
      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @tttadam
        last edited by robert-hh

        @tttadam If I understand the data sheet right, the orange should go to GND an the white to an Analog input, like P13 to P18. The uncovered one is shielding. You can put that to GND. The output range is small, 0-30mV, which means, that you will get no reasonable reading, because there is no reading at all below ~70mV. The value you read should mostly be 0. So you need to insert an amplifier.
        Edit: The ESP32 has an built-in amplifier. But that is not supported by the Pycom firmware and not by espressif itself.

        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