Gaggia Classic brew control with Raspberry Pi/Arduino?

Equipment doesn't work? Troubleshooting? If you're handy, members can help.
lpinello

Postby lpinello » Jun 12, 2019, 9:13 pm

Hi!

I am playing with my Gaggia Classic and I would like to know which cables should I connect together to activate the pump/solenoid valve.

I looked at this but I am a little bit confused:

Image


My understanding is that adding a relay here should work:

Image


Thanks!

Luca

lpinello

Postby lpinello » Jun 13, 2019, 9:15 am

BTW I tried and this works fine!

User avatar
C-Antonio

Postby C-Antonio » Jun 13, 2019, 9:54 am

The steam switch is a "Deviatore", a 3way (2way if you are outside the USA) switch. Basically it passes power either to steam or to the solenoid: the contact for the solenoid valve in the steam switch is always closed until you hit the steam button which closes the contact for the heaters and opens the one for the solenoid valve. The brew button feeds the solenoid through that so while the steam button is not in use its the brew button that engages and disengages the solenoid valve together with the pump. Its like that in all of them but the classic version without the solenoid valve (obviously). With the steam button wired as is the only exit for the steam is the steam wand as it should, if the solenoid were to be engaged then the passage to the group would be also open.

If you were to unplug the solenoid terminals from the steam button and connect them together (you can use a double blade connector or simply a copper strip) then the solenoid valve would be managed exclusively by the brew button (on and off together with the pump as normal) and will remain engaged even if you use the steam button (that can be done to turn on and off the heating elements while brewing). That, of course, if you dont care about getting hot water from the steam wand since with the terminals always connected you would have water coming out from both the wand and the group, and if you dont care about the group leaking while steaming. The best way would be to actually put a separate switch for the solenoid, so when steaming milk there would be no passage to the group (its easier in the new classic that doesnt have the switch assembly and where the single fat button can be swapped for a double switch of the same size)... for some people 4 buttons is some buttons too many, but if you use an Arduino...

What you have done basically bypasses the brew button... and you should have the pump engaging too unless you already put a separate relay for that one
Image
“Eh sì sì sì…sembra facile (fare un buon caffè)!”

Ferrariandcoffee

Postby Ferrariandcoffee » Jun 14, 2019, 12:01 am

Use zero cross detection to be able to sense the Pump button being switched on/off. Then there's no need to fiddle with solenoid.

If you want to also add Pressure control that is accurate between 1-9 bars and repeatable thru a simple duty cycle value then use this (it's not your typical cheap $5 dimmer module... its a high quality module that has its own tiny microprocessor on-board which makes pwm control great using Rasp Pi!) : https://www.amazon.com/dp/B06Y1DT1WP/re ... um=ios_app

I use it for a nice gradual preinfusion and then gradual pressure increase to full bar. I also use it to run at 6 bar or whatever pressure I need — instead of adjusting OPV.

lpinello

Postby lpinello » Jun 14, 2019, 12:42 pm

Hey Guys,

Thank you so much for the feedback. This forum rocks!

I want to provide more details on what I am trying to do.

Goals:

1) I want to keep the normal function of the buttons of the Gaggia Classic.

2) I want to have gravimetric brew control using the Lunar scale (https://acaia.co/products/acaia_lunar). This is a popular scale with BLE. The idea is to turn on the scale, press a button on the raspberry pi and brew a predefined amount of coffee by engaging the brew function and then stop it and potentially control the pressure.

This is the current plan/progress:

The first challenge was to sort out how to communicate with the Lunar scale. They have an sdk for iOS but no support for other OSs. So I ended up writing a Python module myself: https://github.com/lucapinello/pyacaia

To simulate the press of the brew button in front (this is the relay I had in my previous picture) I am planning to use this shield: https://www.bc-robotics.com/shop/raspbe ... relay-hat/. I tested and it works really well.

To modulate the pump I was planning to use this smart light dimmer with Bluetooth, I already got one: https://www.amazon.com/gp/product/B01I24JBNW/ (they have a python library)

Your dimmer module looks amazing and it is cheaper! Do you have a repo for the code that controls this? If I am not satisfied with my dimmer I will get this one!

At the press of the button on the raspberry pi this will happen:

1) Lower the dimmer to get about 1-2 bars
2) Engage the relay to simulate the brew button
3) Ramp slowly the dimmer to reach 9 bars
4) As soon as the scale reads 24 grams disengage the relay to stop the brewing
This is the schematic of what I am trying to do:

Image

Thanks again for the nice feedback and suggestions!

happycat

Postby happycat » Jun 14, 2019, 6:40 pm

The reason to control the solenoid: keep it open when you stop the pump... allows preinfusion without triggering 3 way valve sucking the water out and cracking the puck.

You can work with the flow and Bluetooth scale but the latency might make your life miserable.

A simple solution is just set timers you can adjust. Run the system with a scale to determine the time that provides the brew ratio you like.

If not... someone else did the raspi mod you're talking about ages ago but not with Bluetooth scale.
LMWDP #603

User avatar
C-Antonio

Postby C-Antonio » Jun 16, 2019, 6:39 am

If you dont need preinfusion with the pump off (i.e. if you manage the pump with the dimmer and look for a slow ramp up only) then your solenoid can be left alone and it would work as stock, you wouldnt have any reason to engage'disengage it separately.

In practice, if you were to do it manually, you put a switch or permanently bridge the solenoid contacts at the steam switch, to decouple it from the steam, if you want to work the heating elements during brewing. You would put a momentary switch on the pump directly at its contacts to do preinfusion. In your case its the same but using relays.
With the dimmer I seem to remember the pump wont work if the voltage gets too low but you will have to make sure it doesnt ruin the pump staying idle that way (I think it still heats it up).

If, after the on/off switch, you bypass the switch assembly wiring relays in parallel with the switches contacts then you maintain the normal use of the switches when you want to operate those or you will have the arduino/pi do the same duty through the relays when you want to operate the machine through that. Using blade connectors at the switches is a quickly reversible mod.
“Eh sì sì sì…sembra facile (fare un buon caffè)!”