Over the past month since I bought iRobot Create 2, I have failed to establish communication between the Arduino and iRobot Create 2. I will describe my hardware setup and my Arduino code, then ask several questions that would help future projects as well.
Hardware Setup: The iRobot Create 2 is connected with the Arduino based on the connection provided in pdf document at this link - https://edu.irobot.com/learning-library/controlling-create-2-with-arduino-and-android.
Software Setup: Following is a very basic code that I am using in my Arduino.
#include <SoftwareSerial.h>
int rxPin = 10; //connected to pin 4 (TXD) of iRobot based on above document
int txPin = 11; //connected to pin 3 (RXD) of iRobot based on above document
int ddPin = 5; //connected to pin 5 (BRC) of iRobot
//Set up a new Software Serial Port
SoftwareSerial softSerial = SoftwareSerial(rxPin, txPin);
void setup() {
// Defining PinModes
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(ddPin, OUTPUT);
softSerial.begin(19200);
// Change the BAUD Rate/Waking up
digitalWrite(ddPin, HIGH);
delay(100);
digitalWrite(ddPin, LOW);
delay(500);
digitalWrite(ddPin, HIGH);
delay(2000);
// Start Command
softSerial.write(128); //Starts the OI
// Mode Command - Passive, Safe, Full
softSerial.write(131); //Set mode to Safe
}
void loop() {
// put your main code here, to run repeatedly:
Serial.write(145); //Serial.print(137, BYTE);
Serial.write(0x00);
Serial.write(0xc8);
Serial.write(0x00);
Serial.write(0x01);
}
How I am deploying it ?
I burn the above code into my Arduino using my laptop (Mac Pro). It compiles and burns fine without any issue. Then I disconnect the Arduino from my laptop and connect the Arduino using Jumper Wires to iRobot Mini DIN as following -
Pin 10 of Arduino -> Pin 4 of iRobot;
Pin 11 of Arduino -> Pin 3 of iRobot;
Pin 5 of Arduino -> Pin 5 of iRobot;
GND of Arduino -> Pin 6 of iRobot;
Vin of Arduino -> Pin 1 of iRobot
Observations
- When I connect the GND of Arduino to iRobot Pin 6, iRobot gets active - Green light
- Create 2 doesn't move at all OR No Reaction.
Questions
I am unsure if the bot is communicating at 19200 Baud Rate ? In the above code, I believe that the code is wrong and maybe that's the problem.
What could possibly be any other problems ?
What is the correct way to set up the Baud Rate ? I do not clearly understand the documentation for Baud Rate for the Method 2 ? How do you execute Method 2 on Arduino ?