# iRobot Create 2 and Open Interface 2 Spec not syncing up with incoming data

I have the create 2 and have it hooked up to an arduino. Almost all the commands work fine except when retrieving sensor information. If i send a request for packet 18 I get back values that while consistent don't match up, unless I am missing something. So if I press the clean button I get 127 or 11111110 and if i then press spot I get something like 11111010. I might be messing up my endianness but regardless the data isnt formatted how I expected it to be according to the spec sheet. I have 3 create 2s and they all do the same thing. Any ideas? I am using a 2n7000 along with the tutorial from the site but i dont think that has anything to do with the formatting of the byte.

this is the library I am using: https://github.com/DomAmato/Create2

Sorry to take so long to get back on this, anyways the data we get is always formatted this way. It is not a baud rate issue since it understands the commands properly.

        day     hour    minute  schedule    clock   dock    spot    clean
day     3       x       x       x           x       x       x       x
hour    6       7       x       x           x       x       x       x
minute  13      14      15      x           x       x       x       x
schedule    x   x       x       x           x       x       x       x
clock   x       x       x       x           x       x       x       x
dock    27      29      30      x           x       31      x       x
spot    55      59      61      x           x       62      63      x
clean   111     119     123     x           x       125     126     127


Note that the schedule and clock buttons return nothing

• Are you absolutely sure that it was Spot and Clean that produced 11111010? That combination should return 3, or if your bits were somehow inverted, 11111100. Were you perhaps pressing Dock instead of Spot? Feb 27, 2015 at 17:08
• I will check again for the certain buttons and make a list of the output when I have a chance Mar 1, 2015 at 20:56
• Hi @Betty_Brinn_Museum, if both of these accounts are yours (and use the same e-mail address) you can use the "contact us" link to request that the accounts be merged. That way reputation from the original account (which you have presumably lost access to) will be added to your new account. Take care, Mar 25, 2015 at 16:36
• I don't understand this table. What are the row headings, and what are the column headings? Mar 26, 2015 at 13:11
• I just had a thought as to what might be wrong. At what voltage is your Arduino running? I am curious to know why you used an 2N7000 (NFET) and not a 2N4403 (PNP BJT). Using the wrong part in the right schematic (or vice versa) will cause an inversion in the signal, or other weirdness. Can you post a picture or a schematic of how you have everything hooked up, exactly? I think there may be a problem with the electrons between the Arduino and the Create 2. If you look at the "Arduino Tutorial" vs the "Create® 2 Serial to 3.3V Logic" projects, you'll see that the schematic is different. Mar 26, 2015 at 13:27

The problem was the part we were using. Make sure you use the right transistor. The schedule and clock button still dont produce any output but everything else behaves as it should.

Error = 2n7000 transistor

Thanks to Steve for pointing it out though it doesn't just invert the signal it mutates it into the table I posted in my question.

If that example code you posted is what you are running, then I don't think you are using the right baud rate. The Create2 uses 115200 baud by default. But the Arduino cannot reliably reproduce this baud, so it is recommended to open the port at 115200, then change the baud down to 19200 for the rest of the comms. I don't believe this change survives across power cycles.

• Baud rate does not persist between resets or "hard" power cycles but it does persist between "soft" power cycles, as far as I'm aware. Feb 27, 2015 at 16:16
• It's not a baud rate issue, if it was a baud rate problem none of the commands would work including the packet request. It is set to 19200. Mar 1, 2015 at 20:55

Without seeing your code and your hardware setup, I'm not sure how much help I can be, but I'll try! The light painting project on the iRobot site has a sketch which monitors the buttons without using a third party library. The function is called waitForButton. I'd encourage you to grab that function in a separate sketch (not forgetting the setup code for the robot in the original sketch) and see if you can get the buttons to work for you. If they work, it's a problem with your code or the third party library.

I don't have an Arduino to play with right now, but using a USB to Create cable with Python on my laptop, I threw this together for you to test your robots:

#!/usr/bin/env python
# 27 February 2015
# Steven Shamlian
# Released under Poul-Henning Kamp's Beerware license

# A quick and _dirty_ script to test button reads.

import serial, time
COM_PORT = "COM37" # be sure to change this

ser = serial.Serial(port=COM_PORT, baudrate=115200)

print "Resetting..."
ser.write('\x07') # put the robot in a known state
for i in reversed(range(10)):
print i,
time.sleep(1)
print
ser.write('\x80\x83') # put the robot in safe mode
time.sleep(0.1)

ser.flushInput() # discard everything we've seen so far

print "Press Ctrl+C to quit."

try:
while True:
ser.write('\x8e\x12') # request buttons