Hello.
I thought my problem was trivial, but it looks like my approach doesn't fit the issue. I hope that you will be able to help me. Thank you in advance.
Problem description:
The ESP8266 chip has only one analogue port A0. I need to connect two “analogue sensors” to:
1) Read the humidity level (0-5V).
2) To read the battery discharge level of the B16350 (0-4.2V).
Both measurements are based on voltage (V), not current (A). The measurement result should be in the range 0 - 1V, but this is not a problem as I can use a voltage divider.
Problem solved:
The humidity level sensor is powered from the digital port D2 (3.3V), which is only switched on for the measurement time. The measurement is performed via the analogue port A0. This only works if the battery level measurement is switched off.
Measurement of the battery discharge level is carried out also via the analog port A0 at the time when the power supply of the humidity level sensor from port D2 = 0V.
I tried to use an NPN transistor BC239C as a relay to select which sensor would be measured. The assumption was that during the humidity measurement the power for the sensor would come from D2, which would supply 3.3V and D0 would supply 0V to the base of the transistor blocking the voltage from the battery. In the next battery discharge measurement, D2 switches off the power supply to the sensor and switches on the voltage to the base of the transistor from D0. The fully saturated transistor will pass the full voltage from the collector to the emitter, which will then be measured. The circuit is wired as follows (diagram below in pdf attachment):
1) Minus - common ground for the battery, ESP8266 and for the humidity level sensor.
2) Plus from the battery connected to the collector (C) of the transistor via resistor R2 47 Ohm (to limit the base current to 100mA).
3) D0 port (3.3V) connected to the base of the transistor (B) via R1 16.5k Ohm (to limit the base current to 0.2mA).
4) Emitter connected to port A0 to read the measurement.
5) Port D2 (3.3V) connected to the sensor power supply.
Problem description:
The voltage height at the emitter is lower than the battery voltage value regardless of the battery voltage value. I checked two batteries:
1) Fully charged battery 4.2V emitter-mass reading 2.82V.
2) Slightly discharged battery 3.7V emitter-mass reading 2.80V.
I know that the control of such a transistor is done by current, not voltage, but I thought that all (almost all - proportionally) of the voltage from the source would be sent to the emitter. It seems that I don't understand something .
I thought my problem was trivial, but it looks like my approach doesn't fit the issue. I hope that you will be able to help me. Thank you in advance.
Problem description:
The ESP8266 chip has only one analogue port A0. I need to connect two “analogue sensors” to:
1) Read the humidity level (0-5V).
2) To read the battery discharge level of the B16350 (0-4.2V).
Both measurements are based on voltage (V), not current (A). The measurement result should be in the range 0 - 1V, but this is not a problem as I can use a voltage divider.
Problem solved:
The humidity level sensor is powered from the digital port D2 (3.3V), which is only switched on for the measurement time. The measurement is performed via the analogue port A0. This only works if the battery level measurement is switched off.
Measurement of the battery discharge level is carried out also via the analog port A0 at the time when the power supply of the humidity level sensor from port D2 = 0V.
I tried to use an NPN transistor BC239C as a relay to select which sensor would be measured. The assumption was that during the humidity measurement the power for the sensor would come from D2, which would supply 3.3V and D0 would supply 0V to the base of the transistor blocking the voltage from the battery. In the next battery discharge measurement, D2 switches off the power supply to the sensor and switches on the voltage to the base of the transistor from D0. The fully saturated transistor will pass the full voltage from the collector to the emitter, which will then be measured. The circuit is wired as follows (diagram below in pdf attachment):
1) Minus - common ground for the battery, ESP8266 and for the humidity level sensor.
2) Plus from the battery connected to the collector (C) of the transistor via resistor R2 47 Ohm (to limit the base current to 100mA).
3) D0 port (3.3V) connected to the base of the transistor (B) via R1 16.5k Ohm (to limit the base current to 0.2mA).
4) Emitter connected to port A0 to read the measurement.
5) Port D2 (3.3V) connected to the sensor power supply.
Problem description:
The voltage height at the emitter is lower than the battery voltage value regardless of the battery voltage value. I checked two batteries:
1) Fully charged battery 4.2V emitter-mass reading 2.82V.
2) Slightly discharged battery 3.7V emitter-mass reading 2.80V.
I know that the control of such a transistor is done by current, not voltage, but I thought that all (almost all - proportionally) of the voltage from the source would be sent to the emitter. It seems that I don't understand something .