Voice Kitchen Faucet (NodeMCU)
Touching is far too forward when first getting to know your kitchen faucet. You must first serenade it .. here then is the Cyrano de Bergerac method of dish washing.


Ingredients
NodeMCU ESP8266 ESP-12E V2
(2) 9G Micro Servo
5V Power Supply
Jacob AI (Proprietary)
PLA (3D Printer)



Notations
1. Limited positions to averaging hot/cold/mix in deux bcz .. less is more. Would diversify per #3.
2. #MakeArduinoCheapAgain
3. Recommend https://github.com/netlabtoolkit/VarSpeedServo as alternative to littering annoying for-statements .. unfortunately avr/interrupt.h is not ESP8266 compatible.
4. Shameless plug for https://www.theio.nyc/
5. Will you ever learn, me?! .. Shd you believe the arms are long enough .. add more.
6. FYI .. Jacob is my personal AI. Say no to Amaoogpple!
7. Alternative suggestion for voice commands: https://voiceattack.com/



Down The Code
// Voice Kitchen Faucet V.0.1 (NodeMCU)
// Vije Miller

#include <ESP8266WiFi.h>
#include <Servo.h>

const char* ssid = "ssid";
const char* pass = "password";
WiFiServer server(80);

Servo left;
Servo right;

// Servo Pins
const int ser_l = D6;
const int ser_r = D5;

// Version 2.0 would map() distance
// between off and peak temp ..

// Off
int l_off = 60;
int r_off = 110;

// Hot
int hfl = 70;
int hfr = 50;
int hol = 60;
int hor = 10;

// Mix
int mfl = 90;
int mfr = 75;
int mol = 130;
int mor = 35;

// Cold
int cfl = 110;
int cfr = 90;
int col = 160;
int cor = 90;

// Position
int pl = 70;
int pr = 90;

// LED
int led = D0;

void setup() {
Serial.begin(115200);

pinMode(led, OUTPUT);
digitalWrite(led, LOW);

left.attach(ser_l);
right.attach(ser_r);
left.write(l_off);
right.write(r_off);

// Connect
Serial.println(ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Connected");
server.begin();
Serial.print("http://");
Serial.print(WiFi.localIP());
Serial.println("/");

}

void loop() {

// Check
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait
while (!client.available()) {
delay(1);
}
// Read
String query = client.readStringUntil('\r');
client.flush();

if (query.indexOf("/hot=50") != -1) {
hot(50);
}
if (query.indexOf("/hot=100") != -1) {
hot(100);
}
if (query.indexOf("/cold=50") != -1) {
cold(50);
}
if (query.indexOf("/cold=100") != -1) {
cold(100);
}
if (query.indexOf("/mix=50") != -1) {
mix(50);
}
if (query.indexOf("/mix=100") != -1) {
mix(100);
}
if (query.indexOf("/off") != -1) {
off();
}

delay(1);
}


void off() {
left.write(l_off);
right.write(r_off);
delay(5);
}

void hot(int q) {
if (q == 50) {
pl = hfl;
pr = hfr;
} else if (q == 100) {
pl = hol;
pr = hor;
}
left.write(pl);
right.write(pr);
delay(5);
}

void mix(int q) {
if (q == 50) {
pl = mfl;
pr = mfr;
} else if (q == 100) {
pl = mol;
pr = mor;
}
left.write(pl);
right.write(pr);
delay(5);
}

void cold(int q) {
if (q == 50) {
pl = cfl;
pr = cfr;
} else if (q == 100) {
pl = col;
pr = cor;
}
left.write(pl);
right.write(pr);
delay(5);
}

Archive
https://hackaday.io/project/159473-voice-kitchen-faucet
https://hackaday.com/2018/09/01/talk-to-the-faucet/

23:19:19 163-018

@pkvi
"...may not meet professional standards."
12,168 miters
0 miters today
203 tenons
Subscribe