AnalogInput giving none ) value when not connected

Hi
I have had a search on sight but cant find anything relates to this so hope I am not posting about known issue.

I have a small solar panel that I have attached to an analog input on extender module (p3)
It was giving me some strange reading so I disconnected the solar panel and the input kept giving me a value for voltage?

Have I stumbled on a way of making free power or have I done something wrong???

Below is my code:
GT.Interfaces.AnalogInput lightin = extender.SetupAnalogInput(GT.Socket.Pin.Three);
double voltsin;
Font baseFont = Resources.GetFont(Resources.FontResources.NinaB);
display_TE35.SimpleGraphics.AutoRedraw = true;
while (1 == 1)
{
display_TE35.SimpleGraphics.Clear();
voltsin = lightin.ReadVoltage();
display_TE35.SimpleGraphics.DisplayText(voltsin.ToString(), baseFont, GT.Color.White, 0, 20);
}

Analog voltage readings will never be completely static when you have something connected. And when disconnected, you’ll get stray signals making it vary. The ADC uses an approximation method to sample the voltage it gets as an input and return what the digital value of that would be - I don’t think you’re seeing anything unusual. Maybe a better way to look at what your strange readings were on the solar panel is to tell us about that.

One other very important thing. ADCs are sensitive devices and usually are not capable of taking 5v on a 3v3 device. What is the max voltage of your panel?

Ah thanks for that.
this issue with the solar panel was… cough I had it wired up the wrong way cough
the voltage of solar panel (under house lighting) is 0.25v so nothing massive just wanna use it as light detector to turn a small led on and off.
Thanks for info

ok cool. LDRs, or Light Dependent Resistors, are probably better used for that :slight_smile: but as long as you can guarantee your panel will never exceed 3v3, you should be fine - as long as you can detect the difference between no power and 0.25v! One way to get higher accuracy is to oversample and average.