Need help communicating via serial to iRobot Create

Started by daanmeym August 4, 2008
Greetings,

This is my first post here so please be gentle.

I'm trying to control my iRobot Create (www.irobot.com/create) with
my BasicX BX-24 and I'm not having any luck at all.

I am trying to use COM3 to send some simple commands to the iRobot
(start etc.). Here's my setup...

Wiring:
I am powering my BX from the regulated 5V output from the iRobot.
(iRobot pin8 to BX pin 21).
I have BX pin 9 wired to iRobot pin1 (0 5V Serial input to Create)
I have BX pin 23 wired to iRobot pin 14 (GND)
(I also have BX pins 1-4 hooked up to my PC serial cable as usual)

Code:
Option Explicit
Private Const InputBufferSize As Integer = 64
Private Const OutputBufferSize As Integer = 64
Private InputBuffer(1 To InputBufferSize) As Byte
Private OutputBuffer(1 To OutputBufferSize) As Byte

Public Sub Main()
Call Delay(5.0)
Debug.Print "Begin"
Call DefineCom3(11, 9, bx1000_1000)
Call OpenQueue(InputBuffer, InputBufferSize)
Call OpenQueue(OutputBuffer, OutputBufferSize)
Call OpenCom(3, 19200, InputBuffer, OutputBuffer)

' Try writing the start code to the IRobot Create
Dim Value As Byte
Do
Value = 128
Call PutQueue(OutputBuffer, Value, 1)
Call Delay(0.2)
Value = 131
Call PutQueue(OutputBuffer, Value, 1)
Call Delay(0.2)
Value = 135
Call PutQueue(OutputBuffer, Value, 1)
Call Delay(3.0)
Loop

Debug.Print "Done"

End Sub

As you can see, I have defined com3 and opened up pin 9 for output at
19200 baud. I am sending the following bytes:
128 ("start" code which should make the iRobot beep)
131 ("safe" code which puts the robot into safe mode)
135 ("cover" code which makes the robot start driving around)

Result:
The iRobot does not respond at all. It does not beep when it gets
the 128 and it does not start driving around.

Troubleshooting:
I've verified that the bytes are indeed being sent from the BX at
19200 baud by hooking these same pins to my PC serial cable and
running Realterm to listen to the port.
I've verified that sending these same bytes to the iRobot at 19200
baud from my PC works (through the special iRobot serial cable that
voltage shifts the signal down to 5v)
I've made sure to always boot the iRobot into 19200 mode (hold down
the play button for 4 seconds on bootup)

Anyone have any ideas what my problem could be? Or, if anyone knows
someone who's accomplished this, I'd appreciate pointing me in their
direction.

Thanks folks.
Seems like you've done all the right things as far as the programming
and troubleshooting go. One thing I can suggest is that you try sending
a non-inverted signal rather than the inverted one.

"Call DefineCom3(11, 9, bx0000_1000)"

I'm guessing that the 'special cable' converts the voltage from the PC
at RS232 levels to TTL levels for the iRobot which are apparently 0-5V
and *usually* not-inverted at those levels. Regardless, can't/won't hurt
anything, if you try it.

Cheers,

Lauren
Result:
The iRobot does not respond at all. It does not beep when it gets
the 128 and it does not start driving around.

Troubleshooting:
I've verified that the bytes are indeed being sent from the BX at
19200 baud by hooking these same pins to my PC serial cable and
running Realterm to listen to the port.
I've verified that sending these same bytes to the iRobot at 19200
baud from my PC works (through the special iRobot serial cable that
voltage shifts the signal down to 5v)
I've made sure to always boot the iRobot into 19200 mode (hold down
the play button for 4 seconds on bootup)

Anyone have any ideas what my problem could be? Or, if anyone knows
someone who's accomplished this, I'd appreciate pointing me in their
direction.