LoPy4 ADC use for UV sensor

I am trying to use an analogue UV intensity sensor with my LoPy4. I am getting some odd numbers, so I disconnected everything and from pin 17 am still reading 75mV. The sensor should show 10mV per Watt per m^2. Am confused as to how I can tell when there is zero UV if the ADC shows a value even with no connection? Is this normal?

Thank you in advance.
John

Hey John,

Do you have the script that’s running on the LoPy4 available and ensured to check the clarity of all connections within the system to make sure there’s no ‘dry joints’ or shorts that could be causing a false reading on the LoPy. The other option is just to account for the 75mV reading as zero and hence 85mV as 1m^2 etc… as it may just be some kind of offset in the script that should be accounted for.

All the best with your projects and have a Happy New Year!

Bryce
Core Electronics | Support

Hi Bryce,

The script is very simple, shown below. I have removed all connections from the LoPy4 and am getting 75mV still. What you’re saying makes sense, I’ll just have to get an accurate UV source to ensure that 75mV is zero and 85mV is 1m^2 or what ever it should be. Unless having an ADC read a voltage with no connections in the LoPy4 causes you to think there may be a something wrong with the device?

from machine import Pin
from machine import ADC
adc = ADC()
ADC_PIN = Pin(‘P17’)
ADC_PIN.value(0)
print(ADC_PIN.value())
adc1 = adc.channel(pin=‘P17’)
adcvalue = adc1.voltage()
print(adcvalue)

Thanks,
John

Hey John,

Yes that does seem very odd. I’d recommend doing some other projects or tests with your LoPy4 and see whether any common issues occur with being able to control the pins and the analog reading capabilities. Make sure to let us know if you make any progress. I don’t see any obvious issues in the script, so that should be fine.

Enjoy 2020!

Bryce
Core Electronics | Support