[RELEASE] ST_Anything v2.9.7 - Arduino/ESP8266/ESP32 to ST via ThingShield, Ethernet, or WiFi

That information is all in the ReadMe in my GitHub repo…

here is the original code:
we had it in the setup function so it would only run once because it was the aurdino was being turned on and off my a smart light bulbs board.
MyKeurig

Compiled 11/27/18

This Sketch serves the basic function of cycling a Keurig k35 model's brew cycle Autonomously without the need
to open the lid. It presses the power button, cycles the lid, brews a (medium size in my case) cup of coffee,
then safely shuts down the Keurig after completing the brew. This can all be achieved by modifying the existing
button panel harness by means of elongating the ground, power, lid, and brew circuits, and attaching them as follows:
Ground to D1
Power Button to D2
Lid Switch to D3
Desired Brew Button to D4

Thanks for checking out my first sketch and Happy Brewing

*/
const int power = 2;
const int lid = 3;
const int brew = 4;

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin D2 as an output for “POWER BUTTON”
pinMode(power, OUTPUT);
// initialize digital pin D3 as an output for “LID POSITION SENSOR”
pinMode(lid, OUTPUT);
// initialize digital pin D4 as an output for “10oz BREW BUTTON”
pinMode(brew, OUTPUT);

//BEGIN BREW CYCLE
//SET ALL OUTPUTS TO OFF
digitalWrite(power, HIGH);
digitalWrite(lid, HIGH);
digitalWrite(brew, HIGH);
//TOGGLE POWER SWITCH
digitalWrite(power, LOW);
delay(1000);
digitalWrite(power, HIGH);
//WAIT TO POWER UP, CYCLE LID POSITION
delay(5000);
digitalWrite(lid,HIGH);
delay(1000);
digitalWrite(lid, LOW);
//WAIT, TOGGLE BREW BUTTON
delay(5000);
digitalWrite(brew, LOW);
delay(1000);
digitalWrite(brew, HIGH);
//WAIT POWER OFF 15MIN
delay(900000);
digitalWrite(power, LOW);
delay(1000);
digitalWrite(power, HIGH);

Serial.begin(9600);
}

// the loop function runs over and over again forever
void loop(){

thank you for some reason the it was only showing me the esp32 setup get hub on this page

So, that original sketch simply toggles three digital outputs. I am confused as to the purpose of this. Is the goal to have SmartThings start a brewing cycle at a certain time each day? Is that what the purpose of the smart bulb’s zigbee radio board? Were you using the zigbee board out of an old Cree bulb by any chance? What was the previous home automation system, if not SmartThings (out of curiosity!) ?

My guess is the bulb’s zigbee board received a command from a home automation system, which then caused its output to somehow reset/power on the Arduino. The Arduino then simply toggled the digital outputs per a hard-coded schedule.

Does that about sum it up?

If so, you can use an ESP8266 or an ESP32 board to replace the smart-bulb’s zigbee board, as well as the Arduino UNO (assuming the Keurig can be manipulated in the same manner using a 3.3v board like ESP8266 or ESP32, as opposed to the 5v board of the UNO.

Do you have some relays wired between the UNO and the Keurig?

A wiring diagram will be very helpful… :wink:

so the goal, which i did succeed for a couple months until the keurig malfunctioned, was to wake up naturally (not any specific time) say alexa good morning. and while still in bed my coffee would brew and my bathroom heater would turn on and my bathroom lights would slowly lighten up. honestly the hands down best way to wake up in the world. lol. give me a min and ill draw one up… also no relays

1 Like

So, it would probably be easiest to simply create this as a specialized Arduino sketch, that uses my WiFi communications library to integrate with SmartThings. Basically, you just need an “Alexa to SmartThings to Arduino Switch” device. Then, when the Arduino receives the command to turn on the ‘switch’ device, the sketch will run your sequence of digital output commands. At the end of the cycle, the Arduino will tell SmartThings that the ‘switch’ has been turned off, so everything is ready for the next cycle.

When I get some free time, I’ll whip up a very simple example sketch that you can use and then add your custom code to. One thing that will need to happen is that all of your hard-coded ‘delay()’ statements will need to be replaced with ‘millis()’-based timing logic instead. The WiFi communications library does not like long delay() statements as they block the Arduino board from servicing the network stack.

Ok so here is a youtube video. Cant really give you a wiring diagram. Also the button board inside the keurig is 3v3. https://youtu.be/t3OI08AXrq0.

also i did the aurdino esp32 setup… but unsure if should change board choice. i got this https://www.amazon.com/gp/product/B07DBNHJW2/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
and it says there to use node32 and i used wifi scan example sketch to verify it could find my wifi which it can… im sorry im such a noob.

Some of the delays may not be neccesary since i can name each function as a different thing right? So rather than activating 1 thing (the uno i had with smart light) ill be using esp to call the power button a thing the lid switch a thing and the brew button a thing…

Some of the delays may not be neccesary since i can name each function as a different thing right? So rather than activating 1 thing (the uno i had with smart light) ill be using esp to call the power button a thing the lid switch a thing and the brew button a thing… or we could do it your way because i know nothing lol.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.