This post is a follows from an earlier post (iRobot Create 2: Angle Measurement). I have been trying to use the wheel encoders to calculate the angle of the Create 2. I am using an Arduino Uno to interface with the robot.

I use the following code to obtain the encoder values. A serial monitor is used to view the encoder counts.

void updateSensors() {
  Roomba.write(byte(149)); // request encoder counts
  delay(100); // wait for sensors 
  int i=0;
  while(Roomba.available()) {
    sensorbytes[i++] = Roomba.read();  //read values into signed char array

  //merge upper and lower bytes
  right_encoder=(int)(sensorbytes[2] << 8)|(int)(sensorbytes[3]&0xFF);
  left_encoder=int((sensorbytes[0] << 8))|(int(sensorbytes[1])&0xFF);


The code above prints out the encoder counts; however, when the wheels are spun backwards, the count increases and will never decrement. Tethered connection to the Create 2 using RealTerm exhibits the same behavior; this suggests that the encoders do not keep track of the direction of the spin. Is this true?


1 Answer 1


This is true. The encoders on the Create are square-wave, not quadrature. Therefore, they rely on the commanded direction to figure out which way the wheel is spinning. When driving forward, they count up, and when driving backward they count down as expected. But if you move the wheel when the robot is not moving, or move the wheel opposite the commanded direction, you will get incorrect results. The latest OI Spec available at www.irobot.com/create has a small discussion of this in the section for Opcode 43 on page 30. This was only recently updated, and contains a number of notes regarding gotchas like this. So you may want to re-download.

  • $\begingroup$ Thanks for the confirmation. This seems like a serious limitation of the Create 2. Are there any solutions to the situation when the robot wheels are moved by an external force? Without better sensors, I can't think of a way to close the loop for control of the Create 2. $\endgroup$
    – JSycamore
    May 13, 2015 at 20:29
  • $\begingroup$ Well, as long as the robot is driving itself around, you won't notice the issue. $\endgroup$
    – Ben
    May 14, 2015 at 2:11
  • $\begingroup$ That is an excellent point that I didn't get until I read your comment in another post (robotics.stackexchange.com/questions/7251/…). I didn't realize that the encoder count was different when the wheels were driven rather than pushed. Thanks for your help. $\endgroup$
    – JSycamore
    May 14, 2015 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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