Question
Asked January 8 2015

Community Question

Hi guys.

I am currently looking at a Roomba IRobot 530 on a popular auction site I want to get. I don't wish to appear rude but I need some quick advice before I place a bid, as the clock is ticking. *eek*

Does the 530 have a comms port to connect the EZ-B4?

Is the 530 compatible with the EZ-B4?

I've never had a robot vac so it's all new to me. I know DJ does reference the iRobot but there's no mention on models.

Cheers. :)

User-inserted image
March 18 2015
Okay, so a bit of an update.

I wrote a init script for "Safe Mode" and took the Roomba for a little drive to see if the sensors took over when it hit, or was going to hit a wall. It didn't. In my eyes, it was no different to "Full mode". I had control of it, but driving it off a work bench or bumping it in to walls didn't activate any of the safety features which according to the PDF doc, it was supposed to.

Next I tried to script the "Cliff sensors" with pretty good results. here's the code...

Code:

REPEATUNTIL(1=2)
uartWrite(0,1,142,9) # cliff left
sleep(5)

uartWrite(0,1,142,10) # cliff front left
sleep(5)

uartWrite(0,1,142,11) # cliff front right
sleep(5)

uartWrite(0,1,142,12) # cliff front right
sleep(5)

uartWrite(0,1,142,58) # Motor Stasis
sleep(5)

$x = UartAvailable(0, 1)
IF ($x>5)

# print("Bytes in buffer: " + $x) checks how many bytes are in the buffer

$RX_DATA = UARTRead(0, 1, $x) #places all the bytes RX into $RX_DATA

$RX_0=GetByteAt($RX_DATA,0)
$RX_1=GetByteAt($RX_DATA,1)
$RX_2=GetByteAt($RX_DATA,2)
$RX_3=GetByteAt($RX_DATA,3)
$RX_4=GetByteAt($RX_DATA,4)
ENDIF
IF ($RX_0!=0 or $RX_1!=0)
uartWrite(0,1,137,255,100,128,0)
sleep(2000)
uartWrite(0,1,137,0,0,0,0) #stop Roomba

ENDIF


print($RX_0+" cliff left")
print($RX_1+" cliff f left")
print($RX_2+" cliff f right")
print($RX_3+" cliff right")
print($RX_4+" stasis")

sleep(100)
ENDREPEATUNTIL


It works fairly well, but I'm not sure I 100% trust it though. Most of the time it will stop and reverse back before it reaches the edge, but a few occasions the caster went over the edge but rescued itself before I intervened. I do have a slight issue with it though... When it stops and reverses back for 2 seconds, it wants to reverse again. Have I missed something in the script?

After that, I had a play around getting the "Light touch" sensors working. I managed to put a script together that when it detects a wall, the speed reduces to a very slow crawl which works, but I have a few issues with it...

1) It detects walls and objects that are not even close to the Roomba which triggers the crawl speed). Is there a way to reduce the detection distance the Roomba receives, much like you can with a ping sensor?

2) When I start the script, 50% of the time the Roomba will take off on it's own without me pressing a forwards control. I guess its because of what I mentioned above in point 1, but don't know how to write a script to get around it.

3) Now this is probably due to my scripting skills (lol, or lack of), but I wrote it so when it detects a wall it will slow down, then when it hits the wall, the "Bump and wheel drop" sensors trigger the bumper sensors and stops the Roomba in it's tracks... but it doesn't and the motors continue to turn until I kill the script and press a STOP control. here's the script...

Code:

REPEATUNTIL(1=2)
uartWrite(0,1,142,45,46,47,48,49,50,51,) # soft bump sensors
sleep(10)

uartWrite(0,1,142,7) # Bump detection
sleep(10)

uartWrite(0,1,142,58) # Motor Stasis when going forwards
sleep(10)




$x = UartAvailable(0, 1)
IF ($x>3)

# print("Bytes in buffer: " + $x) checks how many bytes are in the buffer

$RX_DATA = UARTRead(0, 1, $x) #places all the bytes RX into $RX_DATA

$RX_0=GetByteAt($RX_DATA,0)
$RX_1=GetByteAt($RX_DATA,1)
$RX_2=GetByteAt($RX_DATA,2)


ENDIF
IF ($RX_0!=0 or $RX_1!=0)
uartWrite(0,1,137,0,100,128,0) #forward very slow

ELSEIF ($RX_0!=0 or $RX_1!=0)
Uartwrite(0,1,137,0,0,0,0) # Stops forward movement

ENDIF


print($RX_0+" Wall detected") various values depending on which IR was triggered
print($RX_1+" wheels stopped") 0, 1, 2, 3 depending on where the Roomba bumped

sleep(250)
ENDREPEATUNTIL


I'm a lot closer to where I want to be with this, but obviously still got some bugs to iron out, so I'd appreciate if you could tell me where I went wrong with my scripts.

Thanks. :)
March 18 2015
@Steve... This won't work...
uartWrite(0,1,142,45,46,47,48,49,50,51,) # soft bump sensors
You can only make only one call at a time for a sensor...
Single byte returns like bump sensors are pretty simple but you can only ask for the data one packet at a time...
uartWrite(0,1,142,45) #one sensor packet call at a time (single byte)

Some are 2 byte returns so see my voltage script to see how to read 2 byte returns....

To be honest, what I have given you is all I have looked into with the Roomba.... I would have to spend more time to see what else I can do... But this is it for now
March 18 2015
@Richard.

Okay buddy. No problem, thanks good to know. Thanks anyway. What if I broke it down to separate uartWrite commands like I did with the cliff sensors script. Would that make a difference, or would that still read as multiple bytes?
March 18 2015
You can break them down into multiple writes... each write has to have a corresponding read from the buffer... If you have 3 writes to various sensors you would get 3 bytes in the buffer so 3 reads... 4 writes and then 4 reads from the buffer etc... This is only if you are reading sensors that return only 1 byte... As mentioned 2 byte reads are more complicated... So far the only 2 byte read that I have working is the voltage check...
March 18 2015
Right gotcha. I'll have a look and your voltage check script and see if I can adapt it to the light touch sensors. Thanks again. :)