Add wifi to an older roomba

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.

Huh weird it all looks right to me.out of curiosity what OS are you on?

Maybe try changing all the #if LOGGING lines to #ifdef LOGGING.

You could also try removing the !echo part of the build_flags So it’s like build_flags = -DLOGGING=1 -DMQTT_MAX_PACKET_SIZE=512

Finally you could try just adding #define LOGGING 1 to the top of main.cpp

It’s a Win10 x64 machine.
ifdef worked perfectly (replaced both instances). Than got

Compiling .pioenvs\d1_mini\src\main.o
src\main.cpp: In function 'void debugCallback()':
src\main.cpp:131:32: error: 'GIT_REVISION' was not declared in this scope
DLOG("Version: %s (%s)\n", GIT_REVISION, compile_date);
^

After removing line 131 everything compiled. Will test it out after figuring out OTA.

Interesting, seems like the compiler behaves differently on Windows than it does on Mac. I’ll be mindful of that next time I work on the code.

I just add resistors but no success :frowning:

Still getting Failed to read sensor values from Roomba.

EDIT
When I change the ESP unit (ESP12E to ESP01) I’m getting all states from Roomba via telnet :slight_smile:

Here is my HA sensor setup:

  - platform: mqtt
    name: "MQTT ROOMBA"
    state_topic: "vacuum/state"
    unit_of_measurement: "%"
    value_template: "{{ value_json.voltage }}" 

But no success to getting voltage on HA. Is there any trick?

Glad to hear you got it working with the ESP01! Are you using the voltage divider with the ESP01? It’d be really nice if the voltage divider isn’t necessary. My firmware isn’t currently sending voltage, though it it’s trivial to add. Look for the lines that look like

root["battery_level"] = (charge * 100)/capacity;
root["state"] = state;
root["charging"] = chargingState == Roomba::ChargeStateReconditioningCharging
  || chargingState == Roomba::ChargeStateFullChanrging
  || chargingState == Roomba::ChargeStateTrickleCharging;

To also send voltage you could add another line that looks like

root["voltage"] = voltage;

If you wanted to try out my work-in-progress home-assistant mqtt vacuum fork my configuration is simply

vacuum:
  - platform: mqtt

Got some PRs up!
https://github.com/home-assistant/home-assistant/pull/9386
https://github.com/home-assistant/home-assistant.github.io/pull/3354

Dear John, any plans on further development of ESP code?

1 Like

I know this might not be the best place to ask but hopefully will get here. Finally my Wemos boards and logic converters have arrived. Flashed John’s firmware for MQTT.

For logic converter got this ones

So having hard time wiring them up. TX from roomba went into HV1, RX -> HV2
Than from LV1 to RX of wemos, and LV2 to TX.
Than wired ground on low side to wemos g pin.

Do i have to supply the voltage? It states i have to give it “This module requires you to supply it with power from both the higher voltage level and the lower voltage level”
But where to get 5V from roomba side?

I definitely plan on working on the firmware more, but I’ve been busy the last month.

I didn’t use a level shifter because it wasn’t obvious where to pull 5v from the Roomba. I’m sure this is possible since the logic is 5V, there’s got to be a 5V supply on the board. I wired mine directly as per the info in the my README. The only concession I made for the 5V logic is to use a 1:2 voltage divider to drop the voltage from Roomba’s TX to the ESP RX.

If you were to find a 5V supply on the Roomba’s board, level conversion would definitely be more proper. I’ve wondered if some of the inconsistency I’ve seen in the BRC pin behavior is because I’m sending it 3.3V instead of 5V. If I were you, I’d take a volt meter and find where it’s 5V on the board, then try to find the regulator part that’s regulating the 5V.

1 Like

Well solved it easily. As i’m using a wemos board - i just raised the voltage to 5V on the voltage regulator and fed that to 5V of the wemos board and the logic converter.

The only problem… Can’t get the sensor values. Got them once somehow and that’s it. Sending of commands works perfectly
Even connected the RX pin directly to roomba with no luck.

(d t:69423083ms) Failed to read sensor values from Roomba

Maybe fried the RX pin… But not enough motivation to check (as i understand currently it only reports battery values).
Maybe on your next iteration of the code when more goodies will be included…

Thanks for the great work!

Has anybody tried to connect roomba with Broadlink Pro via RF? I have roomba 780 and I also have the iRobot Wireless Control Center which controls my 780 over RF. Just wondering if somebody knows how to do the same by Broadlink RM Pro.

Hi, I control my roomba 555 via Broadlink RM Pro and IR.
It works!

2 Likes

hi

i have made setup simuler to moskovskiy82 but i also get same Error message

Failed to read sensor values from Roomba

is there anyone there have solved this issue ?

I decided to try out @johnboiles firmware after having the older roomba-esp8266 firmware working fine. The Home-Assistant vacuum built in was intriguing instead of making up my own automations, plus sensor support.

I rewired my Wemos D1 Mini with a logic converter like @moskovskiy82 posted. I got around all the issues by having a power shield for the Wemos, accepts 7-24v and regulates 5v and 3.3v direct to the Wemos. I can then use a common ground and 5v and 3.3v to power the logic converter ( yes you need both sides power and ground to work)

I ran TX and RX through the logic converter, BRC left since it worked before without issue before. Testing with Telnet it seems to Wakeup and TX issues commands, but not recieving any data.

Failed to read sensor values from Roomba

constantly shows up and never changes. Checked over all connections and rewired going into Roomba but issue still is persists.

Has anyone actually got sensor readings back?

I’m really interested to read sensor and state values by Roomba. I’ll appreciate you effort in this direction.
Thank you in advance

Before I start on this project, is this still working for anybody? My wife has asked for our Roomba to be integrated so we don’t have to remember to turn it on before we leave and this is much cheaper than buying a new wifi Roomba.

Thanks,

1 Like

I had it working but haven’t had it hooked up in a while. There’s def some work to be done in my firmware still. Most notably to keep the roomba awake (a bug in Roomba 650s causes them to not wake from the serial port — if you have this model you may notice it makes a click sound every few hours… this is related to it waking up I think). Also there’s no way to know from the serial interface whether the roomba is cleaning, so I need to write code that infers that from other values like movement and motor power.

Overall though I think the project is a pretty easy one and is 80% done. If you’re willing and able to pitch in I’d love the help!

I’d like to help. I’m traveling over the next few weeks so I’ll start ordering parts so they are ready when I am.

Thanks.