Here is what the respective part of my circuit looks like (my power source is a 5.5V super-CAP and I am using a MCP1700 to get the 3.3V for my ProMini.. I then setup a voltage divider such that the voltage I am reading on the Arduino's analog pin should not exceed 1V):
I am currently using the INTERNAL reference (1.1V) for the analog pin but it does not seem to make any difference with regard to the effect that I am seeing (I had used the DEFAULT before.. and with INTERNAL I am just dividing by 4 to still get 8-bit results):
Obviously the voltage of my super-CAP decreases linearly over time and I would hope to get respective decreasing numbers in my measurements. But what I am seeing are very coarse grained steps.
Supposing I get a reading of 176 when the original CAP voltage is 3.84V, I would then expect to see around 182 for a voltage of 3.98V.. but instead the reading is still 176 . If the voltage is further increased the reading stays at 176 until at some point (around 4.12V) it directly jumps to 192.
This means that within a voltage range (of the super-CAP) between 3.6V and 5V I am only getting 4 different readings, e.g. 144, 160, 176, 192
I would have thought that the analog input pin should be able to do much better than that...
Any ideas what I am overlooking - what might be the problem?
slipstick:
Since the gate threshold for that 2N7000 could be up to 3V you're possibly not switching it on fully. A genuine logic level MOSFET might help.
Steve
Within the (CAP voltage) range that I mentioned the MCP1700 has always supplied exactly (according to my multi-meter) 3.33V and I would like to think that the digital output pin that I am using to drive the MOSFET's gate would consequently be seeing that same voltage.
Thank you, and first I'd like to mention that I am a software guy and a complete noob with regard to electronics...
TomGeorge:
Hi,
Gate Threshold means the voltage that the gate will START to cause the Drain - Source to conduct.
Full conduction, ie lowest resistance, will occur at a higher gate voltage than 3V.
Tom....
From the above I would conclude that I could change my voltage divider such as to create a range from 0V-0.3V and with my 3.33V Gate voltage that should always give me at least a 3V difference.. i.e. full conduction?
TomGeorge:
Hi,
The next line down tells you that Vgs has to be at least 4.5V.
quite frankly I have no clue how to interpret that data sheet..
but what you are saying is, the GATE voltage has to be selected as a function of the SOURCE voltage as the GATE-SOURCE voltage must always be in the range between 4.5Vdc and 10Vdc? (i.e. if I wanted to swtich 60V I'd have to use at least 50V GATE - but no more than 55.5V GATE.. sounds like a bloody nightmare )
So in order to use this MOSFET to properly switch my 0V-0.3V DRAIN-SOURCE I'd have to find a way to boost my 3.3V GATE signal to 4.8V..
Would you by any chance know some MOSFET model that might be better suited for the task at hand?
You only have 3.3volt (gate when Arduino pin is HIGH) - 0.965volt (when fet is conducting and cap is 5.5volt) = ~2.3volt gate/source voltage to switch the fet.
You need to find a fet with a Vgs(th) (= point of NOT conducting) of half of that value (or less).
Might not be easy to find a fet with a Vgs(th) of <1.5volt in through-hole package.
Maybe easier to just measure 3.3volt VCC of the Arduino internally, and detect when it drops below 3.3volt.
Leo..
edgemoron:
Hmmm, the writer of that article seems confused about source and drain.
Good catch.
This part is indeed wrong.
"The solution is to use a different divider ratio: say 50 + 10 kΩ. Then, a 6V PWR level leads to a 1V level on the AIO pin, i.e. on the drain source of the MOSFET. With DIO set to “1”, that means the MOSFETs gate will be 2.3V above the drain source – enough to keep it turned on."
Hi,
I have re-arranged the schematic so current flow can be easily seen. @wothky a good schematic mate, nice and open to see everything, just needs some layout changes to make it easier to read.
Not a problem here if the mosfet is in an undefined state during bootup, so R3 is not strictly needed.
It only uses more power (during measuring).
Pull down resistor is only important if the mosfet must be off during bootup (motors, relays, etc.)
Leo..
TomGeorge:
Hi,
I have re-arranged the schematic so current flow can be easily seen. @wothky a good schematic mate, nice and open to see everything, just needs some layout changes to make it easier to read.
..
Tom...
that layout certainly looks nicer the question for me still is: what should I use for Q1 to replace the 2N7000, e.g. would something like a STN4NF03L work?
wothke:
that layout certainly looks nicer the question for me still is: what should I use for Q1 to replace the 2N7000, e.g. would something like a STN4NF03L work?
Spec sheet shows that full conduction is only at 4.5-5V Vgs.
The PMV16XN and BSS138 do fully conduct at 3.3V (I'm using these in my projects - but beware, the SOT-23 package is barely the size of a grain of rice - on a protoboard this component goes IN BETWEEN the holes, so not easy soldering).
For your application the BSS138 makes more sense as it's a bit cheaper. It can handle only 220 mA, enough for signal switching, while the PMV16XN can handle up to 8.6A making that a great power switch.
wvmarle:
For your application the BSS138 makes more sense as it's a bit cheaper. It can handle only 220 mA, enough for signal switching, while the PMV16XN can handle up to 8.6A making that a great power switch.
thanks for the tip I guess I'll just order a batch of BSS138 and try them out...
Do note that these resistor values put the reaction time of the value at the analog port in the order of 10s of seconds (to go from complete discharge to full voltage when starting up - RC constant for charging is 4.7 seconds). So you shouldn't measure your voltage right away, as the cap needs time to fully charge.
After that your voltage will presumably drop slow enough for the capacitor to follow without noticeable delay.