Sunday, November 26, 2006

Rancilio Silvia "PID PIC NES" mod


I have long admired the pioneering work of Rancilio Silvia owners in modding their espresso machines. Here, I present my Silvia given a PIC 16F876 microcontroller brain, a 20 character VFD display, nintendo controller, three zero-crossing solid state relays, IC thermometer, laser cut acrylic top, cold cathode ground effects and shot light. This project has stretched out for quite some time, and will likely continue on as I pick away at it some more. But for now, the bulk of the first wave of coolness is complete. First, a silly demo video, followed by a list of features and discussion.


PID
A microchip PIC16F876 gets temperature readings from a boiler-top mounted National LM34 Temperature Sensor. These temperature readings are processed using the PID control loop which I learned about in detail from the excellent article PID with out a PhD. A thrift store modder's favorite NES controller can set the PID gains, espresso and steam setpoints, temperature calibration values, and heater control PWM period. I wrote the NES code by reading a fantastic spec available from the iGamePlay project. The NES gamepad's popularity is well deserved as is a tough little controller with enough buttons to be useful, yet still very simple. For example, the select button switches between the main mode and setup mode, and the arrow buttons allow you to choose and alter variable values. It works out pretty cleanly. The main display currently shows a) the current temperature, b) the heater power setting (0 - 100 percent, which translates to a PWM heat amount), c) a timer showing how long the machine has been heating up, and d) a timer that alternates between a shot timer, and a timer showing how long the machine has been temperature stable and ready (remaining within 0.5 degrees of the set point).

