I’ve always loved software that can effect the “real world” and robotics does that in a great way. I figured it was time to dip my toe in the realm, so for the Holidays I decided I wanted to build a robot. But I really didn’t want to have to do toooo much C / C++ programming. I’ve been spoiled by Ruby and I wanted to do more Clojure. It seemed that finally there were low cost computer boards like the Raspberry Pi and BeagleBone that would make that feasible though I might still use an Arduino based system for low level stuff.
I spent a lot of time looking at the various kits trying to understand the differences and advantages / disadvantages between them. This included going to some local Robotics Meetups like the Silicon Valley Robotics and the HomeBrew Robotics Club. In the end I decided on a platform made by DFRobots. It was now too late to order one online so I got the J-Bot V2 from Jameco mainly because Jameco is near my work and I could go pick it up. This is based on the DFRobot 4WD Mobile Platform which comes with an Arduino clone and an embeded Motor Controller calle Romeo. This kit includes 4 DC Motors with gearboxes, an Ultrasonic rangefinder mounted on a server so it can scan 180 degrees.
Putting the kit together was pretty easy. The only soldering was to solder wires to the motors. The rest was like putting together a desktop PC, just screwing things together. The sample test code that Jameco supplied (which is basically the same code as DFRobots ships) worked with no problem, but the code to make it autonomous turned out to be based on the V1 version of the J-Bot which used a standard Arduino and the Adafruit Motor Shield and thus uses the AFMotor library. Though the Romeo uses a roughly similar H-Bridge chip design, its different enough that the code doesn’t work as is. So this meant I had to immediately dive into C and C++ code AND the schematics to figure out what the differences were. Well I did want to learn about this stuff, so there I went.
Here are some things I discovered so far: (This is preliminary and some assumptions may be wrong)
- The Romeo has only 2 independent motor drive outputs (a single L298SO H-Bridge Driver). So this kit has the two left motors controlled by one output and the two right motors controlled by the other.
- The Romeo uses 4 Arduino digital pins to control the L298SO Dual H-Bridge and 2 motors. For each motor, one pin goes thru a a pair of nan-gates to control the two pins on the L298 to set the direction and the other pin is the output of the PWM to drive the enable and thus control the speed
- The Adafruit Motor Shield uses 4 Arduino digital pins to drive a 74HCT595N shift register. This allows the shield to map 4 pins to control the 4 motors
Thus one can’t just take the AFMotor library and use it with the Romeo. And all the examples I can find for the Romeo motor control are splats of linear C code with no Library or Object Orientation. So I’ve been trying to decide if I should modify the AFMotor Library which is object oriented and an Arduino Library and make a version that is RomeoMotor and try to keep the same interfaces or do something different. I was surprised that I could not find a motor control meta object or template or whatever its called in C++.
I did find a pretty good tutorial on the AFMotor:
That’s it for now.