TransWikia.com

Not able to communicate with Roomba with serial port

Robotics Asked by Aalian khan on January 9, 2021

I have an IRobot Roomba model number 565 and I am trying to control it with a Wemos D1 mini with Roomba’s OI.

I connected the TX and RX pins from my FTDI adapter to the Roombas RX and TX and I can see information (battery firmware and etc) pop up in Termite (a serial terminal) but if I send the commands 128,131,135 in sequence The Roomba doesn’t go to clean mode.

I saw somewhere that sending commands to the Roomba with the serial terminal won’t work because it will send 128 as three bytes instead of one. So I used a sketch from someone that publishes information about the Roomba into an MQTT server. So I uploaded it to my Wemos D1 mini and connected the RX and TX accordingly, but it sends “no data” and when I do a power reset it gives me a two-tone beep.

I am really confused about what does that beep mean and why isn’t it working correctly. I did try two different sketches but neither of them worked.

How can I command my Roomba to go into clean mode using my Wemos D1 mini?

EDIT: sorry for forgetting to add the links of the sketches I tried. The MQTT one is from a Youtuber called The Hook Up here is his GitHub The second one I saw while searching on why it wasn’t working, so here is that one. Also, I was trying to upload this one but I was getting a compiling error so I didn’t test it.
Also, I didn’t find anything about the error beep the Roomba is giving me. The closest thing I get while searching for it is the list of error codes and beeps but it doesn’t say anything for only 2 beeps and no voice message. I also totally forgot to mention that when I connect my Roomba with a serial adapter, open Termite(a serial terminal) and then press the clean button I get the following response

Termite

this tells me that there is a high chance that there is OI support in my Roomba.

I also tried using Python as Austin suggested but still, no luck
here is my code if you can find some sort of mistake I did ?

import serial
ser = serial.Serial("COM7", 115200) # open serial port
print(ser.name) # check which port was really used
ser.write(bytearray([128, 131, 135]))
print ("commands sent")

One Answer

Your code looks good, the device is probably sending you back bytes so you need to read them on the port. Adding to what you have, it would look something like this:

import serial
import time

ser = serial.Serial("COM7", 115200) # open serial port
print(ser.name) # check which port was really used
ser.write(bytearray([128, 131, 135]))
print ("commands sent")

start_time = time.time()
while time.time()-start_time < 10:
    if ser.inWaiting() > 0:
        incomming_byte = ser.read()
        print(incomming_byte),      #Prints bytes interpreted as ascii/char values
        #print(ord(incomming_byte)) #Prints bytes interpreted as decimal values

ser.close()

This will loop for 10 seconds checking to see if any bytes are in the serial buffer, and if there is, then it will read the bytes. The comma after the print statement should print all the bytes on the same line as opposed to on multiple new lines. The second print statement is commented out so it wont run, but I put it there in case you wanted to get decimal values back.

Answered by AustinTronics on January 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP