• Stars
    star
    199
  • Rank 196,105 (Top 4 %)
  • Language
    C++
  • Created over 7 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ESP8266 MQTT Roomba controller (Useful for hooking up old Roombas to Home Assistant)

esp-roomba-mqtt

TravisCI Build Status

ESP8266 MQTT Roomba controller (Useful for hooking up old Roombas to Home Assistant)

Parts:

  • ESP12E ESP8266 Wifi microcontroller ($3-4) Though any ESP module will probably work
  • Small 3.3V switching step-down regulator ($1-2)
  • 5kOhm & 10kOhm resistor for 5V->3.3V voltage divider (any two resistors above a few kOhm with a 1:2 ratio should work)
  • Some ~10kOhm pullup/pulldown resistors to get the ESP12E in the right modes for programming (probably anything 2k-20kOhm will work fine)
  • 3.3V FTDI cable for initial programming
  • Some wire you can jam into the Roomba's Mini Din connector, or a proper Mini Din connector

Electronics

esp-roomba-mqtt schematic. ESP-12E symbol by J. Dunmire in kicad-ESP8266. is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license visit http://creativecommons.org/licenses/by-sa/4.0/

Connections

  • ESP GPIO15 -> 10kOhm Resistor -> GND
  • ESP GPIO0 -> 10kOhm Resistor -> 3.3V
  • ESP EN -> 10kOhm Resistor -> 3.3V
  • ESP TX -> Roomba RX (Pin3 on Roomba's Mini Din connector)
  • Roomba TX (Pin4 on Roomba) -> 5kOhm -> ESP RX -> 10kOhm -> GND
  • ESP GPIO14 -> Roomba BRC (Pin5 on Roomba)
  • ESP 3.3V -> Voltage regulator 3.3V
  • ESP GND -> Voltage regulator GND
  • Voltage regulator Vin -> Roomba Vpwr (Pin 1 or 2 on Roomba)
  • Voltage regulator GND -> Roomba GND (Pin 6 or 7 on Roomba)

Voltage divider

Note that 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 used a 5kOhm resistor and a 10kOhm resistor but anything above a few kOhm with a 1:2 ratio should be fine.

Compiling the code

Setting some in-code config values

First off you'll need to create a src/secrets.h. This file is .gitignore'd so you don't put your passwords on Github.

cp src/secrets.example.h src/secrets.h

Then edit your src/secrets.h file to reflect your wifi ssid/password and MQTT server password (if you're using the Home Assistant built-in broker, this is just your API password).

You may also need to modify the values in src/config.h (particularly MQTT_SERVER) to match your setup.

Building and uploading

The easiest way to build and upload the code is with the PlatformIO IDE.

The first time you program your board you'll want to do it over USB/Serial. After that, programming can be done over wifi (via ArduinoOTA). To program over USB/Serial, change the upload_port in the platformio.ini file to point to the appropriate device for your board. Probably something like the following will work if you're on a Mac.

upload_port = /dev/tty.cu*

If you're not using an ESP12E board, you'll also want to update the board line with your board. See here for other PlatformIO supported ESP8266 board. For example, for the Wemos D1 Mini:

board = d1_mini

After that, from the PlatformIO Atom IDE, you should be able to go to PlatformIO->Upload in the menu.

Testing

Mosquitto can be super useful for testing this code. For example the following commands can be used publish and subscribe to messages to and from the vacuum respectively.

export MQTT_SERVER=YOURSERVERHOSTHERE
export MQTT_USER=homeassistant
export MQTT_PASSWORD=PROBABLYYOURHOMEASSISTANTPASSWORD
mosquitto_pub -t 'vacuum/command' -h $MQTT_SERVER -p 1883 -u $MQTT_USER -P $MQTT_PASSWORD -V mqttv311 -m "turn_on"
mosquitto_sub -t 'vacuum/#' -v -h $MQTT_SERVER -p 1883 -u $MQTT_USER -P $MQTT_PASSWORD -V mqttv311

Debugging

Included in the firmware is a telnet debugging interface. To connect run telnet roomba.local. With that you can log messages from code with the DLOG macro and also send commands back that the code can act on (see the debugCallback function).

Roomba 650 Sleep on Dock Issue

Newer Roomba 650s (2016 and newer) fall asleep after ~1 minute of being on the dock. Though the iRobot Create 2 docs say that you can keep a Roomba awake by pulsing the BRC pin low, it doesn't seem to work for newer Roomba 650s when they are on the dock. Thinking Cleaner's docs note that this is likely a bug, and they have a workaround to keep the Roomba awake while docked. I haven't figured out the magic sequence to keep Roomba 650s awake on the dock (see this code comment for what I've tried).

More Repositories

1

obs-mac-virtualcam

ARCHIVED! This plugin is officially a part of OBS as of version 26.1. See note below for info on upgrading. πŸŽ‰πŸŽ‰πŸŽ‰Creates a virtual webcam device from the output of OBS. Especially useful for streaming smooth, composited video into Zoom, Hangouts, Jitsi etc. Like CatxFish/obs-virtualcam but for macOS.
Objective-C++
4,063
star
2

BaofengUV5R-TRRS

Tiny board that allows you to connect the Baofeng UV5R radio to a smartphone or other device that uses a TRRS connector for audio.
378
star
3

coremediaio-dal-minimal-example

Intended to be the most minimalistic example of a macOS CoreMediaIO DAL plugin.
Objective-C++
210
star
4

JBKinectHacks

A collection of sample projects and code snippets using OpenNI and the Kinect.
C
71
star
5

esphome-hdmi-cec

ESPHome component to send and receive HDMI-CEC messages.
C++
62
star
6

JBDaylightOverlay

An overlay for MapKit that shows daylight for the current date and time.
Objective-C
60
star
7

esp-garage-opener

(DEPRECATED: Use ESPHome instead) Control your garage door over MQTT with Home Assistant.
C++
36
star
8

hotspot_autologin

Script to automatically log into wifi hotspots that redirect to an agreement page before allowing access.
Python
33
star
9

ARDroneSDK

Fork of Parrot's official ARDrone SDK
C
29
star
10

homeassistant-config

My Home Assistant and ESPHome configs
HTML
24
star
11

home-assistant-purpleair

Forked from https://gitlab.com/gibwar/home-assistant-purpleair
Python
14
star
12

NMEAProxy

Tool for forwarding NMEA messages from TCP sockets and serial ports.
Python
12
star
13

xcasset_exporter

Short script for exporting images in .xcassets bundles to individual image files.
Python
12
star
14

pi-rtlsdr-igate-docker

Dockerfile for running an APRS IGate on a RaspberryPi with an attached RTL-SDR dongle
Shell
11
star
15

Helm-firmware

A data translator for your boat networks. Connects to SeaTalk, NMEA 0183, and USB.
C++
9
star
16

trackuino

The Arduino APRS Tracker
C++
9
star
17

Helm-hardware

A data translator for your boat networks. Connects to SeaTalk, NMEA 0183, and USB.
Eagle
9
star
18

CocoaOpenNI

Sample project for using OpenNI in a Cocoa OSX app.
C
8
star
19

tinytrackuino

Small Trackuino-compatible board for transmitting APRS packets over 2m amateur radio.
Prolog
7
star
20

rtl-433-docker-pi

Dockerfile and related SystemD unit file for running rtl_433 inside Docker on a Raspberry Pi.
Dockerfile
5
star
21

Helm-ios

iOS app for controlling SeaTalk-based autopilots on boats.
C++
4
star
22

esp-fan-controller

(DEPRECATED: Use ESPHome instead) MQTT fan controller with an ESP12 to drive a PWM input to a mosfet.
C++
4
star
23

Dimlet

A portable, network-controlled light dimmer that can be controlled from an iOS application.
Objective-C
3
star
24

air-sensor

(DEPRECATED: Use ESPHome instead) Esp8266 Air Sensor (temp, humidity, co2, particulates) for reporting to Home-Assistant
C++
2
star
25

replaycam

Simple webserver for Raspberry Pi that exposes an endpoint for saving the last n seconds of video from the Raspberry Pi Camera Module.
Python
2
star
26

Steer

iOS app for driving a remote controlled car from an iPhone w/ IP camera FPV.
Objective-C
2
star
27

JohnBoiles-Eagle-Libraries

Custom Eagle Libraries
2
star
28

BurnBabyBurn

Tiny board for controlling a high-power logic-level n-channel MOSFET transistor. Useful for burning stuff (like nichrome wire). Can be used as a timed cut-off for high-altitude ballooning.
Arduino
2
star
29

XcodeSnippets

A collection of XcodeSnippets I found useful
Objective-C
1
star
30

projects

Write-ups on things I've built
1
star
31

pi-oled-docker

A Dockerfile and Python script for driving a small OLED display from a Raspberry Pi.
Python
1
star
32

esp-mqtt-irblaster

(DEPRECATED: Use ESPHome instead) ESP8266 MQTT IR Blaster. Useful for hooking up IR gear (TVs, ACs, sound bars) to Home Assistant (and probably other things).
C++
1
star
33

pi-oled

Code for running a small OLED attached to a RaspberryPi to show some system stats. (Note: ChatGPT helped make this)
Python
1
star
34

CupsPi

Raspberry Pi image builder for a CUPS print server
Shell
1
star
35

rtl-sdr-homekit

Project to bridge RF sensors to Apple Homekit using a rtl-sdr dongle.
Go
1
star
36

IBMF-Font-Editor

C++
1
star
37

stacks-ios

iOS SDK for the upcoming Stacks environment management tool.
Objective-C
1
star
38

KinectWings

Kinect controller for quadcopters.
Objective-C
1
star
39

scad-pegboard

OpenSCAD models for the pegboard on my walls.
OpenSCAD
1
star
40

OpenVSD

A small board and accompanying Arduino firmware that allows you to turn a normal diaphragm pump into a variable speed diaphragm pump.
C
1
star
41

scad-lego-stepper

Originally based on Thing 1674077 (by rainerunsinn I think) from Thingiverse
OpenSCAD
1
star