devxlogo

Using Microsoft Robotics Studio to Program Parallax’s Boe-Bot

Using Microsoft Robotics Studio to Program Parallax’s Boe-Bot

f you have ever wanted to experiment with robots but thought they were too expensive or complicated, think again. Earlier this year, Microsoft released a Community Technical Preview (CTP) of a new product named Microsoft Robotics Studio. The free software allows you to build applications that control robots using ASP.NET. That was timely, because Parallax, a California-based electronics company, has introduced a robot kit that supports Bluetooth technology and works directly with Microsoft Robotics Studio. And the best part is that the kit costs less than $200. This article will walk you through the steps for assembling the Boe-Bot and then using Robotics Studio to control its movements.

What You Need
  • Visual Studio .NET 2005
  • Microsoft Robotics SDK (November 2006 CTP release)
  • Parallax’s Boe-Bot Kit for Microsoft Robotics Studio
  • BASIC Stamp Windows Editor, version 2.2.6
  • USB Adapter for your computer if the computer is not Bluetooth enabled

Parallax’s Boe-Bot for Microsoft Robotics Studio
Parallax is an electronics company that designs and manufactures several robots for engineers, educators and hobbyists. The Boe-Bot is a small autonomous wheeled robot that’s easy to assemble and requires no soldering?you need only a small screwdriver and a couple of free hours to assemble the robot.

The Boe-Bot is one of eight different robots currently supported by Robotics Studio. Parallax currently offers the Boe-Bot in kit form along with an eb500 Bluetooth module for only $198.77, which is 15 percent off the regular price. The kit includes an easy-to-read manual that walks you through the process to set up the Boe-Bot and programming it with Parallax’s free BASIC Stamp Editor and PBASIC programming language. If a BASIC derivative is not your preferred language, that’s where Microsoft Robotics Studio adds a whole new dimension to the Boe-Bot (see the sidebar: “Is Microsoft Robotics Studio Required?“). After running a few pre-written programs to test the Boe-Bot’s motors and sensors and establish communication with Robotics Studio, you can do the rest of your programming in Visual Studio and the .NET language of your choice.

Assembling the Boe-Bot
When you first open the Boe-Bot box, don’t be overwhelmed by all the small parts, or by the Boe-Bot manual cover’s statement that assembly will take 40 hours. It won’t. It will take you only one to two hours to assemble the Boe-Bot so it can communicate with Robotics Studio. The kit does include a variety of sensors, but you do not have to add them before you can drive your robot. You can add sensors and other enhancements later, but first you need to understand the basics.

I won’t spend any time on assembly because the Boe-Bot manual explains that topic thoroughly. I will point out that you do NOT need to read the whole book before writing Robotics Studio programs to control a Boe-Bot; in fact, you need to complete only the following chapters and activities, each of which is only a few pages long:

  • Chapter 1?Activity 1, 2, 3, 4
  • Chapter 2?Activity 3, 4, 6
  • Chapter 3?Activity 1, 2, 3
  • Appendix D

The Boe-Bot kit comes with a serial cable, which you need to test your robot and load it with a program it needs to communicate with Robotics Studio. It is possible that your computer does not have a serial port. If this is the case, the current Web special includes a USB to Serial (RS-232) adapter, which lets you use a regular USB port to communicate with the Boe-Bot. In any case, after the initial tests and program load you’ll use the Bluetooth module to drive the robot, which allows it a broader range of motion. You’ll also need some standard AA-size batteries to power the robot (see the sidebar “Avoid Using Rechargeable Batteries“).

The last thing you need to know is that if your computer is NOT Bluetooth enabled, you will need to purchase a USB Bluetooth adapter. There are several models available. The more expensive adapters have a longer range. You can purchase the D-Link DBT-120 Bluetooth USB adapter for as little as $24.99. This model is specifically featured in the electronic setup manual for the eb500 Bluetooth module. You can find an electronic copy of the manual in the /documents/Embedded_Blue_Transreceiver directory on the CD that comes with the Boe-Bot. You may need to refer to this manual if you have trouble communicating with the Bluetooth module. I used a Kensington Bluetooth USB adapter ($24.99) that has a range of up to 65 feet.

Working with Microsoft Robotics Studio

?
Figure 1. An Assembled Boe-Bot: The figure shows an assembled Parallax Boe-Bot for Microsoft Robotics Studio with Bluetooth capability.

