Switch Mode Power Supplies (Part 2)

Part 1, 2, 3

Next picture illustrates the principle of operation of my proposal for an arduino controlled Switch-Mode Power Supply (SMPS):

Instead of using an integrated chip, we will use arduino as a controller. The basic configuration requires an output line to drive the switch and two analog inputs for reading the voltage from the current sensor and the output voltage sensor. Both the voltage and current sensor are represented as functions as they require some attention.

The heart of the system is the driver of the switch. As explained before, the amount of energy flowing through the SMPS depends on the on/off ratio of a periodic signal. This all about PWM (Pulse Width Modulator). And timers from the micro-controllers can do the job nicely for us. As we will leave timer0 in peace because it cares about millis() and micros() functions, we will use timer1 which is very handy for the job. Firstly we will set timer1 prescaler to 1 in order to achieve the fastest PWM:

TCCR1B |= _timerPrescaler;

_timerPrescaler is a user defined constant from the application, defined as

const uint8_t _timerPrescaler = 1; 	/* 1 to 7, 0 = timer off, typ. 1 */

Timer1 features a programmable resolution allowing 256, 512 or 1024 steps per cycles. Once again, we will go for the fastest PWM and go for 256 steps.

/* Set fast PWM mode 5, 6 or 7, depends on timer Bits which can take the values 8, 9 or 10 (bits) */
TCCR1A |= ((_timerBits - 7) << WGM10);

As a result of these choices, the final PWM cycle time shall be : 16.000.000 / 1 / 256 = 62.500 Hz.

Adjusting the cyclic ratio (so as to say the on/off ratio) is done by adjusting the upper count trigger level of timer 1 in the OCR1B register. The updates are performed just before timer1 starts counting; the synchronization is performed thanks to the setting of a variable which can be read or write from any function from the application:

	/* Set synchronization variable */
	_syncState = 0x01;

Next lines of code illustrate the way synchronization is performed when a synchronization is required:

/* Set timer upper count */
_syncState = 0x00;
while (!_syncState);
OCR1B = dutyCycle;

This happens in the regulation control functions as well as in the analog to digital conversions. In this way, measurements are always performed in the same way at the same time.

Lets talk a little bit about the switch. The component of choice for achieving this task is a MOSFET transistor. Among their most interesting properties is the resistance between the drain and the gate of the transistor which is very low (< 1 Ohm) when the transistor is On. From the previous post, we know that the lower the voltage across the transistor the least the power dissipation.

In this case, I decided to go for a P-Channel MOSFET. Although they drive less current – compared to N-Channel MOSFET, but still largely enough for us – they are simpler to drive when used on the high side of the power supply. However driving a MOSFET transistor still requires some attention. There are roughly three ways of designing this part of the circuit: the quick and dirty way, the simple and yet efficient way and the lazy way.

The quick and dirty consists in the following circuit.

The gate of the MOSFET is driven to a low state by a general purpose transistor. When the transistor is not conducting, the gate is driven to a high state via a resistor. This configuration is simplistic but it has multiple drawbacks. Such a configuration is slow and the on and off states are achieved after “long” transition times during which power will be dissipated. Also, the source/gate voltage must be kept within limits (typically 10 to 12 V, check the MOSFET specifications) otherwise you will kill the transistor. So, lets get rid of this option which is good enough for driving LEDs or relays at low speeds.

The lazy way consists in using an integrated circuit which will do the driving job for us. You may even use N-Channel MOSFET transistors as some of these circuits generate their own bootstrap  voltage (see below) so that the gate can be bias at higher voltages than Vin.

The alternative is the use of a fit for purpose driver:

The driver consists in a totem pole made of two complementary transistors which common emitters (low impedance side) drive the gate of the MOSFET. This is a simple and efficient solution which keeps switching delays low. The resistors shall be chosen according to Vin and to the MOSFET specifications.

I cannot conclude this post without mentioning the use of N-Channel MOSFET transistors. These designs require a proper biasing of  the MOSFET gate, at the higher voltage that the voltage at their drain. Next circuits are dealing with the use of a bootstrap which elevates the driving voltage at the gate of N-Channel MOSFET.

Here is a custom design which uses few additional discrete components

This is in few words the way it works. When PWM in is high, T2 is fully on, T1 is fully off and the test point B is at almost 0 V so that the lower end of C1 is at 0 V and its upper end at Vin, consequently charged through D1. When PWM in is low, T2 is fully off,  T1 is fully on so that the lower end of C1 is at almost Vin. As a voltage of almost Vin is present at C1 ends, the upper end of C1 (test point A) is now at almost 2x Vin thus biasing properly T1 gate. This is the principle of the charge pump applied to biasing the N-Channel MOSFET gates without additional power supply.  It works fine as long as a residual off and off state exists in order to keep the charging process alive. This may create some problems when the over voltage current or over-current protections are triggered. Also T1 driver is not optimal so that I did not adopt this solution in my later developments.

You may prefer to use a specialized IC that contains a voltage elevator. Next picture illustrates the wiring of one among the most popular chips (IR2110):

If you stick to my original design, you will not use the MOSFET on the low side and keep using the free wheel diode. However, better performances will be achieved using the low side MOSFET. Last trick: if you are lacking a free wheel diode and have a spare N-channel MOSFET, use its protection diode (across drain and source) a free wheel diode, that will do the job perfectly.

Next post on same subject

Leave a Reply

You must be logged in to post a comment.