5
$\begingroup$

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")
$\endgroup$
6
  • $\begingroup$ what information have you found about the two-tone beep? $\endgroup$
    – jsotola
    Jun 4, 2019 at 19:01
  • 1
    $\begingroup$ I have edited the question you guys asked for. thanks a lot for letting me know. Also, I was wondering if I should call Irobot and maybe they might help. what do you guys think? And most of the people said that it's my Roomba's fault because theirs are working fine. $\endgroup$ Jun 6, 2019 at 4:17
  • $\begingroup$ The serial terminal your using is representing the numbers as ASCII characters, which means typing 128 is actually sending bytes 49, 50, and 56. Why not try doing this in Python with the pyserial library, this will only be a few lines of code. Import serial, make the serial object (ser = serial.Serial("COM#", <baud_rate>), then do a ser.write(bytearray([128, 131, 135]). $\endgroup$ Jun 6, 2019 at 15:43
  • $\begingroup$ I don't know much about python. If you can show me an example file that will be great. until then I will try to do it myself and give the results I get $\endgroup$ Jun 6, 2019 at 18:55
  • $\begingroup$ Hello @AustinTronics I tried using python and still no luck I posted my code in the question $\endgroup$ Jun 7, 2019 at 4:11

1 Answer 1

2
$\begingroup$

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.

$\endgroup$
15
  • $\begingroup$ Great! I tried your script and it returned the following. b'\x80' b'\x83' b'\x87' Now I don't know what this means. Any info on what to do next? $\endgroup$ Jun 7, 2019 at 18:33
  • $\begingroup$ Researched a bit and found out that is in Hex so I converted it to decimal and it returned 128 131 135. It seems like its replying back the same thing we sent. I tried other commands like getting the battery and such but it replied with the same bytes that we sent. Odd 🤔 $\endgroup$ Jun 7, 2019 at 18:47
  • $\begingroup$ That is odd. Try sending random bytes that arn't commands and see if you get those back. I also wonder if there are any commands that turn on an LED or makes the device have any physical change where you can visually inspect that it's working. $\endgroup$ Jun 7, 2019 at 18:56
  • $\begingroup$ tried to send commands that are not listed in the OI PDF and it returned with an 'n'. when I press buttons on the Roomba it gives me a message saying 'bbox vars saved'. there are commands for controlling the LEDs and I sent the commands but the same behaviour persists. If you want the OI sheet here you go. irobot.lv/uploaded_files/File/… $\endgroup$ Jun 8, 2019 at 0:37
  • $\begingroup$ Try separating the commands. One command per bytearray. Don't try sending the commands all at once in one bytearray. Also wait a second between each command to give the device enough time to react. So bytearray([128]) followed by a time.sleep(1) followed by a bytearray([131]) followed by another time.sleep(1), etc... $\endgroup$ Jun 8, 2019 at 0:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.