Shop OBEX P1 Docs P2 Docs Learn Events
Connection with EB500 — Parallax Forums

Connection with EB500

rotary9krotary9k Posts: 26
edited 2009-03-04 11:39 in BASIC Stamp
I recently picked up an EB500 bluetooth module, and also a bluetooth USB adaptar for my computer.

I went through the tutorial at http://www.parallax.com/Portals/0/Downloads/docs/prod/comm/A7-UM-eb500-SER.pdf for establishing connections and communication.

The PC and EB500 pair just fine and as far as my PC shows, they are connected. I tried using Hyperterminal as the tutorial said, and when I call, the light on the EB500 would light up and disappear when I closed the connection.

So what's the problem? The BASIC Stamp editor.

If I connect the physical USB cable from the BOE to my PC, then everything works fine. I can open a connection from my PC to the USB Bluetooth adapter using Hyperterminal, and whatever I type there I can transmit to the debug of the Stamp Editor.

However, the stamp editor can't detect my bluetooth connection, which is COM ports 3/5. When I try to identify, the Loopback and Echo column both say No. If I constantly refresh, the Loopback will SOMETIMES say Yes for my COM port 5, and if I refresh the light on the EB500 flashes, so there must be SOME kind of connection...or attempt? I've tried googling this subject, but the only solution I found was someone downgrading to BASIC Stamp Editor version 1.1, but I couldn't find that to try it.

Any help please? BTW sorry if I gave a little too much unneeded information.

Post Edited (rotary9k) : 5/26/2008 12:58:27 AM GMT

Comments

  • rotary9krotary9k Posts: 26
    edited 2008-05-27 05:30
    Well I did some more research, and apparently you can't download onto the stamp over bluetooth, only over a wired connection. I got everything working once I downloaded through the USB cable.

    I have another question that maybe someone can help me answer:

    I have a project which using the Sphinx4 speech recognition engine. I will implement java code into the program to send the results of the speech recognition over bluetooth, in the form of a string. For example, when "move forward" is recognized, it will send the resultText string = "move forward".

    The question is, I should be able to write a BASIC code to await for this data from my java application on PC right? I am able to receive a string?

    This is the guide I am trying to follow: http://developers.sun.com/mobility/midp/articles/bluetooth2/

    It lists certain requirements that I am unsure if the BASICstamp2 supports. Can anyone let me know if that guide will work.

    Post Edited (rotary9k) : 5/27/2008 5:41:03 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-27 13:49
    The EB500 implements the RFCOMM protocol and a Bluetooth Serial Port Profile. To the Stamp, it just looks like a serial port and, for programming, you'd use the SERIN / SEROUT statements to receive or send a string of characters. For the receiving case, there are limits on how much data can be received since there are only 26 bytes of variables available, so "move forward" would not be practical, but "MF" or "F" might work just fine.
  • rotary9krotary9k Posts: 26
    edited 2008-05-27 16:08
    Thanks for your response Mike.

    In the article I mentioned earlier which describes Java APIS for Bluetooth, it notes that the receiving end of the client should:

    1. Initiate a service discovery to retrieve the service record
    2. Construct a connection URL using the service record
    3. Open a connection to the server
    4. Send and receive data to and from the server

    Basically, I'll be blunt. I'm not exactly sure what all that means, but I want to make sure that communication between this Java API for bluetooth will be compatible with the EB500 before I research more in depth. The article gives a sample code that the receiving device should have, but the code is in Java.
  • rotary9krotary9k Posts: 26
    edited 2008-05-28 06:01
    Also, do you know if its possible to program the basic stamp to execute a command to move forward continuously WHILE using a SERIN command? For example, if it is given the command to "move forward", can I have it continue moving forward until it receives a new command, such as "stop" ?

    I have a feeling that this is impossible...
  • MSDTechMSDTech Posts: 342
    edited 2008-05-28 11:13
    Nothing is impossible if you are willing to expand the system. You might consider adding one of the Parallax servo controllers to the mix. I am currently rebuilding my BOE-BOT and found myself running out of I/O pins. So I added the USB servo controller to allow the 5 servos to share one I/O pin. As an added benefit, the Stamp only needs to tell the controller which servo and how far then can get back to monitoring the sensors, or in your case the serial connection waiting for the next command.
  • rotary9krotary9k Posts: 26
    edited 2008-05-28 15:13
    MSDTech, that was my main concern. You said I could tell the controller which servo and how far. However, I was wondering if I could have the BOE-Bot move forward, without any distance parameters. It would move forward until SERIN received a new command such as stop, or to move in another direction.

    The way it seems now, I would have to specify a distance with my move command, have the BOT finish moving that distance before it can await another input.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-28 15:24
    The issue here is that the Stamp is capable of doing only one thing at a time. If it's doing a SERIN, waiting for data, it's not doing anything else. A servo requires control pulses every 20ms. If the Stamp has to "listen" for a new command, it can't issue new control pulses. There are many ways around this. The Parallax Servo Controller is one such solution and has its own microcontroller that interprets serial commands and issues regular servo control pulses for up to 16 servos. The ServoPAL is another solution that essentially takes a single control pulse, then continues to issue control pulses until commanded otherwise for one or two servos.

    MSDTech was just suggesting one way to use a servo controller. Actually, the servo controllers have no idea how far the BoeBot has gone. There's no feedback unless you install some mechanism, like a wheel position encoder, to provide it. The servo controllers just start the servos moving and keep them moving until commanded otherwise.

    Regarding the Bluetooth connection. The EB500 implements a standard RFCOMM connection (and there is a well-defined and detailed standard for this) that provides a single bidirectional serial port. If your Java library properly implements the standard (which it probably does), the EB500 should be happy with it.

    Post Edited (Mike Green) : 5/28/2008 3:30:46 PM GMT
  • dexterdexter Posts: 5
    edited 2009-03-04 11:39
    hello--

    i have a question somewhat related to this thread....

    it is about the connection and disconnection of the·bluetooth·device.

    i'm using a remote eb500 module and the debug window·of the BS editor to play around with the bluetooth connection.

    so far, what i can see is that everytime i initiate a "disconnect" and "connect" command from·the remote·eb500, i have to manually refresh the debug window's com port setting before i can re-establish the bluetooth connection....

    i find this rather troublesome...

    i'd like to know if there is any way i can do a disconnect and connect without having to·constantly refresh the·com port setting?·
Sign In or Register to comment.