One of the most interesting challenges so far has actually been tuning the PID loop. Currently though, after it settles, the machine appears to be indefinitely stable (I've seen it stable for over 2 hours before shutting off the machine) to about 0.1 degrees of the set point temperature. Interestingly, stability improved substantially after I finally closed the machine back up (after easily a year of being in terminal state of "operational dissassembly") and insulated the boiler from room drafts etc.


Shot Timer
One of the big motivations to go the distance and give the PIC total machine control was to enable a shot timer. When the top switch is thrown, it starts counting the seconds. It was basically a lot of work to make the machine act like it always does, but just so the PIC knows about it. The front panel switches are all "virtual" just pulling pins on the microcontroller which in turn throws the relays. One cool side effect of this is that starting a shot no longer makes a click sound on my stereo speakers. I think this is because the zero-crossing relays remove the spark-gap that occurs with a normal 120 switch (that's just a guess, but something changed because the grinder switch still sends out an electric 'pop' . . . for now).

A closeup of the VFD display showing a slightly outdated version of the interface.

Remote Control
Once I had the PIC sitting between the switches and the relays, and I had a NES controller setup to change PID values, my inner (or is that outer?) nerd forced me to add a useless "remote control" feature that replicates the front panel switches with the A, B, and start buttons on the gamepad. Eventually, I would like to put a solenoid on the steam wand valve so that I can call for water and steam completely with buttons and switches, and get rid of the squeeky knob (btw, does anyone know how to lubricate the steam valve with something more edible than WD-40?).

Bling
A combination 5v/12v power supply left the door open for some code cathode lights to sit on the 12v rail. While there is some utility in adding light under the brew head, this is mostly just silliness-- especially my "ground effects." A laser cut clear acrylic top allows for the VFD display to be viewable without undermining the sleek boxy shape of the Silvia.

While there are still quite a few wires swimming around under the top, the overall number has been reduced, and it makes for a fairly clean appearance from above. I removed both top-mounted thermostats, and the switches have only 2 wires each instead of 4 going to each switch. Sadly, the little switch lights don't work. Though perhaps its possible to get them back?

Plumbing
I also drilled and plumbed a drain from the bottom of the drip tray. The plumbing technique was the great idea of a clever hardware store employee who showed me to the lamp parts section. The key ingredients are a threaded tube and low profile gnurled nut. A tube feeds a growler under the table and greatly reduces the number of spills from an overflowing drip tray. I am the kind of person who forgets to fill the water tank and empty the drip tray., so I really like this mod. I used to have the intake plumbed out to a remote water tank as well. It was great to be able to see the water level (a feature I hope to add for the internal tank), but ultimately it doesn't look as clean and the internal reservoir gives a little preheat to the water as well (Has anyone tried preheating their water out there, perhaps with a fish tank heater?). Heres two pics of the drain plumbing.

A view down into the tray. I've since trimmed the top off the tube coming into the tray.

Underneath the drip tray, taking advantage of a factory access hole in the bottom of the machine.


Some Guts

I had originally planned to make space for the power supply and electronics by remoting the water tank, but everything ended up fitting. The electonics was luckily simple enough that I could just solder it all on a perf-board instead of needing a real circuit board (which would still be cool, especially if one were to make more of these...)

Screw terminals on both ends of the perf-board work great as the interface to the rest of the machine. Plus, it's fun to wire stuff up solder-free with just a crimper and some terminals.

Well, if you made it this far, thanks for reading. I'll keep my eye on the comments section here if there are any questions.

43 comments:

Anonymous said...

Hi Tim - you've made a really, really nice job there. Well Done! I'd love to see more construction details since this looks like a great mod to do.

Alexander said...

btw, does anyone know how to lubricate the steam valve with something more edible than WD-40?

You can use any food-grade oil, such as canola, safflower, peanut (unless you have an allergy) or whatever floats your boat. Simply put it onto the end of a q-tip and swab it where it needs to go.

Anonymous said...

You can use food-grade oil, as alexander said. A longer-lasting, but more expensive solution would be the food-grade grease Chris Coffee and other online merchant sell.

Robin said...

Wow! I'll take a double, please.
Have the Rancilio Silvia people seen this yet?
Do you get a special drink if you do the special secret NES code? (Was it down-down-up-down-left-right-left-right?)
Amazing.

Adrian said...

Fantastic job mate!

erik said...

A good food-grade lubricant is super lube. I have run the mistake of using wd-40 (actually someone else did it before I could stop them) and it is a horrid mess on food appliances. It not only tastes awful but penetrates many metal surfaces so it is really hard to get out. Don't do it.

BTW, the mod is fantastic. All you need now is a tcp/ip stack, an ethernet port and a webserver.

dan b said...

very cool, i just started planning a pic pid myself the past couple weeks, so i'm psyched to find this. couple thoughts: how accurate do you think the lm34 is? everyone now seems to be sold on tapping the boiler and using type t tc's for speed and accuracy.

also, seems like you could add preinfusion pretty easily by opening the solenoid and delaying the pump. yesno?

Tim Hirzel said...

Thanks everyone for reading about my mod. Thanks for the lubrication tips as well! erik, you are right on about running a little web server in there with saved performance data and a web interface for tuning. one of the rabbit semiconductor board would be great for that.

dan b. I am far from an expert on temperature sensing. In fact, I picked this device because it gives you temp readings in the easily digestible 0.1 volts / degree. I had a moment about whether I should be using a thermocouple , but my friend casey (who is much better than I am this kind of stuff) said it was pretty much gonna be the same thing. While drilling the boiler makes a little sense for speed (though, once the thermostats are gone, are people using those tapped holes instead?) the whole system in inherently slow. Seems like splitting hairs for temp sensing. When you pull a shot, its gonna take a few minutes to get settled back with the stock heating element. Whats the hurry? ;) Also, I am taking thousands of measurements and averaging them, which I think de-noises the sensor quite a bit.

preinfusion? I gotta google that, but it sounds cool. If it takes what you describe, then yeah,
it would be no problem.

oh yeah, in terms of drawings and stuff. I'll have to see if I have anything useful. I really stumbled my way through this (it really did take years to complete), and broke a bunch of stuff on the way. One thing that was really helpful, the drawings and schematics here: http://www.espressotec.com/ummanual.asp#rancilioparts

i studied that schematic with a beer for countless evenings to figure it out, but it was vital.

Anonymous said...

Now we just need a Yoshi Suger Cube maker...

www.dozingo.com

Nick said...
This comment has been removed by the author.
Nick said...

Bad ass dude. Mad props.

yiqin said...

this is a really great mod.

Old Timey Dave said...

This kick ass for sure... I'd love to post a link to it on our blog. Let me know.

Tim Hirzel said...

feel free to post anything: pics or a link to my boring video! :)
thanks all,
tim

