iRobot, the maker of Roomba, seem to be very open to the idea of
their products being used for academic or "hacker" projects.
They provide a serial API, the Open
Interface, which makes it very easy to control from your own
microcontroller. And the DIN connector used to interface
with the Roomba is present on nearly all models.
Some key notes about the DIN connector, with respect to
connecting a Raspberry Pi:
Once you have the TX and RX wired up, there are several
easy-to-use libraries available on github (and probably elsewhere)
for communicating using the Open Interface. I found a Python
based library called PyRoombaAdapter
which worked out well for me, and so is used in this project.
One thing I noticed in my initial testing with controlling Roomba with the Open Interface is that it's possible for Roomba to be in a Power Off state. In this state, it isn't listening on the Open Interface and so won't respond to any commands from the Pi. It enters this state after a period of time doing nothing (probably to save battery life) or it can be manually triggered over the Open Interface. (It doesn't appear to enter this state while sitting at its charging dock, however.) The only way to power Roomba back on is to press its "Clean" button.
For my project, I wanted to be able to fully control Roomba,
including power on. So, I added some extra wiring to trigger
the "Clean" button push. After i pulled off my Roomba'
cover, I noted that the button in question, marked "SW5",
functioned by momentarily connecting the contact points on either
side. One side is battery voltage (13V) and the other side
is usually ground.
The only other thing to note is the extra,
short green wire I added to the unused port of the
JST-PH connector. I added this just to help when
pushing it in and pulling it out. It's kind of far
down there!
Connecting to the Pi is fairly
straightforward.
Power the pi via the Micro USB cable
(which you'll need to attach to the 5V output and ground
of the 5V voltage regulator).
Plug in the USB-to-TTL adapter to the Pi's
USB port. My USB-to-TTL adapter had a jumper to
select either 3.3V or 5V logic; set it to 5V. Make
sure you connect the adapter's RX to Roomba's TX, and
adapter's TX to Roomba's RX.
For the "Clean" button trigger, connect to
a GPIO pin which is normally low. I believe you
can set this up for any GPIO pin, but I just checked one
that was already low by default, GPIO 18. The
software will momentarily set this pin high (3.3V) and
then low again, which triggers a button push response
from Roomba.