Hello everyone! Mechanical engineer with almost zero knowledge in electronics here, so bear with me
I'm currently working on a battery powered project (automated watering system with data logging feature) and therefore need to design an energy efficient circuit. In order to reduce power consumption, I planned to use a 2n2222a NPN transistor to connect/disconnect the utilized sensors and an SD card module to Vcc.
So far so good - at least the SD card module works well in this setup. The sensors (capacitive moisture sensor, water level sensor) however, read a significantly higher value when I use the NPN transistor to connect them to Vcc compared to when they are permanently/directly connected.
After measuring the supply voltage in both cases, I realized that a voltage drop of about 0.8V occurs across the collector and emitter of the NPN transistor. Hence, the sensors are powered with only 4.2V. My understanding right now is that if the Arduino runs on 5V and the supply voltage of the sensors is lower, the offset affects the readings. I tried running the Arduino on 4.2V while connecting the sensor directly, in this case the readings were correct as well. Although I think I have identified the problem and can fix it, I don't quite understand the cause of it. Is the Arduino comparing the read input values to its internal Vcc?
When designing the circuit, I expected the voltage drop across the transistor to be negligible, but after doing some research, I believe the reason for this large drop is the "emitter follower" behavior of the simple NPN switch circuit.
I found and used this formula to calculate the voltage drop V_ce:
V_ce = V_cc - R_eI_e = V_cc - [(beta+1)(V_cc - V_be)][(beta+1)R_e +3]^-1
This when using a 17kOhm or value for the emitter resistance R_e (measured between Vcc and GND of the soil moisture sensor), this yields a drop V_ce = 0.7V, same for R_e = 2MOhm (between Vcc and GND of the water level sensor). The calculations were done using beta=100. The simulation in circuit lab gave similar results, although the drop was slightly lower (0.54V).
When using a PNP transistor, the setup works fine as the V_ce drop is much lower (below 0.1V). I believe this is due to the fact that the high load resistance does not affect the transistor saturation (?), but in this case I need to permanently pull the transistor pin high to cut the supply voltage of the sensors. Does this result in increased power consumption compared to the NPN circuit? To my understanding, with a 5V pin level at the transistor base of the PNP does not allow any current to flow. But then again, the pin needs to permanently be pulled to 5V instead of 0V...
I also found a suggested schematic as an alternative to the simple NPN switch (attachment 2). I plan to go with this, in case the simple PNP variant defeates the purpose of saving power. I don't understand the point of resistor R3 though, can someone help me out here? I would've just used 1kOhm resistors for R1 and R2.
Sorry for the long post, but I thought maybe someone can make use of the information I found during my research. To recap, my three questions are:
-
Why does the voltage offset between the Arduino Vcc and sensor supply voltage alter the sensor readings?
-
Can I switch to the simple PNP circuit and still achieve power saving?
-
What's the point of R3 in the schematic of attachment 2?
Thank you in advance!
Cheers, Thomas