user16888: Ok so forgive me for being an amateur but I'm having a situation that's driving me nuts. 
I have a sensor that I have to cycle between +5VDC and +1.4VDC every 60 seconds. I'm using an ATTiny85 with the 8Mhz internal clock fuse set. 
What I was hoping was to use a 2N7000 N-Channel MOSFET to control the cycling of the voltage. So my thought is to have +5VDC on the Drain and a PWM signal on the Gate with the + side of the sensor connected to the Source. I am thinking that using PWM and adjusting the duty cycle on the Gate will allow me to adjust the voltage that is seen at the Source but what I'm seeing is a variation of +1.4VDC @28% duty cycle and +3.6VDC at 100% duty cycle. 
I can't figure out why +3.6VDC is the best I can do. The PWM is coming from PB1 on the ATTiny85 and the +5VDC is coming from the main voltage source that also feeds the ATTiny85. The current draw of the sensor is 140mA max.

Ok so I haven't had any luck using a BJT or a single component to perform this voltage change so I started on a different approach using two 1N7000, with one being in an inverter configuration.  My though is the pin from the MCU will go high, which will turn on both FET's, with one supplying 5V and the other sinking to ground.  When the MCU pin goes low, both FET's turn off, which stops the 5V flow and the sink to ground, which then will allow the path through a voltage divider into my sensor at 1.4V.  The issue I am having is the second FET is smoking, and by that I mean the sucker heats up like crazy and one even let the smoke out!  I cannot for the life of me figure out WTF I am missing in this configuration.  Here is the new schematic and Q1 is the FET that is smokin.


user368: Using a N-type transistor as a high-side switch is inefficient unless you have some way of driving the gate above the positive rail. The most you can reasonably expect at the source is the gate voltage minus the gate threshold voltage, VGS(th). The typical threshold voltage of the 2N7000 as given in the datasheet is 2.1V, which means that it is a bit remarkable that you are able to get a voltage as high as you have (5V - 2.1V = 2.9V).
The way to fix this is to switch to a P-type transistor (and flip it around) since its threshold voltage is negative.

16888: <p>Ok so forgive me for being an amateur but I'm having a situation that's driving me nuts. </p>

<p>I have a sensor that I have to cycle between +5VDC and +1.4VDC every 60 seconds. I'm using an ATTiny85 with the 8Mhz internal clock fuse set. </p>

<p>What I was hoping was to use a 2N7000 N-Channel MOSFET to control the cycling of the voltage. So my thought is to have +5VDC on the Drain and a PWM signal on the Gate with the + side of the sensor connected to the Source. I am thinking that using PWM and adjusting the duty cycle on the Gate will allow me to adjust the voltage that is seen at the Source but what I'm seeing is a variation of +1.4VDC @28% duty cycle and +3.6VDC at 100% duty cycle. </p>

<p>I can't figure out why +3.6VDC is the best I can do. The PWM is coming from PB1 on the ATTiny85 and the +5VDC is coming from the main voltage source that also feeds the ATTiny85. The current draw of the sensor is 140mA max.</p>

<p><a href="https://i.stack.imgur.com/Iv3Px.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Iv3Px.png" alt="Schematic"></a></p>

<p>Ok so I haven't had any luck using a BJT or a single component to perform this voltage change so I started on a different approach using two 1N7000, with one being in an inverter configuration.  My though is the pin from the MCU will go high, which will turn on both FET's, with one supplying 5V and the other sinking to ground.  When the MCU pin goes low, both FET's turn off, which stops the 5V flow and the sink to ground, which then will allow the path through a voltage divider into my sensor at 1.4V.  The issue I am having is the second FET is smoking, and by that I mean the sucker heats up like crazy and one even let the smoke out!  I cannot for the life of me figure out WTF I am missing in this configuration.  Here is the new schematic and Q1 is the FET that is smokin.</p>

<p><a href="https://i.stack.imgur.com/bzTeI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bzTeI.png" alt="Version 2"></a></p>
 368: <p>Using a N-type transistor as a high-side switch is inefficient unless you have some way of driving the gate above the positive rail. The most you can reasonably expect at the source is the gate voltage minus the gate threshold voltage, V<sub>GS(th)</sub>. The typical threshold voltage of the 2N7000 as given in the datasheet is 2.1V, which means that it is a bit remarkable that you are able to get a voltage as high as you have (5V - 2.1V = 2.9V).</p>

<p>The way to fix this is to switch to a P-type transistor (and flip it around) since its threshold voltage is negative.</p>