Fritz said...

Very, very nice - have you fixed the drip tray into the chassis?

I want to do the drain mod and I've been tossing around fixing the tray in there to simplify the draining etc.

Have you got any pictures with the tube trimmed down?

Mitch Gurowitz said...

Wow, I can only begin to imagine what you could do with a wireless Wii controller!

And to think that I thought a PID was ambitious!

Jared C. said...

Very nice work!!! I'm extremely impressed. You have done something here like no one else has done before you. I guarantee there will be some interest (and jealousy) in you project.

I posted a link to here from www.coffeegeek.com, because this project very much deserves some visibility and credit from those folks there.

Keep up the good work! I expect to see Rocky integrated into your system soon! ;-)

Anonymous said...
This comment has been removed by a blog administrator.
Olman Feelyus said...

You are mad, truly mad. You must have been thrown out of the academy in Prague.

Anonymous said...

props to that

www.the-ultimate-solution.net

Get Rich Quick Home Business Scams

DW said...

Tim, I have some questions about how to use my PID.

Can you drop me an email?

Dougwamble at g mail

Much appreciated if you have a moment...

Anonymous said...

wath a beautiful idea!
but which kind of coffe you use? here in Italy I can find some of best and optimal quality, but them in America? it is possible to find them?

btw, nice work! ^_^

=nil=

Sysadmn said...

FWIW, WD-40 is not a lubricant. It's designed for Water Displacement, and it's more like a lacquer. As it ages, it gets really gummy.
http://www.google.com/search?q=wd-40+gummy+lubricant&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_en___US215

Anonymous said...

Hi Tim,

I like your site very much. You may be interested in my PIC18F4523-controlled Rancilio Silvia that shares some of the features you implemented: http://silviatune.googlepages.com/index.html

-pn

resort in the philippines said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
said...
This comment has been removed by a blog administrator.
Will Custom Machining said...

Very creative custom machininig work, its art and funcitonal =), have a good one and keep up the creative work, i'll be back to view more pics of any future projects.

Will

Anonymous said...

Hey, I just stumbled upon this while looking for NES projects, but thought you might like to know this would be perfect for the Hungry Scientist contest being held on Instructables.com right now. This is the link if you're interested: http://www.instructables.com/contest/hungryscientist/

Walid said...

Great job! Where do you sense the temperature using the LM34?

Tim Hirzel said...

Hey Walid,
I mounted it on the top of the boiler where the thermostat used to be. I used on of the screws for the thermostat (which I removed). I took one of those wire crimp ends, the kind of the ring, and screwed down the ring, and used the rest of it (the part normally crimped around a wire) to hold down the sensor. I also used a little thermal grease to help temperature conduction.
tbanks for checking in,
Tim

uiyui said...

You said you will love me wow gold the whole life, but you marry her. You said Cheap WoW Gold you will wow power leveling,come to marry me, but this will not be carried out forever.WoW Gold I am trying my best to forget you and do not love you anymore. wow leveling But I failed and I still love you. Maybe wow leveling she needs you more compared wow leveling with me. So I tell you that world of warcraft power leveling you should love world of warcraft power leveling her and take good world of warcraft leveling care of her. You said I was so kind.world of warcraft leveling Yes, because I love you,world of warcraft leveling I hope you will be power leveling happy forever.

Walid said...

Hi Tim - can you please let me know what kind of relay you used on the heater element and whether you experienced any problems with noise on the AC line? Thank1

Timothy said...

Hey Walid,
I haven't had problem with noise on the AC line, but I'm not sure what ways you are thinking it might enter the system? The only way I've noticed problems is if the DC power is fluctuating as a result, which changes the voltage reference for the analog inputs which messes up temp sensing. But normally, using the voltage regulator onboard the arduino, that should not be a problem.

I have a bunch of discussion about relay selection and pointers to digi-key here at this instructable I wrote: http://www.instructables.com/id/Temperature_Control_For_Kitchen_Appliances/

Hope that helps.
Tim

xxmy said...
This comment has been removed by a blog administrator.
To said...
This comment has been removed by a blog administrator.