# iRobot Create 2 - How did I get weird data from the serial port?

I'm new to Roomba Create2.

I just want the program to send and receive data of the bumper sensor only.

I tried this code on an Arduino Uno:

#include <SoftwareSerial.h>
#include "roombaDefines.h"
int rxPin = 10;
int txPin = 11;
int sensorbytes;
SoftwareSerial Roomba(rxPin, txPin);
void setup()
{
Roomba.begin(19200);
Serial.begin(9600);
pinMode(ddPin, OUTPUT);
wakeUp ();   // Wake-up Roomba
startSafe(); // Start Roomba in Safe Mode
setPowerLED(128, 255);
delay(1000);
setPowerLED(128, 0);
delay(1000);
}
void loop()
{
Roomba.write(142);
Roomba.write(7);
delay(100);
sensorbytes = Roomba.read();

if (sensorbytes!=0 )
{
setPowerLED(255,255);
Serial.println(sensorbytes);
}
else
{
setPowerLED(255,0);
Serial.println("not_Press");
}
delay(100);
}


The robot code works fine for a period of time but after about two minutes I got some weird data from the robot (it shows in my serial monitor) and it makes my program seem to delay and crash.

So I tried to check where it comes from

void loop()
{

int i = 0;

while(Roomba.available() ) {
byte c = Roomba.read();
sensorbytes = c;
Serial.println(sensorbytes);
i++;
}
delay(150);
}


to check that the robot sends data via the serial port or not. Even if I don't command it, I get a packet of data, maybe every two minutes:

32
32
32
32
70
108
97
115
104
32
67
82
67
32
115
117
99
148
205
205
233
32
48
120
48
32
40
48
120
48
41
10
13


and it is the same. So I think that the Roomba Create2 will send data via the serial port every two minutes.

Can I avoid that data?

• can i avoid that data ?? ... it is unclear what you are asking ..... are you asking how to stop roomba from sending it? – jsotola Jul 14 '18 at 19:06
• decimal 32 is ascii space and decimal 10 and 13 is ascii newline and carriage return ............. put the values into a single string 32 32 32 32 70 108 97 115 104 32 67 82 67 32 115 117 99 148 205 205 233 32 48 120 48 32 40 48 120 48 41 10 13 ............... then convert to ASCII at a site like this on branah.com/ascii-converter ............. the result is this . Flash CRC suc ÍÍé 0x0 (0x0) ...... it looks like a part of a response to a command – jsotola Jul 14 '18 at 19:14
• Thank you for your reply for my understanding if i did not send command to roomba it should not send me back the data right ? but i get this data even i i didnt command it – user3505317 Jul 21 '18 at 11:57

## 1 Answer

You might want to take a look at the iRobot Create 2 OI spec https://www.irobotweb.com/~/media/MainSite/PDFs/About/STEM/Create/iRobot_Roomba_600_Open_Interface_Spec.pdf

I'm using a different controller so I can't test your code. Just be sure you are set for 115,200 baud.

You might also want to try sending a 128,7 command to fully reset the Create 2 before starting to send your 142,7 sensor read command which should only return a single byte on every command

You might also want to send the recommended "start" command