Search This Blog

Monday, March 10, 2008

CMUCam2+ and Basic Atom arghh...


After several weeks of reading, experimentation, search, and more experimentation, the CMUCam2+ finally worked with the Basic Atom module. It even worked with the Basic Atom Pro module without any changes necessary. For those that have worked with both the Basic Atom and Basic Atom Pro, this concern will sound familiar - for those that have not, the problem is simply that the Basic Atom Pro chip is not based on a Microchip Pic as the Basic Atom is and thus it has different characteristics and quirks. Fortunately, none of those quirks surfaced in this case.
Shown is a view of the CMUCam 2+ board that is available from Acroname. Most of the information needed on this sensor can be obtained from either Acroname or Carnegie Mellon University. Carnegie Mellon University developed the technology that the CMUCam 2+ is based on and licenses it.

The first tip to getting the CMUCam2+ working with a Basic Atom module is to buy or build a RS232 to TTL interface to allow connecting the CMUCam 2+ to a computer. Acroname offers a RS232 to TTL interface, but Futurlec has a similar module for less than $5.00 as of 12/2007. The GUI for the CMUCam devices is invaluable and essentially required for focusing the lens and assessing the light levels needed for accurate detection. There are models of the CMUCam that include the RS232 interface, but they are a little bulkier.

Now connect the GND’s on the Basic Atom module or Atom Bot Board to the CMUCam2+ serial connector, ignore the 5V pin on the serial connector, and connect OUT on the serial connector to your IN input on the Basic Atom module and IN on the serial connector on the CMUCam2+ to OUT on the Basic Atom module.

The baud rate has to be 38400 or less on the Basic Atom for communications to be reliable. Using “I38400” provided the greatest speed that was reliable. The hardware port does not seem to work, even when using an interface chip.

It is crucial to use the following command to the CMUCam 2+ from the Basic Atom for communications to work: “DM 20”. This is a delay command that instructs the CMUCam 2+ to delay before starting a transmission. The DM command had to be “DM 100” for the Basic Atom Pro. The DM command MUST be issued after any RS command (reset) or communications will not work properly—even at lower baud rates.

Friday, February 15, 2008

Second Generation Schematic

The first generation of the Midnight Prowlerbot used bluetooth as a means of communication directly with the Atom Bot Board (and Basic Atom Pro), while the CMUCam2+ also communicated with the Basic Atom Pro. Polling bluetooth and the CMUCam2+ slowed down robot response more than I was willing to tolerate. By the way, the CMUCam2+ would work with the Basic Atom or Basic Atom Pro at a max of 38400 baud (I38400) with the CMUCam2+ using a delay (DM 10) - no settings worked without the delay and the hardware serial port did not work.

The resulting frustration turned the robot into the schematic shown above where two Atom Bot Boards are used to basically do multithreading. The one board handled motion while the other board handled sensors and video. The two ABB boards communicated with each other using serial but with a notifier input to allow programs to avoid even checking for serial input until it was actually available.

However, a drawback of this configuration is that using the video functions requires too much experimentation during programming since it isn't possible to actually see what the camera is seeing while programming.




Tuesday, February 12, 2008

Midnight Prowlerbot Control Description


The screenshot displays the main screen for the Midnight ProwlerBot Control program. Each of the buttons shown perform the same function as the corresponding buttons on the PS2 controller.

The Joysticks section simulates joystick action by using slidebars. The slidebars maintain their position so that the robot can be set walking in a direction without being held as would be done with a joystick. Since it can be difficult to slide all of the bars back to zero position quickly in the event that the robot is about to collide with something, a Stop button is provided that acts as an emergency stop for the robot.

The sensors section displays the direction that the robot is facing in degrees. For instance, it may display W=270, which would mean that the robot is facing west which is also 270 degrees.

Distances to objects are displayed in centimeters with the topmost object displaying the distance sensed by the ultrasonic sensor and the infrared sensor distance displayed below. Two types of sensors are used primarily because of expense. Ultrasonic sensors cost at least twice the price of a Sharp GP2D12 IR sensor.

