I have a an N-Channel Mosfet soldered to an adapter board and connected to PB4 of an ATtiny85 via a solderless breadboard. The mosfet currently switches the ground leg of some other low power components, less than 50mA.

DMG2302UK-7 N-Channel Mosfet
ATtiny85 spec sheet

From the instant the ATtiny code decides to fire an output on PB4, how long does it take for the Mosfet to be to the full on state? Reading the spec sheet it looks like the mosfet should take 3.3nS and the Attiny should take 1.5 clock cycles (150nS at 10mhz). The internet tells me gate capacitance comes into play too, but I doubt its a simple RC calc?

I don't need to be exact I just need to make sure im in the right ball park and dont need some sort of specialized driver circuit or a different mosfet. I am trying to send a signal at a khz speeds, and am seeing like 0.03s delay for this mosfet to trigger. I just want to determine if it is an issue with my code or with the circuit.


  • \$\begingroup\$ The delay time from your code to '1' arriving at the PBx output is nothing to do with the turn on time of the FET. The turn on time for the FET is all about how long it takes to charge the gate capacitance (in this case around 200pf). You need to characterize the delay and turn on separately. \$\endgroup\$ – Jack Creasey May 31 '18 at 19:05
  • \$\begingroup\$ Jack Creasey, I guess I didnt phrase my question quite right. I meant to ask for the speed of the whole system (ATtiny delay + Mosfet delay). I don't know enough to know which one is more significant/controlling. Just guessing, how much capacitance do you think mosfet surface mount adapter and solderless bread board are adding to the gate capacitance? \$\endgroup\$ – ericnutsch May 31 '18 at 22:04
  • 1
    \$\begingroup\$ The cycle time you quote (30ms) is almost certainly the loop time of your code. You could set up a timer in your code, and service an interrupt at whatever rate you want to achieve, that would be the most reliable way to drive the digital I/O port. The interrupt routine could be very small and only a few instructions long, you should easily get many kHz with a 10MHz clock. \$\endgroup\$ – Jack Creasey May 31 '18 at 22:19

Reading the spec sheet it looks like the mosfet should take 3.3nS

MOSFET turn on/off times do not work like that. Simplified, a MOSFET behaves like a large capacitor between gate and source. How quickly (or slowly) that capacitor is charged/discharged relates directly to the on/off switching times.

So for example that 3.3 nS is valid only under the conditions mentioned like output resistance of the source and voltages used. In a simplified form indeed that is an RC calculation.

In your case you should not worry about the delay as it will be significantly smaller than you can detect. This is a small MOSFET for low power applications and an ATtiny MCU can easily drive it. Signals of a few kHz should be no issue.

Also this MOSFET has a very low threshold voltage (about 0.6 V) so even if you use the ATtiny at a low supply voltage (1.8 V or more) it will drive the MOSFET without issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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