Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
MyHomeThings
Published © GPL3+

iRobot Roomba voice control with Amazon Alexa

We can start the Roomba with a quick voice command before leaving the apartment to keep the floor clean by the time we get home.

BeginnerFull instructions provided2 hours798
iRobot Roomba voice control with Amazon Alexa

Things used in this project

Hardware components

iRobot Roomba 5xx series
×1
ESP8266-01
×1
ESP-01 Breadboard adapter
×1
AMS1117 3,3V power supply modul
×1
Amazon Alexa echo (gen4)
×1
USB Programming Adapter for ESP8266-01
×1
MP1584EN DC-DC Buck Converter Adjustable Power Supply
×1

Software apps and online services

ioBroker
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

Roomba Schematic

iRobotRoomba500_OpenInterfaceSpec.pdf

Code

Roomba.ino

Arduino
/**************************************/
//  https://myhomethings.eu           //
//  Generic ESP8266 module            //
//  Flash size: 1M (no SPIFFS)        //
/**************************************/

#include <ESP8266WiFi.h>
#include <PubSubClient.h>

const char* ssid = "SSID";
const char* password = "Password";
const char* mqtt_server = "192.168.x.xxx";

WiFiClient espClient;
PubSubClient client(espClient);

void setup_wifi() 
{
  delay(100);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);
  }
  randomSeed(micros());
}

void reconnect() 
{
  while (!client.connected()) 
  {
    String clientId = "ESP8266Client_Roomba";
    
    if (client.connect(clientId.c_str()))
    {
      client.subscribe("Roomba");
    } 
    else 
    {
      delay(6000);
    }
  }
}

void callback(char* topic, byte* payload, unsigned int length) 
{
  payload[length] = '\0';
  String strTopic = String(topic);
  String strPayload = String((char * ) payload);
  
  if(strTopic == "Roomba") 
  {
    if(strPayload == "true") 
    {
      Serial.write(128);  // start command
      delay(50);
      Serial.write(131);  // safe mod
      delay(50);
      Serial.write(135);  // clean
    }
    if(strPayload == "false") 
    {
      Serial.write(128);  // start command
      delay(50);
      Serial.write(131);  // safe mod
      delay(50);
      Serial.write(143);  // dock
    }
  }
}

void setup() 
{
  Serial.begin(115200);
  setup_wifi();
  delay(1000);
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
}

void loop() 
{
  if (!client.connected()) 
  {
    reconnect();
  }
  client.loop();
}

Credits

MyHomeThings
11 projects • 7 followers
Contact

Comments

Please log in or sign up to comment.