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.

Version 2

  • Please post a schematic. Commented Jan 30, 2016 at 21:54

1 Answer 1


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.

  • Not sure about how the P-Type BJT would fit in there but definitely open to it. I'm mobile at the moment so don't have access to the schematic but as soon as I can I will upload it.
    – JW52761
    Commented Jan 30, 2016 at 22:21
  • I added a rough schematic. The heating element is a 33 ohm resistive element in the sensor that needs to cycle between 5V and 1.4V.
    – JW52761
    Commented Jan 30, 2016 at 22:48
  • @JW52761: Add it to the question, not an answer. Commented Jan 30, 2016 at 23:32
  • Sorry about that, the mobile client is not very intuitive. Anyway, it's attached and I'm wondering if I should use an opamp in non-inverting mode with a gain of x3 to enable driving the gate above the +5VDC rail voltage to allow the source to have a full +5VDC on it. Forgive me if that sounds silly, I am still learning as I go.
    – JW52761
    Commented Jan 31, 2016 at 23:41
  • @JW52761: You can't drive an op amp above its positive supply. Change the resistor. Commented Jan 31, 2016 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.