
Espresso Machine Powered by Tcl/Tk - blacksqr
https://groups.google.com/d/msg/comp.lang.tcl/TsTbDVx8tUQ/kbejHvzuEgAJ
======
dfox
I have used Tk (through Python's tkinter) for several touch-based "kiosk"
applications. It is surprisingly useful and productive for that. What you need
is small (~100 lines) custom ttk style which adds larger padings to buttons
and such and maybe makes it look "modern", flat and colorful and that's it. It
certainly makes more sense than making such things web-based.

------
johnbuckman
That's me on the video. I'm a long-timer Hacker News reader, and happy to have
a geeky chat here about what I'm up to. -john

~~~
potentialverand
I'm curious about your measured pressure drop between the pressure at the
pump, and the pressure at the group head. Since coffee machines are low flow
and travel through a short distance of presumably stainless steel pipe, my
quick calculations indicate a minimal pressure drop compared to the expected 9
bar of pressure used to pull a shot.

Temperature is another kettle of fish as you have demonstrated.

~~~
johnbuckman
The problem is that your mental model of how a boiler based espresso machine
works is not how they are actually wired.

Here is how they actually work: 9 bar of pressure are generated between the
pump and a flow constrictor which is placed before the boiler, pumping _cold
water_ into the boiler. This cold water then displaces the water in the
boiler, which then gets pushed to the espresso.

Thus, the final pressure depends on the compressibility of the steam (or
airspace) in the boiler. In practice, you get about half a bar less at the
espresso than the pump got behind the boiler. But, the real numbers depends on
lots of factors, many of which are invisible.

------
rtpg
Tcl/Tk is one of the cooler tools out there, though I wish it were not so...
string-based.

Much like Clojure took a bunch of neat stuff from recent programnming
languages (first class hash maps! immutable data structures!), I'd love to see
a Tcl variant that takes some inspiration from recent trends.

~~~
bsder
> Tcl/Tk is one of the cooler tools out there, though I wish it were not so...
> string-based.

Tcl was designed in a different time when memory was scarce.

The point of being so "stringy" is that you could parse it in place in the
same amount of RAM as the original "string program" took up.

I really would love something with similar constraints as the old Tcl for
microcontrollers. BASIC used to run in 4K RAM with 4K ROM--I really wish we
had a modern equivalent that I could connect to with a UART.

Quite often my constraint on a microcontroller is waking up and waiting for a
sensor, transmitter, etc. -- I have _forever_ to run interpreted code. A small
language would be really nice.

~~~
johnbuckman
Ironically, because Tcl was made to run GUIs on very limited hardware (old
Unix machines, 30 years ago) it runs really nicely on slow Android tablets.

Its focus on asynchronous programming, rather than relying on threads, really
helps, as does the small memory footprint (105mb of RAM used for my app).

Java-based apps on the same tablet that I supply with the espresso machine run
at a crawl, whereas my Tcl app feels normal.

~~~
pjmlp
It doesn't help that Google did a pretty lousy job with Dalvik.

If those tablets were running something like Aicas Java runtime, it would be
much different.

~~~
johnbuckman
"Androwish", which is Tcl/Tk ported to Android, runs mostly on the C layer
sitting on top of Linux. As such, it's way more "performant" than Java.

------
albertzeyer
Very nice!

We at our university chair also wanted to have a touch-pad kiosk for our
drinks (coffees etc). So far it is just used to do the accounting, i.e. count
which user drinks how much, and whether he has paid.

I decided to use Kivy instead of Tcl/Tk, because I thought I can have some
nicer animations, and it would feel more modern. I was quite happy with the
result. Here with screenshot: [https://github.com/rwth-i6/drink-
kiosk](https://github.com/rwth-i6/drink-kiosk)

The next step which we planned was to actually wire this app with our coffee
machine, and allow drinks only via the kiosk app. But we never got to that so
far, unfortunately.

------
klez
Historic precedent
[http://www.tldp.org/HOWTO/Coffee.html](http://www.tldp.org/HOWTO/Coffee.html)

~~~
johnbuckman
Two very fun coffee RFCs:

1) Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)
[https://www.ietf.org/rfc/rfc2324.txt](https://www.ietf.org/rfc/rfc2324.txt)

2) Definitions of Managed Objects for Drip-Type Heated Beverage Hardware
Devices using SMIv2
[https://tools.ietf.org/html/rfc2325](https://tools.ietf.org/html/rfc2325)

\--- Especially amusing as I was thinking of adding SNMP support to my coffee
machine, so the humorous RFC above might actually be relevent.

------
rurban
Extremely interesting YouTube talk also. You learn a lot about making good
coffee.

------
digitalsushi
My first job was working on a product called qacafe cdrouter, which is an
entire product written in Tcl. (but not tk.)

It is amazing what you can build if you rely on organization and convention. I
had nothing to do with creating it, but I really learned a lot from some
really amazing people the years I spent there -- how designing a thing is
generally the first requirement for scaling a thing.

------
canada_dry
Very timely... I recently picked up an old Miele fully automatic espresso
machine (grinds, tamps then expells) that's controlled via an 8Mhz 6502 like
CPU.

I'm in the process of overriding the cpu with my own controller and adding my
own GUI to control/tweak the process.

I enjoyed John's talk and can relate!

------
methou
Google groups now require a login.

~~~
jchw
I just tried viewing the link in Private Browsing and it seemed to work. Not
sure why you would be getting kicked to login.

~~~
icebraining
Google Groups has a weird state, if it detects some account cookies, it forces
you to login, but it works fine if not. It's been around for years.

------
sgt
Shows that Tcl/Tk is still relevant in various contexts. Impressive work!