The ultrasonic sensor is used for obstacle checking directly in front of the robot while IR sensors are used on either side of the robot. Currently, only one IR sensor is installed on the robot but a second IR sensor will soon be installed. By using IR sensors on the sides at approximately a 30 degree angle from center, it is possible to make sure that the robot can walk through an opening without interference. By using the ultrasonic sensor on the front, it is possible to look for obstacles or objects at longer distance than with inexpensive IR sensors.

WinCVS was used for version control and change tracking for both the Midnight ProwlerBot VB.Net program and the Basic Atom Pro code in the robot.

Sunday, January 27, 2008


The main control screen of the Midnight ProwlerBot Control attempts to emulate the controls on a PS2 controller. This is done to ease the transition from using the PS2 controller to using the Midnight ProwlerBot Control—there is no need to memorize a new control scheme.

Naturally, there are significant differences between a PS2 controller and the Midnight ProwlerBot Control. The most obvious is joystick control, which had to be provided in the program using sliders. It is certainly possible to create a custom joystick control instead of using sliders, but sliders are convenient and easy to use. The sliders may be replaced a joystick control at some point in the future.

The lower left side of the main screen provides sensor readings as they are received from the Basic Atom Pro 28. Currently, there is no logic acting based upon the readings, but there will be in the future. For instance, the Midnight ProwlerBot will be able to chase and kick a colored ball into a goal by identifying the colored object and remembering the location of the goal and kicking in the direction of the goal.

Although the logic from the main screen of the program is an emulation of the same functions available on the PS2 controller, the program will eventually provide more autonomous control and retain the PS2 functionality for convenience and testing.

The servo ranges may be set by accessing the Servo Ranges screen. Not only may the upper and lower ranges for individual servos be set, which is not available in the original Basic Atom code, but the zero points of individual servos may also be set. There are also buttons available to reset the ranges to their original ranges and to set the zero points to zero.

The Servo Control screen provides the ability control servos individually or as a group and outputs the resulting command in a textbox to be viewed or copied for possible use later. This functionality is provided mainly as a convenience for the programmer to be able to easily create a sequence and copy the commands to program code. This screen will be used in developing the kicking motions and celebration motions that will eventually exist in the Midnight ProwlerBot.

Thursday, January 10, 2008

The first generation...

The Midnight ProwlerBot is based on a hexapod kit available from Lynxmotion, but with additional sensors and programming written in VB.Net using Bluetooth to communicate with the robot.

The original kit consisted of 18 servos, the robot structure, an SSC-32 servo control board, and an Atom Bot Board main control board with a Basic Atom 28 module doing the logic processing.

The original programming provided with the kit is based upon inverse kinematics, which provides smooth motions that can execute simultaneously and sometimes look creepily life-like.

Unfortunately most of the memory of the Basic Atom 28 module was used for the motion control although there was space available to add some simple sensors. However, space quickly ran out as more sensors were added and more logic was added based upon feed back from the sensors. As a result, the Basic Atom Pro 28 was purchased and installed.

The Basic Atom 28 Pro module provided plenty of space for most things, but adding video processing pushed memory requirements to the limits. Besides, there simply wasn’t enough memory to store a large number of motion sequences, in addition to the “praying mantis” and the “flying” sequences included with the original program.

By using Bluetooth to communicate with a laptop and offloading the processing to a custom program on the laptop, it became possible to store a nearly infinite number of motion sequences as well as add complex logic based on sensor values and combinations. The resulting VB.Net program, Midnight ProwlerBot Control, obtains sensor values and data from the Basic Atom Pro 28 and sends motion sequences to the SSC-32 servo controller.

The Midnight ProwlerBot Control is basically a port of the original Basic Atom 28 BASIC code to VB.Net with some added features.

The ability to switch from Bluetooth/laptop control back to Basic Atom Pro 28 control is provided and allows the Midnight ProwlerBot to also be used with a wireless PS2 controller without a laptop. This feature is available to provide the ability to do quick, easy demonstrations of the features that the robot originally came with, although the more advanced features in the original code had to be removed to allow for additional sensor support.