If you are not familiar with Robotics Studio, you may want to refer to my earlier article “An Introduction to Programming with Microsoft Robotics Studio.” The latest CTP of Robotics Studio lets you program a wide range of robots easily and consistently.

After assembling and testing the Boe-Bot, download the BluetoothControlledRobot PDF document. That document walks you through the additional steps required to get your robot working with the Bluetooth module and Robotics Studio. When assembled, the Boe-Bot should look like Figure 1.

The PDF document instructs you to load some programs into the Boe-Bot’s BASIC Stamp? microcontroller so it can communicate with Robotics Studio. The instructions in the BluetoothControlledRobot PDF document reference a few BASIC programs that are, unfortunately, not supplied on the Boe-Bot CD. Instead, you must download them from the Parallax web site. The downloaded zip file contains four files with a .bs2 file extension. These are the BASIC programs called for by the BluetoothControlledRobot PDF document. The two you need to download to the Boe-Bot and run are:

  • TestSpekerLedsServos.bs2. You use this program to verify that the Boe-Bot’s lights turn on and off and that it can travel a short distance, rotate left and right, and then move backwards again. Performing this test successfully ensures that the Boe-Bot is functioning properly and that you did not mix up the motor cables.
  • BoeBotControlForMsrsCtp2.bs2. You use this program to enable communication between the Boe-Bot and Microsoft Robotics Studio.

Controlling Boe-Bot Movement
After following the setup instructions in Parallax’ BluetoothControlledRobot PDF, I recommend that you start with tutorial #4 available in the Microsoft Robotics Studio (November 2006)samplesRoboticsTutorialsTutorial4 directory. This tutorial teaches you how to issue basic drive commands for your robot. Before using this code, you will need to ensure that your Bluetooth module is working properly and able to communicate with your computer.

You will also need to identify the COM port your Bluetooth module is using. When you install the Bluetooth USB adapter for your computer, it will likely install an icon in your System Tray and/or a shortcut on your desktop that represents “My Bluetooth Places.” To find the COM port, double-click “My Bluetooth Places,” and locate the item named “eb500 A7 serial port.” Select that item and click “View or Modify Configuration” to locate the name of the COM port. After that, you will be ready to modify the RoboticsTutorial4 project by following these steps:

  1. If you have not already done so:
    1. Follow the setup instructions in Parallax’ BluetoothControlledRobot-v1.1.PDF.
    2. Start the Microsoft Robotics Studio Command Prompt.
    3. Use it to open the file Microsoft Robotics Studio (November 2006)samplesRoboticsTutorialsTutorial4CSharpRoboticsTutorial4.csproj. This will open the RoboticsTutorial4 C# project file in Visual Studio.
  2. Use Solution Explorer to find and open the RoboticsTutorial4.csproj Properties dialog.
  3. Select the Debug tab.
  4. Replace any contents in the “Command Line Arguments” field with the following string (note that it’s a single line of code):
  5.    -p:50000 -t:50001 --      m:"SamplesConfigRoboticsTutorial4.manifest.xml" --      m:"samplesconfigParallax.BoeBot.manifest.xml" 
  6. The Dsshost.exe program uses this command line string to initialize the Decentralized System Services (DSS) runtime. This is the part of Robotics Studio that allows you to write and coordinate distributed processes.
  7. Expand the “Config” node in Solution Explorer and select the file named Parallax.BoeBot.Config.xml. Replace the value in the node named “SerialPort” with the value you identified for your Bluetooth port.
  8. Save your changes. From the File menu, click “Save All.”
  9. From the Build menu, select “Build Solution.” Ensure that the status bar reads that the build succeeded.
  10. Turn on the Boe-Bot power switch and make sure it is set to position 3.
  11. Press Ctrl-F5 to start without debugging. A command window appears to display messages (see Figure 2). Initialization takes a few seconds to run, after which the Boe-Bot should respond with two brief beeps. In addition, a small light on the eb500 Bluetooth module should come on.
  12. ?
    Figure 2. Initialization Messages: This screenshot shows the command window output that appears when you execute the RoboticsTutorial4 project.
    ?
    Figure 3. Interface for the Robotics Tutorial #4: This tutorial shows how to drive the robot in any direction. You can use it with the Boe-Bot and other supported robots.
  13. After all the manifest files are loaded, you should see a form such as the one in Figure 3. At this point you should be able to control the Boe-Bot’s movements using the arrow buttons. Each button moves the Boe-Bot in that direction. Once started, the movement continues until a new direction button is selected or you click the Stop button.

