Introduction: Alexa Controlled Robot Demo
In this instructables I will be showing you how to control a dc motor by Alexa Echo dot with voice API . This device movements are controlled with voice recognization.
A DC motor is any of a class of rotary electrical machines that converts direct current electrical energy into mechanical energy. The most common types rely on the forces produced by magnetic fields. SmallDC motors are used in tools, toys, and appliances. There are 4 main types of DC motors: 1:-Permanent Magnet DC Motors. The permanent magnet motor uses a permanent magnet to create field flux. 2:-Series DC Motors. In a series DC motor, the field is wound with a few turns of a large wire carrying the full armature current. 3:-Shunt DC Motors. 4:-Compound DC Motors. This was just a short introduction, everything else from theory, building, and programming will be explained in later steps. 1:-DC motor 2:-NodeMcu(ESP8266) 3:-Alexa echo. 4:-Connecting wires(male to male) 5:-Breadboard 6:-Relay Module
Step 1: Introduction - Home Automation and Robot Demo
In this instructables I will be showing you how to control a dc motor by Alexa Echo dot with voice API . This device movements are controlled with voice recognization.
A DC motor is any of a class of rotary electrical machines that converts direct current electrical energy into mechanical energy. The most common types rely on the forces produced by magnetic fields. SmallDC motors are used in tools, toys, and appliances.
There are 4 main types of DC motors:
1:-Permanent Magnet DC Motors. The permanent magnet motor uses a permanent magnet to create field flux.
2:-Series DC Motors. In a series DC motor, the field is wound with a few turns of a large wire carrying the full armature current.
3:-Shunt DC Motors.
4:-Compound DC Motors.
This was just a short introduction, everything else from theory, building, and programming will be explained in later steps.
1:-DC motor
2:-NodeMcu(ESP8266)
3:-Alexa echo.
4:-Connecting wires(male to male)
5:-Breadboard 6:-Relay Module
Step 2: Step 1:-Module Specification
A DC motor is any of a class of rotary electrical machines that converts direct current electrical energy into mechanical energy. The most common types rely on the forces produced by magnetic fields. SmallDC motors are used in tools, toys, and appliances.
There are 4 main types of DC motors: 1:-Permanent Magnet DC Motors. The permanent magnet motor uses a permanent magnet to create field flux.
2:-Series DC Motors. In a series DC motor, the field is wound with a few turns of a large wire carrying the full armature current.
3:-Shunt DC Motors.
4:-Compound DC Motors.
Relays are switches that open and close circuits electro-mechanically or electronically. Relays control one electrical circuit by opening and closing contacts in another circuit. As relay diagrams show, when a relay contact is normally open (NO), there is an open contact when the relay is not energized.
NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wifi-SoC from Espressif Systems, and hardware which is based on the ESP-12 module. The term NodeMCU refers to the firmware rather than the development kits. The firmware uses the Lua scripting language.
NodeMCU development board is based on widely explored esp8266 SoC from Expressif. It combined features of WIFI access point and station + microcontroller and uses simple LUA based programming language.
You need to remember while coding you should refer this diagram for pin numbering. For eg: D0-GPIO16 hence to invoke this pin you should use 16 in your code.
Key features include:
Is running at 80Mhz
Wireless Soc
Consists of mainly GPIO, ADC, SPI, PWM and few more things
Instruction RAM-64K bytes
Data RAM-96K bytes
Boot ROM-64k bytes
RISC (Reduced instruction set computing) architecture
. The core is a 106 micro Diamond Standalone core(LX3) made by Tensilica.
Small module (Dimension-11.5mmX11.5mm)
Integrated 10-bit ADC
Integrated TCp/IP protocol stack(ipv4)
+20dbm output power in 802.11b mode Integrated TR switch, balun, LNA, power amplifier and matching network Integrated PLL, regulators and power management units.
Step 3: Step 2:- Schematics
N.B-(In this circuit connection we have to supply 5volts as the input voltage.)
Step 4: Step 3:-After Making the Circuit Dump the Code Given Below:-
#include<ESP8266Wifi.h>
#include "fauxmoESP.h"
/* Network credentials */
#define WIFI_SSID "Enter your Wifi Name"
#define WIFI_PASS "Enter Password"
/* Belkin WeMo emulation */
fauxmoESP fauxmo;/*
Set Relay Pins */#define RELAY_1 D0
void setup()
{
Serial.begin(115200);
//setup and wifi connectionwifiSetup();//
Set relay pins to outputspinMode(RELAY_1, OUTPUT);
//Set each relay pin to HIGH ====== NOTE THAT THE RELAYS USE INVERSE LOGIC =====
digitalWrite(RELAY_1, LOW);
delay(500);
// Device Names for Simulated Wemo switchesfauxmo
.addDevice("Device Name");
fauxmo.onMessage(callback);
}
void loop()
{
fauxmo.handle();
}
/* ---------------------------------------------------------------------------Device Callback----------------------------------------------------------------------------*/
void callback(uint8_t device_id, const char * device_name, bool state)
{
Serial.print("Device ");
Serial.print(device_name);
Serial.print(" state: ");
if (state){Serial.println("ON");
}
else
{
Serial.println("OFF");
}
//Switching action on detection of device name
if ( (strcmp(device_name, "Karkhana Motor") == 0) )
{
if (!state){digitalWrite(RELAY_1, LOW);
}else{digitalWrite(RELAY_1, HIGH);
}
}
}
/* -----------------------------------------------------------------------------Wifi Setup-----------------------------------------------------------------------------*/
void wifiSetup()
{
// Set WIFI module to STA modeWiFi.mode(WIFI_STA);//
ConnectSerial.println ();
Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
Serial.println();
WiFi.begin(WIFI_SSID, WIFI_PASS);
// Waitwhile (WiFi.status() != WL_CONNECTED){Serial.print(".");
delay(100);
}
Serial.print(" ==> CONNECTED!" );
Serial.println();
// Connected!
Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
Serial.println();
}