Death by serial problems. Help!!
I swear, nothing has confused or urked me ask much as thus problem I am having right now, trying to get a microcontroller to communicate with an iRobot Roomba. So basically, I have noticed that my BS2 CAN receive sensor data from the Roomba, but neither my PC nor my other microcontroller I'm familiar with, the Arduino as it is called, are able to receive the sensor data packet. I have tried to shed light on this on and off for over a year, and I've picked it up again, hopefully to solve it once and for all.
Tod E. Kurt published a book called "Hacking Roomba' a while back. I was pretty intrigued about the whole Roomba as a developer's toold idea, and so I decided to get one to start working on. I made the 'roomba serial tether' from the book, so I can hook up the roomba to my PC, and I also made the cable that can be used to hook into any microcontroller capable of controlling the Roomba. The problem has been receiving sensor data from the Roomba; I just can't pull it off. I even tried using the BS2 and Arduinos in a master-slave configuration (because I knew that for some reason, at least the BS2 was able to get the sensor data, so I figured "why not use the BS2 to get sensor data, and use the Arduino for the dirty work..."), but that didn't work for some odd reason. I saw this post HERE on that, but I can't seem to get the gist of it (the timing is tricky even at 2400bps; I know I have to use the WAIT, SERIN, SEROUT commands etc.).
I may have even posted here about this before, but if I did, it has never been resolved. This post has additional information on things I've already tried; if you can, please read that; it'll make more sense out of this!
Thanks for all your support.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Tod E. Kurt published a book called "Hacking Roomba' a while back. I was pretty intrigued about the whole Roomba as a developer's toold idea, and so I decided to get one to start working on. I made the 'roomba serial tether' from the book, so I can hook up the roomba to my PC, and I also made the cable that can be used to hook into any microcontroller capable of controlling the Roomba. The problem has been receiving sensor data from the Roomba; I just can't pull it off. I even tried using the BS2 and Arduinos in a master-slave configuration (because I knew that for some reason, at least the BS2 was able to get the sensor data, so I figured "why not use the BS2 to get sensor data, and use the Arduino for the dirty work..."), but that didn't work for some odd reason. I saw this post HERE on that, but I can't seem to get the gist of it (the timing is tricky even at 2400bps; I know I have to use the WAIT, SERIN, SEROUT commands etc.).
I may have even posted here about this before, but if I did, it has never been resolved. This post has additional information on things I've already tried; if you can, please read that; it'll make more sense out of this!
Thanks for all your support.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Comments
If you would like more specific support, you really have to give more details about what you know, what you've tried, what has worked, and what has not. I know you've touched on that, but it's really very sketchy. There's an art to telling a story to capture someone else's imagination. You have to flesh out the story, hang some meat on those bones.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"THE ONLY TRUE WISDOM IS IN KNOWING YOU KNOW NOTHING." - SOCRATES
So, as far as what I have TRIED, here goes:
I have hooked up my BS2 to the roomba, uploaded the 'bumpturn' code (from the book or http://hackingroomba.com/), and ran it; it worked. Then I have tried interfacing my arduino (ATmega168 on the 'Arduino' carrier board) to the roomba, and running the 'bumpturn' code written for the arduino, which does NOT work. The arduino IS able to send the roomba commands, but ISN'T able to receive sensor data from the roomba. Ergo, the 'bumpturn' code is more like 'bump&die' if you know what I mean. So, I tried to fiddle with the code to see what might fix the problem. I don't want to have to re-type the details on the code I fiddled with & the discoveries I made by doing so, so here's the directly copied post I posted in another forum about it:
More specifically, what I noticed about the behavior of the code, the error statement NEVER comes true, so the arduino IS seeing some serial data coming from the roomba (aka c is never = -1). I will also note it is EXTREMELY hard to debug what is going on in the code, due to the fact that unlike the BS2, the arduino only has two pins that it can use for serial communication, and they are BOTH being used when connected to the roomba; this isn't like an I2C interface.
It may also help if you look in that forum (HERE) about this issue, because there's something that this guy posted there about there being a problem with the 'transistors on the RX and TX pins of the Arduino interfering with communication' or something along those lines.
Let's NOT focus on bringing the BS2 with the master/slave config. into the equation UNLESS you think that it would be easier to do so. Again, the reason why I wanted to do that in the first place is because I knew that the BS2 was already able to receive the data from the roomba, and so I could just use it as a slave w/ the arduino, and have it send the data to the arduino when called upon. Anyone with a good programming background in C (or a combination of C-based languages) should be able to help me try to troubleshoot getting the arduino to receive the sensor data from the roomba...
Another stab I took at it was I thought maybe I had done something terrible wrong that had destroyed the roomba's TX pin. I will note that I have NOT been able, with ANY program (be it hyperterminal, roombacomm, roomba status, etc.) to receive the sensor data...maybe it's a coincidence, I don't know, but I DO know that the BS2 can receive the sensor packet, which boggles my mind...
I hope that clears things up a bit.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
You don't know if the problem is that the Roomba is sending the data incorrectly (or not at all) or that the uC is not getting it correctly.
Correct? If so, an oscilloscope would be very handy. Simply hook it up and see what shows on the screen. You may be able to get away with an LED and watch for flashes. Another thought is to have the uC watch for a pin state. If it changes, you can (possibly) assume that data is being sent. Also, if this is an Arduino question, their forums can probably answer better any uC specific problems.
UPDATE: I used hyperterminal, and my PC successfully received serial information from the roomba, so at least I know that it doesn't have to do with
a) the RS232-TTL cable I made
b) my PC; it must have to do with the programs I was using/the configuration.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Post Edited (NoBo780) : 11/29/2008 5:19:03 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Post Edited (NoBo780) : 12/1/2008 2:31:38 AM GMT
Serial communication with the BASIC Stamp is pretty straight forward. I’m sorry that is not the case with your other microcontroller. Perhaps they have a support forum that can help you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
When you are communicating to a serial accessory via the BASIC Stamp you are using a fixed communication protocol specified in the accessory datasheet. Conversely, when you are communicating with another microcontroller, there is no defined or fixed protocol. You define it. You become responsible for defining the way these two devices will communicate with the code on each unit.
When talking to an accessory or peripheral device/chip you are sending/receiving bytes defined by the device datasheet using the specified protocol. You don’t have to write code on the target device to establish communication. Conversely when talking to another microcontroller you need to know the language of the target device in order to program it. You also need to know the architecture of the device as it may or may not have specific hardware designed for this communication and that may require additional programming considerations.
This is why we have to defer issues regarding other microcontrollers to their own support forums. This way there are people there who know this information and can offer the proper assistance. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
If you don't like that, then you could do two general types of communication: synchronous or asynchronous. I have no idea which is supported by the ardruino, but those are your choices (not including tm'd protocols like I2C and OneWire)
By the way, did you hear about the Carniverous Robots? Do a Google Search. This was one of the coolest ideas ever. I am going to intergrate this into the robot I am working on now. It is way to cool not to include it.
Good Luck!··
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!