Swapping out the BJT transistor for a MOSFET, initial fail but got it working after some tweaking. A tale of partial success.

A project log for TV-B-On(the box)

The thing you need when your TV remote power button fails.

mcunerdmcu_nerd 06/15/2023 at 13:360 Comments

I got some inexpensive logic-level MOSFETs in, model AO3400-SOT23-3L. I assembled a board (shown below) with the MOSFET, programmed the ATtiny85, pointed it at a TV. Nothing. I added a capacitor to deal with the high-current pulses. Nope.  I then held it right next to the IR receiver on the TV. It worked. 

So what was going on? Well, it deals with how MOSFETs work.  A MOSFET acts as a capacitor.  Once a voltage is applied to the gate of a MOSFET, it charges up as a capacitor. It also takes time to discharge when the voltage is brought down to ground.  How much current that is source/sunk determines the charge/discharge speed and thus how quickly a MOSFET fully turns on/off. 

Switching at 38KHz on the surface doesn't sound problematic with a small MOSFET until you consider that I was using a 1 percent duty cycle, resulting in a pulse width of around .263 microseconds.  It apparently wasn't enough time for the MOFET to fully switch on with the current I was providing to the gate.  Upping the duty cycle to 10 percent, made a dramatic improvement.  The downside of upping the duty cycle is that many IR LEDs have a max safe duty cycle of 1% for high current pulses.  I would love to measure and see this, but I would need an oscilloscope, which I don't have.

 I'm limited when it comes to increasing current as the recommended source/sink max current for the ATiny85 is 20 mA. I could try upping it to the absolute maximum listed in the datasheet of 40mA but that does risk stability.   A better solution would be to implement a gate driver either using a dedicated chip or using discrete components, but I would have to be careful about increasing standby current consumption to keep the excellent battery life.

Running it with a 10 percent duty cycle based on initial testing does appear to beat out boards using a BJT at the same duty cycle.

In conclusion, everything is a tradeoff.  I got rid of the voltage drop of the BJT but in turn had to deal with the problems with a slower switching speed due to lacking a proper gate driver.