I found a Roomba in an e-waste bin and decided to give it the gift of SLAM
Not a member? You should
Already have an account?
To make the experience fit your profile, pick a username and tell us what interests you.
We found
and
based on your interests.
Choose more interests.
Once the the level shifter was functioning I then needed to connect the pi to the Roomba. To do this I used a 8-way male moulded din cable assembly which is much easier to find than the 7-way counterpart. This works because the 8th pin sits in the middle void created by the 7-way receptacle's locator (the rectangle in the middle of the connector in the image below) - that is it just chills in a void and does nothing.
With this cable I connected the Rx of the Roomba to the Tx of the Raspberry Pi (via the level shifter of course) and plugged it into the socket under the top cover of the Roomba - it is now ready for some serial commands.
As per the iRobot Roomba SCI spec to control the Roomba you need to first send a few commands with a 20 ms pause in between to put it in passive mode then safe mode then full mode which will allow unrestricted access. This is done by sending the opcodes 128, 130, 131 and 132.
To command the Roomba to drive it needs to be sent the opcode 137 (drive) and then 4 data bytes as per the following sequence ( a nice example is given in the SCI):
[137] [Velocity high byte] [Velocity low byte][Radius high byte] [Radius low byte]
My first command was forward 10mm/sec and 0 radius (value 32768) turn which doesn't quite work. The Roomba will move ok but will still run with a large radius - perhaps it is my hi/lo byte splitting function. But I am still calling that a victory cause it almost does what I want - just need a bit more work to suss out whats going wrong.All the code for these commands and the basic framework I will be using is committed and pushed to my git repo.Enjoy
To get the Raspberry Pi and the Roomba talking by UART a little bit of prep work is needed.
The first thing is to set up the Pi so that it's serial pins can be used. I followed the guide here:
For a first check to see if the the Pi was transmitting I hooked up GPIO pin 14 (TX) to an oscilloscope, SSHed into my Pi and gave it a:
echo “SLAM” > /dev/ttyAMA0
The image below is what I was faced with... yuk! The signal should be going from 0V to 3.3V (or vice a versus) and be square not sludgy and triangularish.
I poked around in the breadboard (which being honest is a bit of a rat's nest), I checked my connections and it all looked good. But wait, I have the Pi running off my laptop's USB port and the laptop isn't connected into the mains, could the laptop be throttling the power from the USB bus to my Pi? I plugged in the laptop to the mains and took another measurement and pow we are back in business! Look at those lovely (fuzzy) edges
OK, now I can transmit something reasonable I will need to sort out a level shifter so I don't damage my Raspberry Pi. Why? because the Roomba's serial outputs a 5V high and the Raspberry Pi does not have 5V tolerant GPIOs - see and the table below taken from iRobot's Roomba Serial Command Interface (SCI) Specification.
#!/usr/bin/env python
import time
import serial
ser = serial.Serial(
port='/dev/ttyAMA0',
baudrate = 19200
)
while True:
ser.write("SLAM".encode('utf-8'))
received_data = ser.read() #read serial port
time.sleep(0.03)
data_left = ser.inWaiting() #check for remaining byte
received_data += ser.read(data_left)
print (received_data)
time.sleep(1)
And look at that, the conversion works (at least for the Pi anyway)
Next stop will be hooking up to the Roomba when the DIN cable arrives - ill probably need to check my Rp values too!
The first step was to clean up this bad boi, order a power supply and figure out what was wrong with it. It seems that it may have been an issue with the dock which is as of yet not fixed because I have been lazy and plugged the charger directly into the Roomba.
After a long charge cycle the Roomba fired up and started vacuuming up all the dust in its new home. Looks like one persons trash is another's treasure!
The next step was to dig up my Raspberry Pi and see if it still worked. Damn it the memory card was corrupt, just needed to reformat it. I went with Rapsbian (because I am lazy) using the installer on the Pi website: the image was installed on the pi I fired it up and it worked like a dream.Next step get the WiFi working so I can remote into the Pi from any device on my network. The WiFi dongle that I chose claimed to be plug and play ready for the Pi, and it was. No messing about with drivers, win! With the WiFi working I enabled ssh using the official documentation:. Now with this setup I can simply ssh into the pi using the command prompt i.e. ssh pi@(the ip address)
Once the ssh was setup I configured the Pi so that I could use windows Remote Desktop Connection to access the Pi's GUI. TO do this I followed the steps on:
Now the Pi is all setup the next step is to get the serial going!
View all 3 project logs
Already have an account?
this project is looking very great looking I am also working on the pretty similar type of website project you can see here
Are you sure? yes | no
This sounds like a lot of fun :-) Please keep posting!
Thanks for the interest, I have been wanting to do something like this for a long time so fingers crossed I can make it work!
Yamir Encarnacion
Tobias Kuhn
TurkeyDev
Isaac Wellish
Become a member to follow this project and never miss any updates
Contact Hackaday.io
Give Feedback Terms of Use
Hackaday API
© 2021 Hackaday
Yes, delete it
Cancel
You are about to report the project "Roomba 537 SLAM", please tell us the reason.
Your application has been submitted.
Are you sure you want to remove yourself as
a member for this project?
Project owner will be notified upon removal.
this project is looking very great looking I am also working on the pretty similar type of website project you can see here