Serial over Blue Tooth


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Serial over Blue Tooth

    Remember the hc-06 is a 3.3v device, so the pic has to be 3.3v or you need to convert levels.

    I found this website for some great info

    http://mcuoneclipse.com/2013/06/19/u...etooth-module/

  2. #2
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default Re: Serial over Blue Tooth

    Here's an easy way to test your HC-06, and the comms with the host/client. Just short its Tx and Rx, power it up (3.3 or 5, depending on whether you have the bare version or the one on a backpane).

    Anything you type on your terminal should echo back whatever you type. A simple test, no pic involved, no baud rate issues.

    Incidentally, you could also test on an Android, instead of a Windows machine. There's a beautiful terminal emulator called Blueterm on the playstore.

    Regards,

    Anand

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Serial over Blue Tooth

    Thanks guys for the inputs.

    I remember that I was playing with the AT commands and seems I set the baud rate to 38400 !! - I went through the process of changing baud rates in the windows driver and the software until it responded to the AT prompts with an OK. I then re-compiled the test code with the hardware settings for 38400 and once loaded connected via the terminal program --- bingo, or should that be "hello"

    I then changed the serial defines in my main code and have the PIC responding over BT when using the terminal program, IR send Q for queries and all the date for the current prob readings and setting are streamed to the PC. Only problem is that the PC app crashes and screws up the sub system so I need to restart the PC .

    Code:
    Error log timestamp Monday 29/06/15 19:03:38
    
    Runtime error: Element not found.
    
    Error(Exception)>>defaultAction
    Error(Exception)>>activateHandler: <anUndefinedObject> 
    Error(Exception)>>handle
    Error(Exception)>>signal
    Error class(Exception class)>>signal: <'Element not found.'> 
    BasicRunProgram(Object)>>error: <'Element not found.'> 
    BasicRunProgram(BasicProgram)>>terminateRun: <anError> 
    [] in BasicProgram>>errorHandlerBlock
    ExceptionHandler>>evaluateResponseBlock: <aBlockClosure> for: <anError> 
    [] in ExceptionHandler>>handle:
    ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure> 
    BlockClosure>>invisibleEnsure: <aBlockClosure> 
    ExceptionHandler>>handle: <anError> 
    ExceptionHandler>>findHandler: <anError> 
    Error(Exception)>>activateHandler: <anExceptionHandler> 
    Error(Exception)>>handle
    Error(Exception)>>signal
    Error class(Exception class)>>signal: <'Element not found.'> 
    BasicRunProgram(Object)>>error: <'Element not found.'> 
    BasicRunProgram(BasicProgram)>>runError: <'Element not found.'> 
    BasicRunProgram(BasicProgram)>>handleComError: <'Element not found.'> 
    SerialDevice32(SerialDevice)>>error: <'Element not found.'> 
    SerialDevice32>>openError: <1168> 
    SerialDevice32>>openError
    SerialDevice32>>open
    SerialDevice32(SerialDevice)>>open: <'COM4'> 
    BasicCommStream>>from: <'COM4:115200,n,8,1,ds...'> mode: <'RANDOM'> handle: <'#1'> 
    BasicRandomFile class(BasicFile class)>>from: <'COM4:115200,n,8,1,ds...'> mode: <'RANDOM'> handle: <'#1'> owner: <aBasicRunProgram> length: <128> 
    [] in OpenCommand>>using:
    [] in BasicRunProgram>>begin
    ExceptionHandler>>evaluateProtectedBlock: <aBlockClosure> 
    [] in ExceptionHandler>>activateDuring:
    ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure> 
    BlockClosure>>invisibleEnsure: <aBlockClosure> 
    ExceptionHandler>>activateDuring: <aBlockClosure> 
    ExceptionHandler class>>handle: <anError class> with: <aBlockClosure> during: <aBlockClosure> 
    BlockClosure>>on: <anError class> do: <aBlockClosure> 
    BasicRunProgram>>begin
    BasicRunProgram(BasicProgram)>>gotoAndIfStoppedBegin: <'[IoWait]'> 
    BasicRunProgram(BasicProgram)>>handlerName: <'[IoWait]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection> 
    BasicRunProgram>>handlerName: <'[IoWait]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection> 
    BasicRunProgram(BasicProgram)>>submitHandlerName: <'[IoWait]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection> 
    BasicRunProgram(BasicProgram)>>submitHandlerName: <'[IoWait]'> callParameters: <anOrderedCollection> 
    TimerTopPane>>wmTimer: <333598> with: <0> 
    TimerTopPane(Object)>>perform: <#wmTimer:with:> with: <333598> with: <0> 
    NotificationManager>>notify: <aWinMessage> 
    NotificationManager>>notifyRecursive
    NotificationManager>>recursiveMessage
    SystemDictionary>>recursiveMessage
    SystemDictionary>>launch
    The error message is stated above, and there are references to 115200 baud, but I've tried running the application from within the KDE and it still errors. My guessing is that it's something to do with the port handling in Liberty Basic as it works fine with real RS232 connection and when I use a couple of FTDI USB to serial boards, being direct connections. Although the BT dongle produces a virtual com port and this is detected by the initial windows that scans for open ports, it fails to detect the controller (sends out "C" and expects "R" in return) and then crashes and has to be end tasked. At this point the BT pairing drops and wont re-connect and the PC has to be re-booted with both dongles powered down at the time.

    Code:
    FOR TempWD = 0 TO 1000
        IF RCIF=1 THEN GOSUB coms                   ; Check to see id PC application connected
        PAUSE 1
    NEXT TempWD
    This section above checks the buffer to see if something is deposited into it (so I was told)

    Code:
     coms:
    
    HSERIN [nTest]
        SELECT CASE nTest
        CASE "C"                    ; if C then application checking for controller
        goto respond 
        CASE "Q"                    ; if Q then send data to PC
        Goto Term_TX 
        CASE "S"                    ; if S then receive data from PC
        goto Term_RX
    return
    
    respond:
    Hserout ["R"]
    goto main
    then the coms section responds, and initially sends data to the PC and then waits for the next "Q"ueriy or receipt of updated data "S"ent from the PC application.


Similar Threads

  1. Blue Tooth Modules
    By Gord11 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th August 2011, 19:10
  2. RS232 to blue tooth modules
    By isaac in forum Bluetooth
    Replies: 8
    Last Post: - 14th March 2008, 13:00
  3. Killing blue led's
    By Steve_88 in forum Off Topic
    Replies: 3
    Last Post: - 31st January 2008, 02:37
  4. 16x2 lcd with blue backlight selling
    By macx75 in forum Adverts
    Replies: 5
    Last Post: - 8th May 2006, 07:12

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts