Posts Tagged ‘serial’
Friday Night Robotics – iRobot Gearing?
This is actually from last Friday, August 28th!
I recently ‘inherited’ an iRobot Create. It’s a Roomba, but without a vacuum, and made specifically for hobby robotics.

Getting it to work with an Arduino was excruciatingly hard at first. It does come with a controller on board, but the instructions for that were more sparse than just using plain serial commands. Or, maybe I misread them and they are the same things…
In any case, I used the DIN connector to connect to the Arduino so that it can send and receive commands, as well as be powered by the iRobot!



Sending commands to the iRobot is interesting… you start off with a number from -500 to 500 in mm/s, then…
1. Take the absolute value
2. Convert this to a hexadecimal number
3. Split the hex into two
4. Add a sign bit infront of the first part
5. Convert the two parts into bytes
This works very well for 500 mm/s and -500 mm/s.
However, when trying it with -100mm/s and 100mm/s, the -100mm/s goes faster than the 100mm/s!
I believe this is the code where we got the -100mm/s to be almost the same, even though it made no mathematical sense…
-
Serial.print(145, BYTE);
-
delay(50);
-
Serial.print(1, BYTE);
-
delay(50);
-
Serial.print(244, BYTE);
-
delay(50);
-
Serial.print(1, BYTE);
-
delay(50);
-
Serial.print(244, BYTE);
-
delay(50);
-
-
delay(5000);
-
-
Serial.print(145, BYTE);
-
delay(50);
-
Serial.print(241, BYTE);
-
delay(50);
-
Serial.print(244, BYTE);
-
delay(50);
-
Serial.print(241, BYTE);
-
delay(50);
-
Serial.print(244, BYTE);
-
delay(50);
-
-
delay(5000);
The only thing we can think of is that the gearing of the wheels is different for driving backwards.
We’re going to keep playing with it, next time we’ll be seeing if we can get some sensor data from the bump and IR sensors!
RBBBs and Pololu SSCs
I received the two RBBB’s, 1 FTDI TTL USB cable, and two Pololu Serial Servo Controllers (SSC) I bought a few weeks ago.
Since then… I’ve been tinkering with them quite a bunch. I learned an incredible amount too from just a tiny board!
Building up the RBBB wasn’t too hard. At first, I printed off the wrong ‘instructions’ – which mind boggled me a bit until I noticed that they were indeed wrong. Once I had the right instructions printed… it was more simple. I was worried about the polarity of the bigger capacitors.
After I had it all finished… I went and looked up the FTDI-USB cable specs. This cable is pretty interesting if you think about it, 1 wire turns into 6 more colourful wires
-Gnd, CTS (clear to send), +5V, TX, RX, RTS (request to send). I downloaded the Blink program without any problems… until I wanted to test it. The LED wasn’t blinking! After about 5 minutes of intense thought, I realized that there was no LED on pin 13. That was a stupid mistake!
Another stupid mistake, but this one is funnier, was when I was trying to test the other RBBB.
… I forgot to put the chip into the IC socket. =D That really made me ‘lol’ for 10 minutes.
Then, I was trying to fit it into the breadboard… lets just say it took a longer than normal time.
When the Pololu SSCs showed up, I was pretty excited! Then when I saw them… they are REALLY tiny! It was a big challenge to solder these without them flying out of my hand. I don’t have a 3rd hand tool to hold it steady, so I would sometimes have to hold the ‘pinchy-things’ with my elbow and hold the solder and soldering iron with my hands.
The headers were extremely difficult too…
Getting the Pololu to work with the Arduino is pretty aggrivating. I think I’m almost there, I just have to switch the input to the logic level side as I was using the RS-232 one. I thought that the Arduino used RS-232 on its TX line, but it doesn’t. It uses a non-inverted logic level (er well, that’s at least what I read). Tomorrow I plan on looking up the difference between the two
Here are some pictures… I finally threw the desoldering pump out the window (joking) and bought solder wick. Also finally bought NON-LEAD SOLDER! =D
Other than playing with these, I’ve been flow-charting A LOT of AI programs, and learning more first-order predicate logic. I really like logic and the probabilities and Bayes and everything!!!!! Also having fun thinking about random and bell curves… More back-dated Stanford blog posts to come (so many photos hahah)!