Using a router as a Linux-based PID controller

espresso_machine_pid

[Nathan] had an small router kicking around and thought that he might as well put it to good use. He had always been interested in getting a better handle on his espresso machine, and figured that the router would be a perfect Linux-based PID controller.

He installed OpenWRT on the router, then disassembled it in order to get access to the router’s GPIO pins. He built a small PCB that allows him to get temperature info from the machine to the router using i2c. [Nathan] put together a PID package for OpenWRT, allowing him to control the machine over SSH, though he may build in a user-friendly web interface sometime in the future.

He says that most espresso machine PID controllers he has seen come in the form of big ugly boxes slapped on the side of the machine’s case, though we have to disagree with him on that point. Opinions aside, he is going for a minimalist design, and while he says that he is only about half way through the project, we think things are looking promising so far.

When everything is said and done, we hope to get a much closer look at all of his code, schematics, and more information on the router he used as well.

Comments

  1. fartface says:

    Wow really light on details. What model and brand router? details on the schematic? how about a bit of code?

  2. brad says:

    @fartface

    Don’t worry. HaD says it looks promising, so it must be good.

  3. Nathan says:

    @fartface I say what it is on my blog. It’s a Meraki Mini With OpenWRT Backfire loaded on it. It’s an Atheros based router

  4. Jimbo says:

    When your only tool is a hammer mill every problem looks like a car body. This obsession of using Linux to do basic stuff is maddening. Why my Panasonic Plasma TV runs a Linux kernel is beyond me.

  5. Nathan says:

    I don’t want to respond to everyone, but I probably will. Basic stuff now reads as doing PID calculations and maintaining an even temperature? I could buy a generic PID box, but it wouldn’t :

    – Be able to have a time to turn it on/off at a certain time
    – Can be extended to have a web interface / iPhone interface.

    PIDs are annoying to program and are either an ugly box next to the machine or are placed in a giant hole you cut in the frame. This is more elegant in many ways.

  6. The Ideanator says:

    @Jimbo

    Use Linux to only blink one single LED

  7. Nathan says:

    Not quite. You have to measure the temperature with an ADC chip and a ambient temperature chip, and decide for how much of that second the “LED” should be on.

  8. LinusTorvalds says:

    I really do not see the issue with people using Linux to do simple things. I brought forth the kernel from my sweaty loins so that you all may do with it what you wish, however you wish.

    Some people use paint brushes to make a picture, others choose to throw paint through a weed whacker. The result is a painting, regardless of how you cut it. Different tools can still yield the same results.

    That said, this guy clearly had a small router on hand that is crappy at routing, but good at being a small computer that runs Linux. Why should he purchase a PID or build one from the ground up when he already has a perfectly good tool at his disposal? Can you really justify going out and buying all the components he would need to build the PID when he already had everything he needed on hand? Why buy buy buy when you can re-use, re-purpose, and recycle?

  9. tomn says:

    Screw the web interface, this thing needs a HTCPCP (Hyper Text Coffee Pot Control Protocol) interface:

    http://www.ietf.org/rfc/rfc2324.txt

  10. noah says:

    There is absolutely nothing wrong with using more than you need to do a job. It’s about using what you *HAVE*.

    Nice work.

  11. dext3r says:

    uhh, using linux gives you a ton of flexibility….

    …unless you hate flexibility.

    do you hate flexibility?

    *flexibility*

  12. Andrew Smith says:

    whats a PID?

  13. Dan Swanson says:

    I like the idea of boiling an egg with a nuclear pile. It comfort the soul to know who is the hunter and who is the prey.

  14. Chris says:

    Never heard of a Meraki Mini, but at a glance it appears virtually identical to the original Fonera.

    @Andrew: PID = Proportional-Integral-Derivative. A way of controlling something that has inertia (in this case thermal inertia) with minimal over/under shoot. Also used for motor control and many other things. Modeled after how we naturally steer cars, ships, or move our own limbs to desired positions. For a more detailed summary, look up “PID Loop” on Wikipedia.

  15. Robot says:

    @Nathan,

    Nice work. I’m going to pass this along to a friend who is working on a self-tuning PID SousVide controller.

    – Robot

  16. Al says:

    I miss the old photos of hackaday.com, black and white, with clear tape in the corners

  17. Brett says:

    A slightly less overkill solution might be to use the Arduino PID Library (full disclosure, I’m the author)

    And because this is HaD and the Arduino is… frowned upon, let me also mention that did an extensive blog series accompanying the latest library release. It details all the steps necessary to turn a basic pid algorithm in to something of industrial quality.

    Library: http://www.arduino.cc/playground/Code/PIDLibrary
    Write-up: http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

  18. Lion XL says:

    dunno…maybe I’m the idiot… but at 45 yrs old, I always thought the art of hacking was to take what you have and make it do something it wasn’t intended for, i.e. using a router for a PID!

    I remeber when Tardis BBS (I think that was the boards name, but the name unimportant), there was OP named Zaphod (again i think that was the name, or it may have been Arthur Dent! ) had a ongoing thread about daily hacks and simple hacks.

    Simple hacks were like taping a plastic can cover over a scraped together speaker box to make it water proof (albeit marginally!). I guess he’d get the flaming of his life if he ever sent that stuff here….

    My point is hacks are hacks, and when people stop trying to one up the next guy, especially when you are not adding any value, just saying ‘I could name the tune in 3 notes’ is getting prety lame and some of you ‘hackers’ need to grow up…

    GOOD JOB NATHAN.

  19. Nathan says:

    @Brett it’s overkill if you don’t want to do more than the limited Arduino hardware can do.

    – Have the PID on a timer that is different each day (I DO!)
    – Turn your coffee machine on/off while away from home (I DO)
    – Have the ability eventually have a simple iPhone interface for it (I DO)

    But sure, I should have written Arduino sketch instead of a OpenWRT package, though the work would be the same, and I’d have to buy and Arduino…

  20. Brett says:

    @Nathan
    Hell yes! rereading my post my tone is way off. this project is insanely awesome.

    I guess a better way to say it would have been “if you think this is overkill, perhaps a slightly less… blah blah blah”

  21. nobody says:

    @Nathan

    A real he-man hardware hacker woulda done it using 555s, like this dude is working on: http://www.paleotechnologist.net/?cat=248

    Sign o-the times: LinDuino,coming soon from some Hardwin*Fruit w/8-bits instead of just two…

    8-}

    *Hardwin = Arduino in English = “Strong Man”, makes one say, “Hmmm”

  22. Maave says:

    I really like this idea. I wonder how many other Linux-capable routers have GPIO pins.

  23. Mad Max says:

    This is never going to come close to full awesomeness until it includes a Kalman filter as well. For filtering that coffee, obviously, and just because we can.

    …oh wait, it’s an espresso. Right…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,764 other followers