diff --git a/content/posts/coffee/index.md b/content/posts/coffee/index.md new file mode 100644 index 0000000..057d433 --- /dev/null +++ b/content/posts/coffee/index.md @@ -0,0 +1,104 @@ +--- +title: "DIY 'Smart' Coffee Maker" +date: "2020-07-05" +author: "William Floyd" +featured_image: "media/20200702_120123.jpg" +categories: [ + "Hardware", + "Electronics", + "Hacking" +] +tags: [ + "Hobby", + "Home Assistant", + "Home Automation", + "ESPHome", + "Coffee", + "IOT" +] +--- + +I have recently (last couple months) been getting into home automation, specifically using Home Assistant. +I also wanted to get a coffee maker that used K-Cups. +Thus the goal was born - to get a coffee maker working with Home Assistant, such that I could automate it to fit my morning routine. + +I first searched for new coffee makers, looking to see what the easiest ones would be to hack into and automate. +I got so far as adding a sleek new brand name model to my Amazon cart, but thankfully reason and frugality prevailed! +Instead, I opted to swing by the local Goodwill the next day, to see what secondhand options might be available. +As luck would have it, I found a no-frills, single button coffee maker for the princely sum of $4, and I was on my merry way. + +[![The Spoils of Goodwill](media/20200610_204856.jpg)](media/src/20200610_204856.jpg) + +*** + +Later that evening, opening the black box up (thankfully I had the correct triangular screwdriver head), I found very easily hackable innards. + +[![Poor lighting is the worst...](media/20200610_205351.jpg)](media/src/20200610_205351.jpg) + +The control board ([front](media/20200610_205847.jpg), [back](media/20200610_205841.jpg)) is very simple - two buttons in parallel, an LED, and a couple resistors. +I'm not quite sure what the logic is upstream (it un/latches on each press), but the buttons short to ground, and this is something I can work with. +The control board has wires for ground, signal, and 5V, in that order. + +The ordeal of hacking into the thing, and my missteps trying to do so, is rather boring really, but it produced this: + +[![Interception!](media/20200702_120309.jpg)](media/src/20200702_120309.jpg) + +[![Perfboard](media/20200702_120302.jpg)](media/src/20200702_120302.jpg) + +[![D1 Mini](media/20200702_120328.jpg)](media/src/20200702_120328.jpg) + +The brains I added was a Wemos D1 Mini (thanks, Aliexpress!), with a 3.3V<->5V converter between to sense when the coffee maker is on, and also turn on a mosfet to short the button to ground. +I initially had issues with the coffee maker turning on whenever I plugger the D1 Mini in, but a pulldown resistor solved this. + +[![External USB Plug](media/20200702_120334.jpg)](media/src/20200702_120334.jpg) + +I also opted for an external USB plug - this allows me to possibly reflash this without opening the enclosure, and also meant I did not need to splice into the mains line inside, which I was reluctant to do. + +I initially flashed and programmed the coffee maker with Tasmota, but almost immediately opted to use ESPHome instead. +I like Tasmota and ESPHome, I was just able to get more fine control of the setup using ESPHome in this instance, especially concerning the button logic. + +The (important) code is as follows: + +``` +binary_sensor: + - platform: gpio + device_class: power + internal: true + id: power_on + pin: D2 + +switch: + - platform: gpio + pin: D1 + id: relay + restore_mode: ALWAYS_OFF + - platform: template + name: "Coffee Maker" + icon: "mdi:coffee-maker" + lambda: |- + if (id(power_on).state) { + return true; + } else { + return false; + } + turn_on_action: + - switch.turn_on: relay + - delay: 50ms + - switch.turn_off: relay + turn_off_action: + - switch.turn_on: relay + - delay: 50ms + - switch.turn_off: relay +``` + +The beauty of the way in which I can detect signals and simulate a button press is that ESPHome senses when I use the physical button, and updates accordingly. +I can use the coffee maker absolutely as normal, the 'Smart' part of it is optional. + +*** + +The rest of my setup using this coffee maker is somewhat outside the scope of this post, but it includes using Tasker on my phone to run a 'Wakeup' automation on Home Assistant, which will - along with turning on my bed-head lamp, and switching my monitor on before putting it to sleep - check if I turned on a 'Morning Coffee' user input. +If I remembered to prep my coffee the night before, and turned on the switch, I will wake up to a hot cup of coffee (or, the sound of a coffee-in-progress). +I can also command Alexa and Google Assistant to do my bidding and make me a coffee. +At least someone does what I want... + +Truly, we are living in the future. \ No newline at end of file diff --git a/content/posts/coffee/media/20200610_204856.jpg b/content/posts/coffee/media/20200610_204856.jpg new file mode 100644 index 0000000..9e76838 --- /dev/null +++ b/content/posts/coffee/media/20200610_204856.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73b69714220c471216dce70cc0c9a64064db6d324929823f9ba910dce51351af +size 96912 diff --git a/content/posts/coffee/media/20200610_205351.jpg b/content/posts/coffee/media/20200610_205351.jpg new file mode 100644 index 0000000..06cb05a --- /dev/null +++ b/content/posts/coffee/media/20200610_205351.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79387800d740ab68cee020afd2e657cc48f205ba75c5d2c7322f1aa4bc83cd0d +size 78728 diff --git a/content/posts/coffee/media/20200610_205841.jpg b/content/posts/coffee/media/20200610_205841.jpg new file mode 100644 index 0000000..a90fc7c --- /dev/null +++ b/content/posts/coffee/media/20200610_205841.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:295000d5f811f18c49ddb16412daff4e04ed1c3726c414bc38e67fec3bc28181 +size 62766 diff --git a/content/posts/coffee/media/20200610_205847.jpg b/content/posts/coffee/media/20200610_205847.jpg new file mode 100644 index 0000000..75ee7d4 --- /dev/null +++ b/content/posts/coffee/media/20200610_205847.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca313404201bc675441834b6d0d34c2d3cbaa69041f1bf30ae9465f5faf2edc2 +size 66634 diff --git a/content/posts/coffee/media/20200702_120123.jpg b/content/posts/coffee/media/20200702_120123.jpg new file mode 100644 index 0000000..1e70a3c --- /dev/null +++ b/content/posts/coffee/media/20200702_120123.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69f07c7554a93d0f1c54cf2b9715f65597e4e989001fbde8e11fc65d2b0870c0 +size 109012 diff --git a/content/posts/coffee/media/20200702_120302.jpg b/content/posts/coffee/media/20200702_120302.jpg new file mode 100644 index 0000000..0110274 --- /dev/null +++ b/content/posts/coffee/media/20200702_120302.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec84ec8adf50fe3203d8bf5237b8b591036b2533b8515128b35156e7e4c6bfec +size 88143 diff --git a/content/posts/coffee/media/20200702_120309.jpg b/content/posts/coffee/media/20200702_120309.jpg new file mode 100644 index 0000000..5a03239 --- /dev/null +++ b/content/posts/coffee/media/20200702_120309.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c58b65bb37c636e555ad7b811ba4908d0eaa0b835c109589831a9330b8e90267 +size 66679 diff --git a/content/posts/coffee/media/20200702_120328.jpg b/content/posts/coffee/media/20200702_120328.jpg new file mode 100644 index 0000000..d0ce6bd --- /dev/null +++ b/content/posts/coffee/media/20200702_120328.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5184392df7721b6178afafebbc0709f059ff7c7b3edaa33b169c9cd5bc7a8ce2 +size 90726 diff --git a/content/posts/coffee/media/20200702_120334.jpg b/content/posts/coffee/media/20200702_120334.jpg new file mode 100644 index 0000000..1e69933 --- /dev/null +++ b/content/posts/coffee/media/20200702_120334.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c00c04bc0edfdaa74bc8726d8387bb1c86eb9c8d56203c809206197bc3e8708f +size 73050 diff --git a/content/posts/coffee/media/src/.env b/content/posts/coffee/media/src/.env new file mode 100644 index 0000000..e69de29 diff --git a/content/posts/coffee/media/src/20200610_204856.jpg b/content/posts/coffee/media/src/20200610_204856.jpg new file mode 100644 index 0000000..1faf3cf --- /dev/null +++ b/content/posts/coffee/media/src/20200610_204856.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86b056225aafc239a12a40cee5b83ba8562b1d208fabbe3603fdc678f9aa4d65 +size 3267917 diff --git a/content/posts/coffee/media/src/20200610_204856.jpg.hash b/content/posts/coffee/media/src/20200610_204856.jpg.hash new file mode 100644 index 0000000..4bb487f --- /dev/null +++ b/content/posts/coffee/media/src/20200610_204856.jpg.hash @@ -0,0 +1 @@ +088dae081c1112cb0ecc34916970329a diff --git a/content/posts/coffee/media/src/20200610_205351.jpg b/content/posts/coffee/media/src/20200610_205351.jpg new file mode 100644 index 0000000..8d05077 --- /dev/null +++ b/content/posts/coffee/media/src/20200610_205351.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df0a3e3989279e94539cc5942e1ff5df114434957eae15169c3a553b164d312a +size 2775183 diff --git a/content/posts/coffee/media/src/20200610_205351.jpg.hash b/content/posts/coffee/media/src/20200610_205351.jpg.hash new file mode 100644 index 0000000..4f7e094 --- /dev/null +++ b/content/posts/coffee/media/src/20200610_205351.jpg.hash @@ -0,0 +1 @@ +e2f419dd7a127579617af9b0b3fc54bb diff --git a/content/posts/coffee/media/src/20200610_205841.jpg b/content/posts/coffee/media/src/20200610_205841.jpg new file mode 100644 index 0000000..3275456 --- /dev/null +++ b/content/posts/coffee/media/src/20200610_205841.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e6c1ff7ad9eb1dbb56e5aa608d07bca8d19e4ad908f1afff6730b64232ab7d7 +size 3094392 diff --git a/content/posts/coffee/media/src/20200610_205841.jpg.hash b/content/posts/coffee/media/src/20200610_205841.jpg.hash new file mode 100644 index 0000000..bc59da3 --- /dev/null +++ b/content/posts/coffee/media/src/20200610_205841.jpg.hash @@ -0,0 +1 @@ +9331dc6ea3a9f20feeb535aec0784676 diff --git a/content/posts/coffee/media/src/20200610_205847.jpg b/content/posts/coffee/media/src/20200610_205847.jpg new file mode 100644 index 0000000..bfad073 --- /dev/null +++ b/content/posts/coffee/media/src/20200610_205847.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0603f27c974f9d5c947e56c45b414c08273a4274ede489c50e8afeff2935efc9 +size 3257990 diff --git a/content/posts/coffee/media/src/20200610_205847.jpg.hash b/content/posts/coffee/media/src/20200610_205847.jpg.hash new file mode 100644 index 0000000..212c3ed --- /dev/null +++ b/content/posts/coffee/media/src/20200610_205847.jpg.hash @@ -0,0 +1 @@ +7c49cdfcb5380bdf5d835fb4818ac208 diff --git a/content/posts/coffee/media/src/20200702_120123.jpg b/content/posts/coffee/media/src/20200702_120123.jpg new file mode 100644 index 0000000..4f2e8a5 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120123.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61f5952f853cfc08d2c1bd51fbe6ca9abe25af4140f302c5dc402db61da73a6b +size 3124001 diff --git a/content/posts/coffee/media/src/20200702_120123.jpg.hash b/content/posts/coffee/media/src/20200702_120123.jpg.hash new file mode 100644 index 0000000..eba61e5 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120123.jpg.hash @@ -0,0 +1 @@ +87267cf11a6ba05a54fb9f0f8ce4edfd diff --git a/content/posts/coffee/media/src/20200702_120302.jpg b/content/posts/coffee/media/src/20200702_120302.jpg new file mode 100644 index 0000000..dc2ad48 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120302.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4b11d0a925cfa673b07d2b535c011a93dabf90faab8b5f86f5fa35690974156 +size 4027049 diff --git a/content/posts/coffee/media/src/20200702_120302.jpg.hash b/content/posts/coffee/media/src/20200702_120302.jpg.hash new file mode 100644 index 0000000..635e06e --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120302.jpg.hash @@ -0,0 +1 @@ +4a65f0f170d59099c330aac084068f62 diff --git a/content/posts/coffee/media/src/20200702_120309.jpg b/content/posts/coffee/media/src/20200702_120309.jpg new file mode 100644 index 0000000..d8757f2 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120309.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2683433eb4e87fafce5e5c1e96728076c2ce577fef0b5274ae0528b1b95b0c65 +size 2751936 diff --git a/content/posts/coffee/media/src/20200702_120309.jpg.hash b/content/posts/coffee/media/src/20200702_120309.jpg.hash new file mode 100644 index 0000000..c6fb8d7 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120309.jpg.hash @@ -0,0 +1 @@ +1b3b90a6443b28ac1fd7aad19d2d5932 diff --git a/content/posts/coffee/media/src/20200702_120328.jpg b/content/posts/coffee/media/src/20200702_120328.jpg new file mode 100644 index 0000000..54d9320 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120328.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bf378f928ee631863d1a64f20e63148cb7c1e1dc54eab10bac27dffeb61d8b5 +size 3149392 diff --git a/content/posts/coffee/media/src/20200702_120328.jpg.hash b/content/posts/coffee/media/src/20200702_120328.jpg.hash new file mode 100644 index 0000000..5c4653d --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120328.jpg.hash @@ -0,0 +1 @@ +70c564aefb733512185b9dc48bed0567 diff --git a/content/posts/coffee/media/src/20200702_120334.jpg b/content/posts/coffee/media/src/20200702_120334.jpg new file mode 100644 index 0000000..29cbb19 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120334.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c726798078dbe6de6df887dc5bc0028b43285b8c7ff95975b6dc40d31e90e012 +size 2807679 diff --git a/content/posts/coffee/media/src/20200702_120334.jpg.hash b/content/posts/coffee/media/src/20200702_120334.jpg.hash new file mode 100644 index 0000000..fa8f919 --- /dev/null +++ b/content/posts/coffee/media/src/20200702_120334.jpg.hash @@ -0,0 +1 @@ +d757c81bb35b1198445ced20ed831881