Recently I’ve been experimenting with using PWM to control the pump pressure in my Gaggia Classic. People have used various methods to control the pump pressure, ranging from triac/thyristor dimmers to using series resistance. A few have used PWM (notably Jonr on CG forums), and this looked by far the best solution, so I decided to use high frequency PWM with an IGBT. This would need to be opto-isolated so it could be driven safely from the Raspberry Pi.
I started off looking at the HCPL-3120 optocoupler with gate drive outputs. There are hundreds of suitable IGBTs. However, as I started sketching out the design, including 15V supply etc. it seemed a lot of components were needed for this solution. Instead, I decided to look at using an IGBT with logic level gate drive to simplify the design, preferably one with a TO-220 package. It turns out that there are very few which meet those requirements, so I’ll list them here in case it helps someone else:
- IRGB14C40LPBF (430V / 20A) from IRF
- ISL9V3040P3 (21A) and ISL9V5036P3_F085 (46A) from Fairchild
- STGP18N40LZ (30A) from ST
From that list, the only one I could find at reasonable cost without importing was the IRGB14C40LPBF, so I settled with that one.
To safely interface with the Raspberry Pi, I use a 4N25 opto-isolator with a 270R series resistor, which is driven directly from a 3V3 GPIO pin (tested at a little under 8mA). Note that the series resistor would need to be increased for 5V input.
The NPN output of the opto-isolator is inverted by a BC556 PNP transistor to switch the IGBT input through a 1K series resistor.
The power supply is the VTX-214-003-105. This is a compact module which provides 5V at 600mA from 90V-240V AC mains input. Caution: in this circuit, note that the DC output GND is connected directly to mains NEUTRAL, meaning that the 5V and GND lines in this circuit are not isolated from the mains. This means that they should be insulated and boxed up.
On the output side, the IGBT is wired in series with the pump. There’s a series diode to prevent AC passing, and a flyback diode in parallel with the pump for protection.
Here’s the current circuit diagram for this design (to be used strictly at your own risk):

To test it, I built a small prototype on strip-board. Note that the IGBT is separate, as I plan to mount the board inside an enclosure, and mount the IGBT externally. Ultimately I would like to make a custom PCB for this. After extended testing, the IGBT is absolutely stone cold so the heat-sink appears redundant.

Since I’m using the Raspberry Pi’s one and only hardware PWM pin to drive the boiler, I used the excellent ServoBlaster which provides high resolution software PWM on any GPIO pin. Initially I set this up for 1kHz PWM, and varied the duty from 0% to 100%. For example, to set up 1kHz PWM on GPIO pin P1-22 and using the PCM hardware, you would use:
sudo ./servod --pcm --cycle-time=1000 --min=0% --max=100% --p1pins="22"
To set up 50% duty cycle on that pin, you would use:
echo P1-22=50% > /dev/servoblaster
Before testing this with the pump, I tested with a 60W incandescent light bulb and series diode. Adjusting the duty cycle allowed the lamp to be smoothly and precisely dimmed. The average voltage drop across the IGBT was around 0.33V and (after fully disconnecting mains power) it was cold to the touch.
I then moved onto testing this with the EP5 pump. For easier testing, the machine was temporarily rewired so that the brew switch supplied power to the entire circuit above, so that I could kill power if needed, without relying on the IGBT alone.
Using a Portafilter pressure gauge, the pump was tested at various duty cycles from 0% to 100%. I found that the pump only seems to start operating at about 30%, and then pressure rises to about 1 bar. Increasing the duty cycle allows the pressure to be controlled quite easily between 1 to 9 bar (or wherever your OPV is set).
So far I’m really pleased with performance. The next step is to box it up and wire it in more permanently. I’m also thinking of adding a small SSR to switch the solenoid. Once I’ve done some further testing, I’ll upload graphs of duty cycle versus pressure.
Update: check out the slightly amended design here which replaces the BC556 with the TC426 driver.