Update and finish!
Well, a Steward, waiting for a very specific acoustic command/signature at table with family.... bad idea.
"Erverybody absolutely QUIET!!!!!! .....Salz...(giggle) .... Q I E T... Salz.....", and so on!
I quickly changed the Elechous Voicerecognition with a
HC-12 SI4463 Wireless Serial Port Module 433Mhz
http://www.ebay.de/itm/HC-12-SI4463-Wireless-Serial-Port-Module-433Mhz-Replace-Bluetooth-for-Arduino-/351198720845?hash=item51c513334d:g:WmMAAOSwAHZUQIh3
I have plenty of them in action in our house - work like charm!
#0000-2222-<salz>
# command
0000 Master
2222 Slave
<payload>
This with as Raspi and "SSH Button" on my Android doues ait al.
Android/SSH-Button->wlan->Raspi->433MHZ->Steward ;-)
And fnished!
Greetings
Robots can help! They should help!
Every Sunday morning at the breakfast table, again! “WHERE IS THE SALT!” – For the boiled egg!
Here it comes. With Salzfsss 0.1
An Arduino nano controls a relais controlling the power for L298N driving an old electronic infusion device motor with a string holding a peg holding a salt cellar.
There is a reed to count the rotations to define the amount of released string; a switch to prevent the system pulling the peg into the box.
And – at the moment - a simple microphone triggers the sketch to lower or raise the salt cellar.
In Version 1 voice recognition should give more specific triggers
In Version 2 the design should be more acceptable. It’s a steward robot!
Salut!
The Sketch:
//MotorA
int ENA = 6;
int IN1 = 4;
int IN2 = 7;
int schranke = 2;
int anschlag = 8;
int noise = 3;
int runden = 12;
int zaehler = 0;
int LED = 13;
int relais=A0;
unsigned long time;
int spd=200;
boolean dreh=false;
boolean richtung=true;
///////////////////////////////
#include <Bounce.h>
// Instantiate a Bounce object with a 5 millisecond debounce time
Bounce bschranke = Bounce( schranke,5 );
Bounce banschlag = Bounce( anschlag,5);
Bounce bnoise = Bounce( noise,5);
void setup ()
{
Serial.begin(9600);
Serial.println("Starte Salzfsss6! Noch kein Motorstrom");
pinMode (ENA, OUTPUT);
pinMode (IN1, OUTPUT);
pinMode (IN2, OUTPUT);
pinMode (relais, OUTPUT);
pinMode (schranke, INPUT);
pinMode (anschlag, INPUT);
pinMode (noise, INPUT);
pinMode (LED, OUTPUT);
digitalWrite(schranke, HIGH);
digitalWrite(anschlag, HIGH);
delay(3000);
digitalWrite(relais,HIGH);
Serial.println("Hello Motor !");
delay(500);
//Motor:
digitalWrite(ENA,LOW);
rauf();
banschlag.update();
int baninit=banschlag.read();
Serial.print("Endstandsmelder=");
Serial.println(baninit);
while(baninit!=0){
Serial.println("Endstandsmelder != 0 -> fahre hoch");
banschlag.update();
baninit=banschlag.read();
digitalWrite(ENA,HIGH);
}
Serial.println("Fertig! Alles aus! Warte auf Noise");
digitalWrite(ENA,LOW);
runter();
digitalWrite(ENA,HIGH);
delay(110);
digitalWrite(ENA,LOW);
time = millis ();
}
void rauf(){
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);//setting motorA's directon
}
void runter(){
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);//setting motorA's directon
}
void loop ()
{
banschlag.update();
if(banschlag.read()==LOW){
Serial.println("Anschlag == LOW, stelle auf RUNTER");
runter();
}
bnoise.update();
int noisewert = bnoise.read();
if (noisewert == HIGH){
Serial.println("Noisewert war/ist high");
dreh=true;
digitalWrite(LED, HIGH );
analogWrite(ENA,255);//start driving motorA
while(dreh){
banschlag.update();
if(banschlag.read()!=HIGH){
break;
}
//Serial.println("bin in Schleife while(dreh)");
bschranke.update();
int schrankewert= bschranke.read();
if(schrankewert==HIGH){
zaehler=zaehler+1;
bschranke.update();
time=millis();
while(bschranke.read()==HIGH){
bschranke.update();
}// while bschranke = high
Serial.println(zaehler);
Serial.print("Zeit mit aktiver Schranke in ms:");
Serial.println(millis()-time);
if(zaehler>runden){
dreh=false;
zaehler=0;
if (richtung){
rauf();
}
else{
runter();
}// if richtungswechsel
richtung=!richtung;
Serial.println(richtung);
}// if zaehler > runden
}// if schrankewert = high
}// while dreh=true
}// if noisewert high
else {
digitalWrite(LED, LOW );
digitalWrite(ENA,LOW);
}// if noisewert high
}// loop
Serves Salt when you need it. Hangs over the table, waits for sound (voice command, soon) and hands me the salt cellar
This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/salt-cellar-steward