Add wifi to an older roomba

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:

Wow, I didn’t think someone would get to trying it so quickly!

I assume you figured out to copy secrets.example.h to secrets.h? Which ESP12 board are you using? I’m using an ESP12E.

Did you clone the repo with git or download the source as a zip? There’s a part of the build_flags setting that compiles in the current Git SHA so you can check which version you’re running (-DGIT_REVISION='\"$(git rev-parse HEAD)\"' ). If you remove that flag it will probably get rid of your warning. I don’t think that would cause the build to fail however.

Yes secrets.h changed.

This is my ESP board

When I try to remove all build_flags line or just -DGIT_REVISION, can’t build the sketch.

Sketch uploaded. ESP board online right now. But I don’t know how can i test :slight_smile:

Awesome! Do you already have your ESP board wired into a Roomba?

If you want to test out the mqtt integration you could either check out my home assistant branch. Or manually send commands over mqtt (with a tool like mosquitto).

If you want to try to help figure out how to keep the Roomba 650 awake while on the dock, try out the telnet debugging interface (telnet roomba.local). With that you can log messages from code with DLOG and also send commands back that the code can act on. There’s a comment about what I’ve tried to this end at the top of the wakeup function)

Roomba on Dock and connected RX/TX pin to ESP Module. And here is my debug output.

(d) Failed to read sensor values from Roomba
(d) Failed to read sensor values from Roomba
(d) Failed to read sensor values from Roomba
(d) Wakeup Roomba
(d) Failed to read sensor values from Roomba
(d) Done waking up
(d) Failed to read sensor values from Roomba
(d) Failed to read sensor values from Roomba
(d) Failed to read sensor values from Roomba

I’m using High Sierra and telnet gone (I don’t know why) I’m using nc command:

nc roomba.local 23

When I remove the roomba from dock and long press to CLEAN button, roomba goes sleep. After that, esp12 waking up the roomba.

EDIT:
MQTT command works now :slight_smile:
I can start/stop/return_base etc.
trying to get status (ı don’t know which status can be read from roomba?)

see above

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

Maybe start from here http://www.irobotweb.com/~/media/MainSite/PDFs/About/STEM/Create/iRobot_Roomba_600_Open_Interface_Spec.pdf ?

Thank you reference. But I’m not developer. :slight_smile:

I know some mosquitto commands. With @johnboiles’s program I could send Mosquitto to Roomba. But I could not get the distance, chargingstate, voltage, current, charge, capacity on Roomba. I’m trying to figure out how to do this.

Thanks again.

Weird that there’s no telnet with High Sierra. You could probably install it with homebrew.

I forgot to mention I used a voltage divider from the Roomba TX pin to the ESP12E RX pin since the Roomba serial is 5V and the ESP is 3.3V. I’ve read that the ESP is 5V tolerant but when I connected it directly I didn’t receive anything. I used a 5kOhm resistor and a 10kOhm resistor but anything above a few kOhm with a 1:2 ratio should be fine. So it’d be Roomba TX -> 5kOhm -> ESP rx -> 10kOhm -> GND.

@quasar66 check out my wake up method it’s doing what your recommend. The spec doesn’t say anything about the deep sleep that happens with the newer 650s while docked though. The Thinking Cleaner docs say it’s probably a bug in the Roomba firmware.

Ok tried to build (sorry first attempt with platformio). Downloaded the ZIP. Changed the build flags

So platformio.ini looks like below

[env:d1_mini]
platform = espressif8266
board = esp12e
framework = arduino
lib_deps =
  RemoteDebug
  PubSubClient
  ArduinoJson

upload_port = roomba.local
build_flags = !echo "-DLOGGING=1 -DMQTT_MAX_PACKET_SIZE=512"

Got the following error

Project
roomba-mqtt
lib
Roomba
examples
LICENSE
Makefile
MANIFEST
project.cfg
Roomba.cpp
Roomba.h
readme.txt
src
config.h
main.cpp
secrets.example.h
secrets.h
.gitignore
.travis.yml
platformio.ini
README.md
You can quickly open files with the Fuzzy Finder. Try it by using Ctrl+T
6.9 s
platformio run
|   |-- <ESP8266WiFi> v1.0
|   |-- <ESP8266mDNS>
|   |   |-- <ESP8266WiFi> v1.0
Compiling .pioenvs\d1_mini\src\main.o
Archiving .pioenvs\d1_mini\libFrameworkArduinoVariant.a
Compiling .pioenvs\d1_mini\FrameworkArduino\Esp.o
Compiling .pioenvs\d1_mini\FrameworkArduino\FS.o

Compiling .pioenvs\d1_mini\FrameworkArduino\HardwareSerial.o
Compiling .pioenvs\d1_mini\FrameworkArduino\IPAddress.o
Compiling .pioenvs\d1_mini\FrameworkArduino\MD5Builder.o
Compiling .pioenvs\d1_mini\FrameworkArduino\Print.o
Compiling .pioenvs\d1_mini\FrameworkArduino\Schedule.o
Compiling .pioenvs\d1_mini\FrameworkArduino\Stream.o
Compiling .pioenvs\d1_mini\FrameworkArduino\StreamString.o
Compiling .pioenvs\d1_mini\FrameworkArduino\Tone.o
Compiling .pioenvs\d1_mini\FrameworkArduino\Updater.o
Compiling .pioenvs\d1_mini\FrameworkArduino\WMath.o
Compiling .pioenvs\d1_mini\FrameworkArduino\WString.o
<command-line>:0:33: error: token "=" is not valid in preprocessor expressions
src\main.cpp:15:5: note: in expansion of macro 'LOGGING'
#if LOGGING
^
<command-line>:0:33: error: token "=" is not valid in preprocessor expressions
src\main.cpp:156:7: note: in expansion of macro 'LOGGING'
#if LOGGING
^
Compiling .pioenvs\d1_mini\FrameworkArduino\abi.o
Compiling .pioenvs\d1_mini\FrameworkArduino\base64.o
Compiling .pioenvs\d1_mini\FrameworkArduino\cbuf.o
src\main.cpp: In function 'void debugCallback()':
src\main.cpp:117:16: error: 'Debug' was not declared in this scope
String cmd = Debug.getLastCommand();
^
src\main.cpp: In function 'void loop()':
src\main.cpp:250:3: error: 'Debug' was not declared in this scope
Debug.handle();
^
Compiling .pioenvs\d1_mini\FrameworkArduino\cont.o
Compiling .pioenvs\d1_mini\FrameworkArduino\cont_util.o
*** [.pioenvs\d1_mini\src\main.o] Error 1
 [ERROR] Took 5.99 seconds
 
Linter
Severity 	Provider 	Description	Line 
Git
GitHub (preview)
This repository does not have any remotes hosted at GitHub.com.