Add wifi to an older roomba

Turns out the esp was broken. Used another unit and it worked fine. Did a small fork, added spot and stop commands.

void handle_roomba_spot()
{
  mySerial.write(128);
  delay(50);
  mySerial.write(131);
  delay(50);
  mySerial.write(134);
  Serial.println("Spot cleaning");
  handle_root();
}

void handle_roomba_stop()
{
  mySerial.write(128);
  delay(50);
  mySerial.write(131);
  delay(50);
  mySerial.write(133);
  Serial.println("STOP");
  handle_root();
}

My roomba goes to sleep after some time, do you know how to wake it up? (model 780).

You can wake up the Roomba by sending a low pulse to pin 5 (Device Detect input)

void wakeUp (void)
{
  setWarningLED(ON);
  digitalWrite(ddPin, HIGH);
  delay(100);
  digitalWrite(ddPin, LOW);
  delay(500);
  digitalWrite(ddPin, HIGH);
  delay(2000);
} 

Source: https://www.hackster.io/mjrobot/controlling-a-roomba-robot-with-arduino-and-android-device-56970d

1 Like

Thanks. That did wonders! Now I just have to minify my setup to fit inside somehow :smiley:

I didn’t see your fork with the changes, so I did a fork with the changes made.

I’m little lost on adding the wakeup. Its pretty essential since the goal I had was to have roomba power back on when stuck and lost in the house. Seems to happen in same spots.

Thanks for posting the link to the modified version. Hopefully it will evolve and maybe sensors and mqtt will be added at some point…

Diff here: https://github.com/yahat/roomba-esp8266/commit/45bd636c9946d20e31b79dc3830a2476e00f8cf7

Fork here: https://github.com/yahat/roomba-esp8266 - but you only need the above file.

#define Wake_Pin 16

String roombacontrol = "<a href='/roombastart'<button type='button' class='btn btn-default'><span class='glyphicon glyphicon-play' aria-hidden='true'></span> Start</button></a><a href='/roombastop'<button type='button' class='btn btn-default'><span class='glyphicon glyphicon-stop' aria-hidden='true'></span> Stop</button></a></div><a href='/roombaspot'<button type='button' class='btn btn-default'><span class='glyphicon glyphicon-search' aria-hidden='true'></span> Spot</button></a></div><a href='/roombadock'<button type='button' class='btn btn-default'><span class='glyphicon glyphicon-home' aria-hidden='true'></span> Dock</button></a></div>";

in setup

  pinMode(Wake_Pin, OUTPUT);
  digitalWrite(Wake_Pin,LOW);
  server.on("/roombaspot", handle_roomba_spot);
  server.on("/roombastop", handle_roomba_stop);

void handle_roomba_wake(){
  digitalWrite(Wake_Pin, HIGH);
  delay(100);
  digitalWrite(Wake_Pin, LOW);
  delay(500);
  digitalWrite(Wake_Pin, HIGH);
  delay(100);
}

void handle_roomba_start()
{
  handle_roomba_wake();
  Serial.println("Starting");
  mySerial.write(128);
  delay(50);
  mySerial.write(131);
  delay(50);
  mySerial.write(135);
  Serial.println("I will clean master");
  handle_root();
}

void handle_roomba_dock()
{
  handle_roomba_wake();
  mySerial.write(128);
  delay(50);
  mySerial.write(131);
  delay(50);
  mySerial.write(143);
  Serial.println("Thank you for letting me rest, going home master");
  handle_root();
}

void handle_roomba_spot()
{
  handle_roomba_wake();
  mySerial.write(128);
  delay(50);
  mySerial.write(131);
  delay(50);
  mySerial.write(134);
  Serial.println("Spot cleaning");
  handle_root();
}

void handle_roomba_stop()
{
  handle_roomba_wake();
  mySerial.write(128);
  delay(50);
  mySerial.write(131);
  delay(50);
  mySerial.write(133);
  Serial.println("STOP");
  handle_root();
}

Hardware pic

Image:

1 Like

Thats pretty clean. I used the Wemos d1 mini with the DC power shield, removed the DC barrel jack and soldered directly on.Voltage divided the RX and left tx as is

big thanks to @quasar66, I implemented the wakeup routine and added in max cleaning (??) to my fork

I can finally issue commands after it gets stuck and lost under the bed, couch. I only wish the page could display the status , cleaning, error, docked. But I am really happy with the outcome.

I’m working on running the command to get status stream and navigate it remotely, but first Im trying to integrate it with mqtt via a new espeasy module, the the other two.

What I’m worried is draining the battery under the minimum limit. I’ll try adding a safety for minimum voltage

