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

Answers 3

  • 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

    Answer = 2n4403

    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.


  • 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
            print "Got " + hex(ord(ser.read()))
            time.sleep(0.25)
    except:
        pass
    
    ser.close()
    

Related Questions