I'm currently using a circuit with 2 separate transistors that can be switched on or off to measure 2 separate voltage inputs.
The reason for this is because I'm using an esp8266 which has only one ADC input at pin A0 and I need to measure light intensity from an LDR as well as voltage from a solar panel.
The LDR is wired with a voltage divider. The voltage input from the solar panel is 0 - 5v, so I have that wired with a voltage divider to output a max of 3.3v (pin A0 is 0 - 3.3v). The problem is that in complete darkness, the ADC is still reading the LDR with a value of around 260 (should be close to zero) and with bright light reading around 850 (should be close to 1023). Also, the voltage measured from the solar panel (divided to 3.3v) is returning anywhere from 600 (0v) to around 840 (3.3v).
I've tried these input measurements separately with expected results. It's having the option to switch inputs is what is tripping me up.
So, is my approach correct or is there another way to do this?
Note: I would have included a circuit diagram if I knew anything about circuits and making diagrams.