Page 1 of 1

reading multiple analog sensors

Posted: 25 Aug 2018, 11:07
by czahn
Hi !
i have two sensors. A moisture and a photoresistor. I'd like to use both together with a wemos d1 mini, which only has one analog input.
I already wired the vcc to several gpio's and defined a switch to power on/off the sensors. Both Analog output goes to A0 on the wemos.
Now i can switch between the senors, so that only one sensor has power.

Unfortunately the measurements for both senors are not correct. When i connect only one sensor to A0, everything works fine and the measurements are correct.

What do i wrong! Is there any trick?

Thanks a lot!
Regards.
C

Re: reading multiple analog sensors

Posted: 25 Aug 2018, 11:54
by Shardan
Hello,

as both sensors are permanently connected to the analog input they influence each other. Sorry, that won't work.
There are several ways out.

First you could replace the photo resistor with a luminosity sensor like TSL2561 or BH1750.

Second you could use a relay to switch the analog input itself instead of powering the sensors via GPIO.

Third you may use an external analog-to-digital converter (ADC) like the ADS1115.

Regards
Shardan

Re: reading multiple analog sensors

Posted: 25 Aug 2018, 12:36
by papperone
3rd solution is the easiest and safer IMHO!