reading multiple analog sensors

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
czahn
New user
Posts: 1
Joined: 25 Aug 2018, 10:58

reading multiple analog sensors

#1 Post by czahn » 25 Aug 2018, 11:07

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

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: reading multiple analog sensors

#2 Post by Shardan » 25 Aug 2018, 11:54

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
Regards
Shardan

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: reading multiple analog sensors

#3 Post by papperone » 25 Aug 2018, 12:36

3rd solution is the easiest and safer IMHO!
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests