Microsoft Robotics Studio
ptruini
Posts: 9
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!
Thank You!
Comments
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.
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
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.
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
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?
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
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
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
Post Edited (Andy Lindsay (Parallax)) : 8/18/2006 7:28:00 PM GMT
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.
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
' {$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??
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.
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
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
You do realize that any characters sent to pin port 16 will be echoed back out - right?
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
'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 ?
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.
Thanks for your help. I atleast have connectivity now and can start moving on.