Switching it up – controlling a MOSFET from a BBone

Well, the biggest mistake with Replicape rev. 0 was the lack of a level shifter for the MOSFET driver. This post is about finding a suitable level shifter for the ~9V threshold voltage needed to drive the TPS2829. Why is a MOSFET driver even needed? A lot of the Arduino-based (Atmel-based) RepRap electronics drive the MOSFETs directly, however, they all need a huge cooling fin to direct the thermal energy created in the MOSFET. In order to keep the Replicape from dissipating too much heat, the idea was to add MOSFET drivers. Yes, there is plenty of room for cooling fins, but then there would be no room for an LCD on top : ) Traumflug has a great post about the continued need for cooling on the MOSFETs.

The MOSFET driver was installed for two reasons: First, the 3.3V 8mA source capability of the BBone GPIO pins make them highly unsuitable for for driving MOSFETs directly. And even if they could (they actually can, see below) the switching time is too great for keeping the temperature down. Texas Instruments has a great guide on how to properly control MOSFET gates.

BBpin MOSFET setupBBpin driving MOSFET

The photo on the left above shows the setup with the gate of the MOSFET being driven directly. The photo on the right shows the resulting waveform present on the gate. The power source was set at constant current of 4A which gave an output voltage of 10.5V (=42W). The PWM frequency was set at 78KHz (The same as Traumflug). GigaMegaBlog has the instructions for getting PWM to work BTW.

What is noticeable in the Oscilloscope image is the slow turn-off  and turn-on time. In fact a lot of time is spent in the MOSFETs linear range and not in saturation (Fully on or fully off) which is bad since that is what generates heat (see discussion below).

The problem of heat build-up in the MOSFET can be somewhat mitigated by adding a MOSFET driver  and that was the idea behind using the TPS2829 as a gate driver. The problem was that I did not read the data sheet for TPS2829 properly, so the fact that the MOSFET driver needs ~8V for VCC = 12V was not seen until later. Ok, so how do you shift a 3.3V signal to a 12V one? My first thought was using an Op-amp as a comparator. But then I came across a different guide by TI explaining why to NOT use an Op-amp for this particular task, but instead use a comparator. So that is where I stand today. My thought is using the LM339 as a level shifter. If anyone have any objections, I am all ears : )

circuit beforecircuit after

The above pictures shows the circuit before and after the level conversion. It does not show in the pictures, but the top and bottom wires are +12V and GND. Now, the circuit on the right has a comparator added. The non-inverting input port is connected to a voltage divider (3.3V/2 is a good level). The inverting input port is connected to the PWM pin on the BeagleBone or to an output pin on the PCA9685 PWM driver circuit. There is  also a pull-up resistor on the input to stop the output from going unitentionally high if the BBone pin is left floating (if the pin is muxed as input without a pullup). BTW, does anyone know what the output pull-up is for? Is that not needed when there is an input pull-down? I’ve seen it in all example circuits, but I have not seen an explanation for it.

 

Discussion about MOSFET power dissipation

It is the time in the linear range that causes the heat-up of the MOSFET. Lets say the these parameters are given: 12V power supply with a maximum current of 4A. The drain of the N-type MOSFET (IRBL8743) is connected through a 6.8Ohm resistor mounted on an extruder up to VCC, the Source down to ground.

If the MOSFET is completely off, the voltage across the drain, source (VDS) is very high (12V), but current (ID) is zero , so the power dissipated in the MOSFET is zero (PDS=0W). If the MOSFET is fully on, the VDS is very low (typical RDSon for IRBL8743 is 3.2mOhm) giving a PDS = 4A*0.0032Ohm² = 0.04mW. However if the MOSFET is somewhat conducting, lets say it has a RDS of 6.8Ohm,  the same as your typical extruder heating element resistance: ID = 12V/(6.8+6.8) = 0.88A
PDS = 6V*0.88A = 5.28W.

Thus, linear range -> bad, Saturation -> Good.

One thought on “Switching it up – controlling a MOSFET from a BBone

  1. Pingback: Switching it up – controlling a MOSFET from a BBone | Hipstercircuits | Heron | Scoop.it

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>