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.

23 thoughts on “Using A Router As A Linux-based PID Controller

  1. 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.

  2. 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.

  3. 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?

  4. 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.

  5. 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/

  6. 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.

  7. @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…

  8. @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”

  9. 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

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.