Shop OBEX P1 Docs P2 Docs Learn Events
Pair Easy Blueooth Module — Parallax Forums

Pair Easy Blueooth Module

SANSAN Posts: 29
edited 2009-11-26 17:18 in BASIC Stamp
Hello.
I have 2 Easy Blueooth Module (#30085). I am able to connect it with my PC bluetooth and its working.
Can any one help me to connect the pair of Easy Blueooth with each other.
I mean, how I can create the communication between 2 Easy Blueooth Module.
Please help.cry.gif

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-04 18:49
    Read the RBT-001 User Manual. The link is on the Parallax webstore page for the Easy Bluetooth module.

    There's a brief description of "Transparent Master" and "Transparent Slave". One module has to act as a Bluetooth Master and the other has to act as a Bluetooth Slave. What you've done before is to establish the Easy Bluetooth as a Slave with the PC as Master. Now you have to set up one of the Easy Bluetooth modules as a Master following the instructions in the User Manual.
  • SANSAN Posts: 29
    edited 2009-11-04 20:11
    Than you sir. I read it. But I cant understand how I'll give the commads to the bluetooth.
    How I can select the Transparent modes. Is it the same way I'm sending data usnig SERIN command ?
    Can you give me a sample code ?
    Plz help.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-04 20:29
    The description of how to send commands begins on page 22 of RBT-001 User Manual.

    Here's a soft reset command using the SEROUT statement

    SEROUT < transmit pin>,84,[noparse][[/noparse]$02,$52,$26,$00,$00,$78,$03]

    This works at 9600 Baud and sends the start code ($02), packet type ($52), reset operation code ($26), two byte data count (zero - $00,$00), checksum ($78), and end code ($03). This packet format is described in the User Manual.

    Go through the sample code given in the Easy Bluetooth documentation. You may want to use the PC Easy Bluetooth program to configure the module when attached to a PC, then attach it to the Stamp already configured.

    Post Edited (Mike Green) : 11/4/2009 8:34:17 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-05 00:51
    The CFM packet is something that is received from the Easy Bluetooth module in response to a REQ packet. It isn't something you send. The CFM packet essentially returns status information from a request. You'd use a SERIN statement to receive it.

    I can't give you "the sequence" of opcodes. I don't have an Easy Bluetooth module and I'm just reading the manual and trying to explain it. Page 67 of RBT-001 indicates that the SPP (serial port profile) port number for the Easy Bluetooth module is normally 1, so you'd need to do an SPP_ESTABLISH_LINK (page 48) using the local port number (1), the Bluetooth address of the slave, and the slave's port number (1). See the diagram on page 51 for the steps needed to set up a transparent link. The slave would need to do the sort of steps shown on page 52. I think it's possible to set up default connections using RoboTech's utility program so the two Easy Bluetooth modules would automatically attempt to set up a transparent connection between them, but I can't tell you which commands to use.

    If you can't figure it out, you might contact Parallax Tech Support directly. They may be able to point you to some other examples.
  • SANSAN Posts: 29
    edited 2009-11-05 13:26
    Tank you for your reply.
    I tried with the SERIN command but the Basic Stamp is not receiving anything means the module is not sending any data.
    Is there any specific command to Enable or enter into Command Mode ?

    The CFM Packet type syntax I gave is -
    SERIN TX,Baud, [noparse][[/noparse]var1,var2,......,varn]

    Is it right ? or first I need to send the Start($02),Packet Type($43),opcode, data lenght, checksum - using SEROUT command
    then I can receive the values ?
  • SANSAN Posts: 29
    edited 2009-11-10 18:25
    I did it - I connected 2 Easy Bluetooth Module with each other and its working.
    Thank you Mike for your help.
  • SANSAN Posts: 29
    edited 2009-11-26 17:18
    Here Some important things regarding the easy bluetooth module pairing

    To connect 2 easy bluetooth module(RBT-001) u need to remember somethin

    1. When a module is ON and you turn it OFF, you have to wait at least 5 seconds before turning it ON again, otherwise it could not start correctly

    2. If you establish a connection to a remote RBT-001 and then turn off the module that originated the connection, the remote module will automatically drop the connection after 20 seconds: you can not re-connect the module within this 20 seconds otherwise you will not be able to establish the connection. This is true also if you turn off the remote module: the module that originated the connection will remain connected until the 20 seconds time-out expires, so you can not give commands to the module during these 20 seconds.

    The bs2 code is below
    '

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

    RX PIN 2
    TX PIN 0
    Baud CON 84
    Program_Start:
    DEBUG CLS
    PAUSE 1000

    DEBUG CR,"Establishing SPP connection..."
    ' To establish SPP Connection:
    ' substitute $FF,$FF,$FF,$FF,$FF,$FF with the Remote Bluetooth Module Address
    ' of the remote Easy Bluetooth module writing the address in "Little Endian" Byte order,
    ' i.e. from the least significant Byte to the most significant Byte
    ' for instance 00:17:A0:00:1D[noparse]:D[/noparse]2 must be written as $D2,$1D,$00,$A0,$17,$00

    SEROUT TX, Baud, [noparse][[/noparse]$02,$52,$0A,$08,$00,$64,$01,$FF,$FF,$FF,$FF,$FF,$FF,$01,$03]
    PAUSE 5000

    DEBUG CR,"Entering Transparent mode...",CR
    'Entering Transparent mode

    SEROUT TX, Baud, [noparse][[/noparse]$02,$52,$11,$01,$00,$64,$01,$03]
    PAUSE 3000

    'Simple example code after full link establishment
    SEROUT TX, Baud, [noparse][[/noparse]CR, LF, "Easy Bluetooth test - starting counter...", CR, LF]
    counter VAR Byte
    DO
    SEROUT TX, Baud, [noparse][[/noparse]DEC counter,CR]
    counter = counter + 1
    PAUSE 500
    DEBUG ? counter
    LOOP
    '
    This code is working porperly
Sign In or Register to comment.