Also I will try to add tomorrow the play song functionality to find it easier under furniture :slight_smile:

1 Like

How did you wire this? I see you only soldered 6 wires, but how does the buck converter play into what you did?

Power output from roomba and ground go to buck converter. Then output and ground from buck is connected to vin/v+ of the esp if it has 5V power input or to the 3v pin. If the buck converter only outputs a certain voltage connect it to the appropriate pin. 5V is preferred if possible for lower amperage.

The roomba output from 11-something to 20-something (not really sure the exact values) volts. Anything above 3/5 v (again depending on the power input you have on the board) will kill the esp immediately.

If you look at my picture, I have a 3v-5v convertor with 3 wires to the roomba for data. And a power convertor 6-36V to 5v switching power supply. This means the esp sees 3v on its data pins and 5V on power pin while the roomba gives out any voltage it wants for power (fluctuates with movement/charging) and it sees 5V on its data pins.

If you give more than 3v on data pins and more than 1V on analog pin or more than 5V on the 5V input pin or 3V on the 3V power pin you kill the board.

Also all grounds should be connected between them.

I am a self-taught electrician so take all this with a grain of salt. While I haven’t fried anything in the past 10 years I lack a good training in this stuff

For docking I’m putting an ir distance sensor on the dock with another esp. Seems the safest / best option of not waking up roomba all the time while charging. I’ll do that with an esp, this sensor https://www.pololu.com/product/1134 which reads 0 when beam is broken and espeasy. 5 minutes for project, 1 hour to make it look good :slight_smile:

1 Like

Seems the sleep mode goes into effect after error, stop commands. Not sure how it would drain any faster than normal. Also when docked it is not in sleep mode, at least the 5xx series. Before the wakeup routine I could issue commands when it was docked, even stop, it would flash off and back on again.

I started on a generic mqtt vacuum implementation last weekend. (Short) discussion is here: Mqtt vacuum

2 Likes

That’s awesome. But i couldn’t find an MQTT firmware for roomba.

There is

https://github.com/marcokeur/esp8266_roomba

but it seems long abandoned. Will give it a try although

Also found this rep which seems to contain the wealth of code that can be integrated

https://github.com/simoneluconi/Roomba_ESP8266_Ctrl/tree/master/Roomba_ESP8266_Ctrl

Yeah I couldn’t either so I started one. Built to work with my mqtt vacuum implementation. No Readme yet. It’s very much a work in progress but it mostly works now!

I’m having this gnarly issue I’ve seen others report online where 2016 and newer Roomba 650s go into a hard sleep after a minute of being on the dock. I haven’t been able to figure out the proper combination of pulsing the BRC pin and/or commands to prevent the sleep. Looks like Thinking Cleaner had a workaround in their firmware that would keep Roomba 650s awake so it has to be possible.

If anyone else is able to give this a spin I’d love to share notes.

This really sounds great!
So this should be compiled in platformio?
All the settings are in esp-roomba-mqtt/src/config.h ?
BRC_PIN is the one going to RX in roomba?

I hope with so many bright heads on this forum this project will receive support. Any chances of OTA firmware updates added?

It’s been a long time since I’ve been searching for my Roomba 650. Thank you.

I’m trying to upload your sketch to ESP12 board.

First attempt no success :slight_smile:
(untouched code)

Second attempt success but I don’t know sketch is running. There is no new network IP address on my wifi network
(commented upload_port in platformio.ini file)

config and secrets file changed. there is no password issue, i think.

Additioanlly, getting this warning while uploading sketch:

Verbose mode can be enabled via `-v, --verbose` option
fatal: Not a git repository (or any of the parent directories): .git

any advice?

Yes, it should be compiled in platformio.

You might need to modify the values in config.h (particularly MQTT_SERVER). BRC_PIN goes to pin 5 on the Roomba’s Mini Din connector (it’s used to wakeup the Roomba from sleep – though as mentioned it doesn’t work as such for newer 650s when they’re on the dock).

You’ll also need to copy secrets.example.h to secrets.h (e.g. cp src/secrets.example.h src/secrets.h) and change its values for you WIFI & MQTT credentials.

No need to set the RX/TX pins since I’m using the hardware RX/TX on the ESP8266 to talk to the Roomba. However, that also means you’ll need to first connect your ESP8266 to a computer to program it (modify upload_port in platformio.ini) before you connect it to the Roomba. After that you can program it over the air (ArduinoOTA support is built into the firmware). I’m not super sure about this, but I think you need an ESP8266 with a larger flash chip to support ArduinoOTA. I’m using an ESP12E which has 4M flash.

I’ll turn this into a README file soon i promise :wink: