Shop OBEX P1 Docs P2 Docs Learn Events
Microsoft Robotics Studio — Parallax Forums

Microsoft Robotics Studio

ptruiniptruini Posts: 9
edited 2006-08-23 13:38 in Learn with BlocklyProp
Can someone tell me if Boe-bot will work with a serial cable using Microsoft Robotics Studio or will it only work·with the eb500 Bluetooth module?
Thank You!
«1

Comments

  • ToborgToborg Posts: 22
    edited 2006-08-16 19:47
    You must have been reading my mind. I don't have the bluetooth module, however I do have a full boe bot kit serial version.
    I have just been going crazy waiting for info about MSRS and BS2. I tried converting the code for the bluetooth serial interface in the BoeBotControlForMsrsCtp2.bs2 to the programming serial interface with no success. a few beeps and thats all. My code is probably faulty. It usually is...

    So, after a long novel......I would like to know the same thing please.
  • edited 2006-08-16 20:07
    Try changing all the SERIN/SEROUT Pin arguments to 16 in the PBASIC code.
  • ptruiniptruini Posts: 9
    edited 2006-08-16 20:24
    How do you incorporate a .bs2 file into VB.net/2005 (MS Robotics Studio)?
  • edited 2006-08-16 20:52
    The .bs2 file runs on the Boe-Bot and makes the BASIC Stamp communicate with a Robotics Studio service. For details and a Visual C# example, check out the PDF documentation on the Robotics Studio Boe-Bot Robot Kit·product page.
  • edited 2006-08-16 20:56
    BTW, that Robotics Studio Boe-Bot Robot Kit page (link in previous post) also has an overview of how it all works, along with links to all the software downloads.
  • ToborgToborg Posts: 22
    edited 2006-08-17 00:37
    what about the pin5 argument for the bluetooth module?
  • edited 2006-08-17 01:25
    Good point, comment the DO...LOOP that waits for IN5 to go low. If you're using a serial cable that shouldn't matter.

    However, I just realized there's another problem. The communication protocol is designed for the two separate lines provided by the Bluetooth module. The PC blasts out the same packet over and over again until the BASIC Stamp replies (on a separate line). Since SIN and SOUT are tied together on the BASIC Stamp, the PC will never get the reply if the serial cable is connected to the programming port.

    There's a hardware and software solution for this.

    The hardware solution would be to make a leash so that you can connect the serial port to the I/O pins that would otherwise be used with the Bluetooth module. So, you'll either want to use an RS232 transceiver or add the 22 k resistor protection the BASIC Stamp manual talks about in its SERIN/SEROUT sections. The USB2SER tool http://www.parallax.com/detail.asp?product_id=28024 would also work·well for this.

    The software solution would be to adjust the communication protocol for half duplex. It seems like it should be possible to increase the Thread.Sleep delay in the BoeBotControl.cs' SendPacket method's while loop. That would leave an opening for the BASIC Stamp's reply packet to get through. It's going to take some testing and tinkering, but since you've got both files (BoeBotControlForMsrsCtp2.bs2 and BoeBotControl.cs), you've also got complete control over the communication protocol.

    Post Edited (Andy Lindsay (Parallax)) : 8/17/2006 1:29:08 AM GMT
  • ToborgToborg Posts: 22
    edited 2006-08-17 02:14
    You know, you might be interested in this... I was tinkering around with the serin/out pins as I mentioned earlier. Then I decided to start reading the program notes in the BoeBotControlForMsrsCtp2.bs2, I put a audio notification in after each serial statement.
    one after request connect, after confirm connect, and after request packet. When I ran debug, I recieved notification of all three audio signals. Then I got some major servo twitching everytime I would move the mouse. Seems like I was so close.

    From your explination seems like I was getting gibberish serial data.

    Could you clarify the leash suggestion for me a bit?
    More info about the USB2SER would be nice too as I have big plans for a bunch of these later should this pan out.
  • edited 2006-08-17 05:05
    Alright, I just tested the USB2SER, and it works well as a leashed system.

    When you plug the USB2SER into your PC's USB port, you'll have to install some drivers.· If the automatic install doesn't work, the product page has drivers and instructions.

    To connect the USB2SER to your Board of Education, make the following connections:

    USB2SER's Vss to Board of Education's Vss
    USB2Ser's RX to Board of Education's P1
    USB2Ser's TX to Board of Education's P0

    Make sure to start with an unmodified version of BoeBotControlForMsrsCtp2.bs2. Then, comment the two lines with IN5 in them. (I forgot about one of them, and it looked like nothing was working for a painfully long time!)

    You'll need to find out what COM port for your USB2SER is on for updating the COM port references in BASICStamp2.cs and BASICStamp2.Config.xml. To do that, Right-Click My Computer, and Choose Properties. Click Hardware, and then open the device manager. Click the '+' next to Ports (COM &LPT), and find the USB Serial Port. It'll have the COM number in parentheses next to it. Update BASICStamp2.cs and BASICStamp2.Config.xml with that value.

    Post Edited (Andy Lindsay (Parallax)) : 8/17/2006 5:25:02 AM GMT
  • ToborgToborg Posts: 22
    edited 2006-08-17 12:03
    Is the 22k resistor still needed with the USB2SER? I cannibalised an old male DB9 and hooked up a 22k resistor to physical pin 3 TD on the DB9 and placed that on BS2 pin0. I placed DB9 pin 2 RD on BS2 pin1, and DB9 pin 5 on vss. Used a fresh BoeBotControlForMsrsCtp2.bs2 deleted the IN5 arguments, programmed with regular serial port, unplugged it and plugged in the other serial port connected to pins 0,1. Debugged the C# program and brought up the dashboard, and I just can't get this obstinant little guy to move. I even tried it without altering the IN5 lines. My COM ports are correct in the .cs, .XML.

    You have been very patient and helpful. Any further info would be great.

    are their any other program conditions that would prevent it from moving?
  • ptruiniptruini Posts: 9
    edited 2006-08-17 16:57
    Will this procedure work on any robot with a Basic Stamp 2 microcontroller or does it have to be Boe-Bot?
  • edited 2006-08-17 17:14
    Toborg,

    Your circuit setup sounds correct.

    Definitely comment any lines with references to IN5.

    The most likely gotcha is that the Debug Terminal was not closed, so it prevented Robotics Studio from establishing communication. I would recommend following the same steps (with a .bs2 program with the IN5 lines commented). Make sure to close the Debug Terminal before you start debugging with Visual Studio.

    Andy

    Post Edited (Andy Lindsay (Parallax)) : 8/17/2006 11:52:50 PM GMT
  • edited 2006-08-17 20:47
    ptruini said...
    Will this procedure work on any robot with a Basic Stamp 2 microcontroller or does it have to be Boe-Bot?
    Well, the procedure you are citing is a demo for the Parallax Boe-Bot Robot and the eb500 Bluetooth module.· You could easily modify the PBASIC code so that it works with a Parallax SumoBot or Toddler, for example.· The PBASIC code that runs in the BASIC Stamp and the code in Robotics Studio can both be edited.· You can modify your robot sensor circuits, and modify the PBASIC code to make it work with the modified circuit.· You can also add a new circuit, and modify the PBASIC and C# code to get it all to work together.

    I would recommend reading the Product Page, and the PDF documentation on that product page.· Here are the links:

    Product page: http://www.parallax.com/detail.asp?product_id=28118
    PDF docs: http://www.parallax.com/dl/docs/prod/robo/BluetoothControlledRobot.pdf
  • ToborgToborg Posts: 22
    edited 2006-08-18 02:19
    Still running into problems. No, success as of yet. Thank you very much for help. If I do find success I will post it.
  • edited 2006-08-18 19:24
    Toborg,

    Alright, let's make sure your BASIC Stamp is communicating with the PC. Load the program below into your BASIC Stamp 2. Then, Run HyperTerminal and connect to the COM port connected to I/O pins P1 and P0. After each character you (slowly) type into HyperTerminal, it should display "You typed: " and then the character. If this works, we'll need to examine the steps you go through when building and debugging the C# files. If it doesn't work, we'll have to take a closer look at your wiring.

    Andy

    'DisplayHyperTermChars.bs2 
    
    ' {$STAMP BS2} 
    ' {$PBASIC 2.5} 
    
    char VAR Byte 
    
    DO 
    
    
      SERIN 0, 84, [noparse][[/noparse]char] 
      SEROUT 1, 84, [noparse][[/noparse]10, 13, "You typed: ", char] 
    
    LOOP
    

    Post Edited (Andy Lindsay (Parallax)) : 8/18/2006 7:28:00 PM GMT
  • ToborgToborg Posts: 22
    edited 2006-08-20 13:19
    Andy,

    I should have time today to do the connectivity check.

    I rewired everything, checking my connections to make sure they were solid to get rid of that possibillity.

    I'll update you tonight.
  • edited 2006-08-20 14:46
    Toborg,

    Sounds good, just one suggestion:

    I would recommend doing the connection check before rewiring anything. If your serial connection already works (and from your description, it should) then we just need to look more closely at what your software is doing. The only thing is, we need to prove the COM port works before looking more closely at something that might be going on with the other software. Otherwise, any software test would be telling us nothing.

    Afterthought: It wouldn't hurt to put 22 k resistors on both I/O pins (in series from P0 and P1).·· The second one is not needed, but it will protect your I/O pins from certain wiring and coding errors.

    Post Edited (Andy Lindsay (Parallax)) : 8/20/2006 3:00:11 PM GMT
  • ToborgToborg Posts: 22
    edited 2006-08-20 17:44
    Well, I tried it. I selected my com port and used the default settings after that. The hyperterminal says that it connected. However I slowly typed in "you" to see what would happen. I recieved no response. My use of Hyperterminal is somewhat limited so, I hope I am doing this correctly.
  • ToborgToborg Posts: 22
    edited 2006-08-21 00:16
    Ok, I did some hyperterminal education. I got it...pretty basic. Still no connectivity. However, I did some trouble shooting individually with the serin and serout commands.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    DO
    SEROUT 0, 16468, [noparse][[/noparse]"Hello World",CR,LF]
    LOOP

    I tried this code and it worked in Hyperterminal!!
    Whenever I use the code that you suggested, I type a character and I get gibberish.
    Since your code is contingent on a serin command maybe thats where my problem lies?
    I don't have another 22k resistor on hand, they go the fastest, there used in everything !!
    Seems like there may be a solution in sight.

    Suggestions??
  • ToborgToborg Posts: 22
    edited 2006-08-21 00:56
    Well, I think that I found the problem. My 22k resistor seems to be the culprit. The color code is correct R,R,O. However the meter shows quite a bit less than what the tolerance should allow. Around 18k. Would this in your opinion be a good scapegoat?
    Hope no damage has been done. Oh, and just to be sure I recalibrated my meter and sure enough 18k.

    Let me know what you think. I'll pick up some fresh ones tomorrow. I need to replenish anyway.
  • edited 2006-08-21 05:57
    I see two potential problems here.

    The first is my fault, I gave you the wrong baudmode arguments. Sorry about that.· All the SERIN and SEROUT commands should be 16468 instead of 84 since the inverter (RS232 chip) has been bypassed.

    The second problem is that you used the command SEROUT 0, 16468..., and it successfully sent a message to HyperTerminal.· That means that you are transmitting on P0 instead of receiving.· The 22 k resistor is supposed to be between the DB9 TX pin and the BASIC Stamp I/O pin that's receiving the signal.· If you're transmitting on P0, it means you'll want to remove the resistor from the P0 circuit path and put it in the P1 circuit path (to protect P1).· After that, try the program below. If the I/O pins are okay, it should work.

    'DisplayHyperTermChars2.bs2

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    char VAR Byte

    DO


    SERIN 1, 16468, [noparse][[/noparse]char]
    SEROUT 0, 16468, [noparse][[/noparse]10, 13, "You typed: ", char]

    LOOP

    If this software loopback works on HyperTerminal, then you can change all the Pin and Baudmode arguments in BoeBotControlForMsrsCtp2.bs2 to match (SERIN 1, 16468,... and SEROUT 0, 16468, ...). As before, make sure to comment those lines with IN5, and it should be ready to work with the Microsoft Robotics Studio demo code.

    Post Edited (Andy Lindsay (Parallax)) : 8/21/2006 6:09:02 AM GMT
  • edited 2006-08-21 07:38
    Toborg and anybody else who's interested in following along,

    Since mistakes with DB9 to BASIC Stamp connections can damage I/O pins, I'd like to document the hardware connections for your serial cable. I'm shooting for getting it posted Monday afternoon/evening.

    Regards, Andy
  • CdubbsCdubbs Posts: 5
    edited 2006-08-21 12:17
    I have been following along but trying all of these commands in Serout 16/Serin 16. I connected the Boebot in the normal file transfer method (standard slot) with USB. Will this work? When I try the hyperterminal, I type in letters and get back gibberish: dZ›
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-21 13:35
    Cdubbs -

    You do realize that any characters sent to pin port 16 will be echoed back out - right?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • CdubbsCdubbs Posts: 5
    edited 2006-08-21 13:56
    I do now. Do you think that is what the gibberish is?
  • CdubbsCdubbs Posts: 5
    edited 2006-08-21 19:21
    Also, I am using a USB cable. Will that work?
  • ToborgToborg Posts: 22
    edited 2006-08-21 21:27
    OK, I got a fresh pack of 22k they check out fine. hooked it up according to my circuit that I described earlier and used this bs2 code:
    'DisplayHyperTermChars2.bs2

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    char VAR Byte

    DO


    SERIN 0, 16468, [noparse][[/noparse]char]
    SEROUT 1, 16468, [noparse][[/noparse]10, 13, "You typed: ", char]

    LOOP



    It worked in Hyperterminal !!!

    Whats the next step to get BoeBotControlForMsrsCtp2.bs2 working ?
  • edited 2006-08-22 02:46
    Toborg,

    If you have not already done so, start by following the First Boe-Bot Test Circuit instructions in BluetoothControlledBoeBot.pdf.

    After that, start over with an unmodified copy of BoeBotControlForMsrsCtp2.bs2 and:

    1) Comment the two lines with IN5 in them.
    2) Change all the SERIN/SEROUT Baudmode arguments from 84 to 16468.
    3) Download the modified program to the BASIC Stamp.
    4) Close the Debug Terminal that automatically opens when you download the program. (If you don’t, Robotics Studio won’t be able to access the COM port.)

    Since you now have bidirectional communication between your PC and Boe-Bot, connecting with Microsoft Robotics Studio should go smoothly. Start following the instructions in BluetoothControlledBoeBot.pdf from the Robotics Studio Service section on page 6 onward. There will be instructions for the eb500 that you’ll either need to skip or modify, but aside from that, follow the instructions as closely as possible.

    The first time I tried to get Microsoft Robotics Studio to connect to the Boe-Bot, I made several mistakes. First, I did not open BASICStamp2.csproj from within the Robotics Studio Command Prompt. Also, I did not set the BSServices.csproj as the startup project. There have also been a couple of times when I forgot to update the COM port in one or both files (BASICStamp2.Config.xml and BASICStamp2.cs). Each one of those mistakes can/does cause it not to connect.

    If it’s still not working after carefully following the instructions, start posting the build report and a screen capture of the Robotics Studio Command prompt that appears when you start debugging. Also, check on Microsoft’s page to make sure the Visual C# or Visual Studio software you have is a version that will work with Microsoft Robotics Studio.
  • ToborgToborg Posts: 22
    edited 2006-08-22 14:50
    I made the needed adjustments as you suggested. The robotics studio is now working. I can direct the boe-bot with the dashboard. It is kind of jerky though. Is that the way it is supposed to be? It moves about every .5 seconds in what ever direction I select.

    Thanks for your help. I atleast have connectivity now and can start moving on.
  • edited 2006-08-23 13:38
    The eb500 introduces some delays that cause a small amount of stutter in the servos, but a wired connection should not. Typical culprits are low batteries and/or DEBUG commands in the code.
Sign In or Register to comment.