Ulka EP5 Pump PWM Pressure Modulation

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):

EP5 Pump PWM with IGBT

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.

Pump PWM Prototype

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.

15 thoughts on “Ulka EP5 Pump PWM Pressure Modulation”

    1. Yes, although the circuit on the web-site is tested and working in my machine, I’m thinking of some small improvements. Specifically, I put a ‘scope on the output of Q1 (BC556) and noticed that although it switches the IGBT on very quickly, the gate voltage is a little slow to decay. That said, it works fine as is (can regulate pressure betweeen 1 to 9 bar reliably). Nevertheless, to improve this further, I’m planning to replace Q1 with a TC426CPA for faster switching. Also thinking to replace the 4N25 opto-couplers with the 4 pin type HCPL-817 which take up less board area and remove the external 470K resistor. Having tested that in prototype, I’m considering getting a custom PCB made to clean it up.

      I’ve actually bought the components to do this, but haven’t had time yet. Perhaps at the weekend!

      1. Thanks! Thats good to know. Im just putting together my BOM now, but ill let you know when I build and test. If you want to split the cost of the custom pcb I could be interested.

        This is a long shot, but did you have a chance to test the AC pump side of the IGBT? My scope wont be able to do this, but Im wondering what the waveform looks like, and if we are doing any damage because of the pumps large inductive load. Seems like the 1khz and the inductive load would sort themselves out though.

        1. I didn’t put a ‘scope on the AC side yet, as I was uneasy about damaging the ‘scope (or myself!) That said, I’m also curious, and might try… will certainly update the blog with images if I do 😉

          I’ll also post any progress on the PCB layout.

  1. Hi James,
    Excuse my ignorance, but why can’t you control the ulka pump with a simple SSR relay?

    Best regards
    Jacques

  2. Hi Jacques
    Well, it’s a good question (one more deserving of a long blog post than a brief answer here!) The short answer is that you could control it with an SSR, but there are some issues. Most SSRs are zero-crossing, so they will only switch complete mains cycles. There are so called “random turn on” or “random fire” SSRs, which turn on immediately and can therefore be switched on for part of a cycle. Basically, control with a random turn on SSR would be similar to using a dimmer switch to control the pump. You would be able to modulate the pump to an extent, but not with the same type of proportional control you can get by using PWM at a higher frequency.
    Now, it’s debatable whether that matters in practice. I think you probably could get sufficiently good control with an SSR and simply control the SSR based on the output of a pressure sensor exceeding some threshold pressure level, and it’s certainly much simpler to implement. However, I decided to try the IGBT route as I felt it would be the “optimal” solution to allow full proportional modulation of the pump. It may be overkill of course!
    I might expand on this further with a better explanation in a blog post at some point.
    Best regards
    James

  3. I see, many thanks for your explanation!
    For the time being I will see what i can do with a simple SSR as i don’t have as much ease with electronics as you do 🙂
    Ill let you know

    Best regards
    Jacques

    1. Hi Jacques,

      I thought this may be helpful to you. This page has instructions to PWM your pump using a standard zero crossing SSR: http://www.pidgene.eu/surfing.html

      I’ve tried it and while it does appear to work, I didn’t really feel like it was an ideal solution, since the pump will still be delivering full pressure, just in shorter bursts. However, it may be worth a try for you since it is much easier to implement.

      Good luck with your project!

    1. Hi Khalid
      Unfortunately, I don’t think the instructables link above would be suitable for driving an inductive load like the Ulka pump. If you are looking for a simpler alternative to my approach, you could try with an SSR – this obviously wouldn’t allow fine grained PWM control, but may be good enough, and obviously much simpler to implement.
      I’ll drop you an e-mail in case you want to discuss further.
      Kind regards
      James

  4. Hi James – maybe a stupid question, but what was the intended purpose for having this level of control over the pump?
    Do you use it for pre-infusion or simply to maintain the pressure better?
    Have you logged the pressure in the line during a shot from your pressure sensor? Was that not consistent enough?

    1. As well as pre-infusion, I was interested in experimenting with pressure profiling during a shot. That said, I haven’t done much work in that direction lately. I’ve done the “hard part” with the hardware and got that working, but the relatively easy part with the software is yet to be written!

Leave a Reply

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