ADC and ML-020S-O Lux Sensor



  • 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())
    


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



Pycom on Twitter