How the Code Works
The BoeBotControlForMsrsCtp2.bs2 file acts like a software driver for the Boe-Bot. It receives instructions from .NET programs and determines which PBASIC commands the driver must execute to attain the desired outcome from the robot. For example, clicking the right arrow button on the form in Figure 3 executes the following code:

   _mainPort.Post(new TurnRight());

The TurnRight operation is one of five operations that the tutorial code supports. It also supports Stop, Forward, Backward, and TurnLeft, each of which corresponds to one of the buttons on the form. These also correspond with a class and handler defined in the RoboticsTutorial4Types file. Each class derives from a basic type used to submit a request to the robot. Here’s what the class and handler look like for the TurnRight operation:

   public class TurnRight : Submit>       {           public TurnRight()               : base(new TurnRightRequest())           {           }       }          [DataContract]       public class TurnRightRequest { }   }

The instructions for the Boe-Bot reside in the TurnRightHandler. This handler first ensures that the motor is enabled and then instantiates a SetDrivePowerRequest object. This object has properties that correspond to the amount of power that must be requested from both the right and left motors. To turn right, for example, the Boe-Bot requires a left wheel power level instruction that is the opposite of the value assigned to the right wheel power level. Here’s the code:

   [ServiceHandler(ServiceHandlerBehavior.Concurrent)]   public virtual IEnumerator TurnRightHandler(      TurnRight forward)   {      if (!_state.MotorEnabled)      {         yield return EnableMotor();      }         drive.SetDrivePowerRequest request = new         drive.SetDrivePowerRequest();      request.LeftWheelPower = 0.5;      request.RightWheelPower = -0.5;         yield return Arbiter.Choice(         _drivePort.SetDrivePower(request),         delegate(DefaultUpdateResponseType response) { },         delegate(Fault fault)         {            LogError(null, "Unable to turn right", fault);         }      );   }

This request must be interpreted by the Boe-Bot, which is where the BASIC BoeBotControlForMsrsCtp2.bs2 program comes in. That program accepts the incoming request through the serial port and executes the appropriate BASIC code. The code to set the power for the motors is as follows:

      ' -----[ Subroutine Set_Servo_Speed ]----------   ' Range of 0 to 200 with 100 = stopped    ' maps to 650 to 850 with 750 stopped.      Set_Servo_Speed:        tLeft = buffer3 + 650    ' Decode servo speed.     tRight = buffer4 + 650        RETURN   

Making Changes to the Robotics Studio Samples
If you decide to make any changes to the samples and tutorials provided with Robotics Studio, you will need to do a full recompile of the samples.sln file before you can execute any of the samples. This is due to strong name signing. Unless you do this you will receive an error stating that “Duplicate assemblies exist in the Robotics SDK which may prevent this service from operating normally.” To recompile, navigate to the Microsoft Robotics Studio (October 2006)Samples directory and open the Samples.sln file in Visual Studio. Select “Rebuild Solution” from the Build menu and ensure that the status bar shows that the build succeeded.

Adding Boe-Bot Accessories
The Boe-Bot kit comes with wire whiskers that allow it to detect objects and thus avoid collisions. It also comes with photoresistors that allow it to perform light-sensitive navigations, and infrared object detection sensors for non-contact object detection. All these sensors let you program the Boe-Bot to navigate through its environment safely and effectively. You can even program it in an autonomous mode so that it wanders around avoiding obstacles as necessary.

In addition to the sensors provided with the Boe-Bot kit, you can purchase special accessory kits to go with it. For instance, you can purchase a line-follower kit that uses an infrared emitter and receiver to follow a strip of electrical tape across white poster board. You can also purchase a digital encoder kit that allows the Boe-Bot to get position feedback and thus perform well in maze-solving contests. My favorite kit is the CMUCam AppMod that allows the Boe-Bot to see.

What’s Next?
The Boe-Bot is just one of several robot kits available on the market today. At this moment, it is one of only a few that Robotics Studio supports, but I expect that number to increase in time. Robots are becoming more mainstream everyday and it will not be long before their practical benefits let them infiltrate every level of business. The sooner you learn the concepts surrounding robotics programming the better prepared you will be. And best of all, it is a lot of fun.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist