Hello! I have a question: I am trying to make the resistor swap automatically. If its measurement is below 1000ppm, turn on digital 11, and turn off 10 and 9. A0 goes to measurement. But how can I add an NPN transistor? Could you help me understand where to place the NPN? I searched YouTube, but I am somewhat confused about dealing with multiple resistors and connecting my sensor.
Yes I was confused to connect the NPN transistor properly. Thank you so much
Great @jim-p !
Nothing left to do for me.
@gamewalk43
Only the schematic has mos fets, not NPN transistors...
The mos fets are highly recommended since they have almost no resistance when 'on'.
@jim-p
Is the digital ouput of arduino also a mos fet?
In that case you could decide to do without the external mosfets and switch from digitalWrite(somePin, LOW) to pinMode(somePin, INPUT).
@gamewalk43
Important point with above solution: the voltage at the pin should not exceed 5V.
Any other questions?
For the schematic are you able to show me in Arduino way like connecting breadboard?
Sure, give me some time.
Is it a better practice to leave pin 1 alone for current or future use of Serial communication?
It is CMOS
In that case you could decide to do without the external mosfets and switch from digitalWrite(somePin, LOW) to pinMode(somePin, INPUT).
You could.
Hopefully you know there is about a 0.7V offset above ground with the NPN transistor. The MOSFET will be less then 0.01, this will have an effect on your readings and require to correct that in your code.
Make that about 0.2V. You're mixing up VBE and VCE.
it does have the potential to mess with a voltage divider big time. The on resistance of a MOSFET on the other hand is negligible compared to the resistances of the FSR and its series resistor.
Check the collector emitter sat on a 2N4401 is 0.4 to 0.75, this is the transistor I use. Its Vce its Vce is 95 - 1.2. That is why I said about, the specific NPN was not stated. Here is the data sheet link for the 2N4401, a general purpose NPN: Connecting my sensor with NPN Transistor - #11 by gilshultz
You continue to mix up the two values... even when looking at the datasheet (which can be found here). VCE maximum is 0.4-0.75V at high currents, while VBE is maximum 0.95-1.2V.
The number you give is the maximum guaranteed for this part; scroll down a little in the datasheet and you find charts showing more typical values for VCE which are well below 0.2V when driven into saturation - which is very easy to do for OP considering they're switching only a very small current of <1 mA. There you can also find charts showing VBE of 0.6-0.8V for collector currents of up to about 100 mA and the transistor driven in saturation (so ICE/IBE = 10).
For higher currents those values do go up indeed, the part is rated 600 mA maximum.
So that 2n4401 looks like a rather typical transistor.
I have a question: Is it possible to connect one resistor per NPN, such as 300k ohms, 16k ohms, and 3k ohms, with only one resistor for each NPN? Because when I saw your schematic, I noticed that you used other resistors as well. I just want to know if it is possible to use one resistor per NPN.
No, the 220 ohm and 10K ohm resistors are necessary for proper operation of the 2N7000 MOSFET
Got it Thank you so much!
So, my question is: How can I program the swapping of one NPN for another? This is because when I measure certain ranges of salinity in ppm, it won't be accurate. Therefore, I need to swap the resistor automatically based on the program. Could you help me write the code?
For clearer understanding, 300k ohms are suitable for low ranges of ppm, like 0-1000ppm, and 16k ohms are suitable for 4000-5000 ppm ranges. I just want to swap the resistor for the suitable range of ppm (salinity).
Here are the image for the understanding more clearly:
Because Tinkercad doesn't have Probe(so PPM sensor) I just put force sensor.
What is the part number of the 3 transistors in the image ?