Putting robotics at your service™

Free shipping on orders over $200

BlueSMiRF with Bot-Board 2

Print view Share :
Previous topicNext topic

Page 1 of 1 [ 13 posts ]

Rookie ( offline )
Posts: 11
Posted: 2012-03-04 13:47 
Hi All,

I'm currently trying to use a BlueSMiRF Gold module with the Bot-Board 2 and Basic Atom Pro 28 module. My final goal is to control a Tri-Track with a mobile application I've developed, however, for now I just want to prove out the connection by sending data from a PC with LynxTerm to the BlueSMiRF and outputting this data to the Terminal in Basic Micro Studio on another PC.

I've done quite a lot of research on this forum and looking at the various manuals for the Bot-Board, BAP 28 and BlueSMiRF. However, all I've really managed to get so far is that I need to use the HSERIN/HSEROUT commands with the module connected to pins 14 and 15 on the BB2. I've also managed to configure the Baud rate of the BlueSMiRF as shown in the tutorial for using it with the SSC-32 (I'm going to leave it at 9600 for now).

I've written some code but I'm not too sure if I've done it correctly. I'm not getting anything in the terminal other than constantly printing "0" no matter what is being sent from lynxterm. If anybody is able to spot any errors in my code or make some suggestions I would be extremely grateful! I've pasted it below:


Code:
bt_in con P14       ' Rx pin
bt_data var byte   ' Data placeholder

main

    hserin bt_in, i9600,[bt_data]    ' hserin command to get data from Rx and write this to bt_data

    serout s_out,[bt_data]            ' print contents of bt_data to basic micro studio terminal   

goto main                                  ' loop back to start of main



Thank you! :D


Rookie ( offline )
Posts: 11
Posted: 2012-03-06 16:14 
Hey,

Unfortunately I can't get the BlueSMiRF communications working with the Bot-Board. I've tried all sorts of variations on the code but nothing seems to work. The current code I'm working with is below (for some reason BBCode won't switch on even though I have it set to be on as default in my User CP).
Code:
bt_data var byte
ENABLEHSERIAL
SETHSERIAL1 H9600, H8DATABITS, HNOPARITY, H1STOPBITS

main
    hserin p14,[bt_data] 
    serout s_out, i9600, ["data received = ", bt_data]   
goto main


Does anyone have any ideas? I know the problem isn't at the transmitter device end (both a laptop and an Android phone have been proven to send the data to each other). I've checked my wiring from the BlueSMiRF to the Bot-Board and that all seems fine too.

Thanks,

Ern


User avatar
Guru ( offline )
Posts: 9258
Posted: 2012-03-06 16:16 
I had to put in the quote tags and enable bbcode in your post. ;)

_________________
Jim Frye, the Robot Guy
http://www.lynxmotion.com
I've always tried to do my best...


User avatar
Guru ( offline )
Posts: 9258
Posted: 2012-03-06 16:21 
I know enough to be dangerous. Check the hserin command to see how to set up a timeout value. This will drop out of the serin if data is not received in a certain amount of time. Not sure if it would make any difference.

_________________
Jim Frye, the Robot Guy
http://www.lynxmotion.com
I've always tried to do my best...


Rookie ( offline )
Posts: 11
Posted: 2012-03-10 06:46 
Thanks for that Jim. Unfortunately adding a timeout didn't help.

I'm now wondering whether it would be possible instead to connect the bluesmirf to the SSC-32 to receive commands, but also pass data from the BAP28 to the SSC-32 so that it can be transmitted through the Tx pin of the BlueSMIRF?

The reason for this is that once the Bluetooth control is working out we want to establish bi-directional control where data from three line sensors can be sent to the Bluetooth control.

Also, is there a wiring diagram for connecting the BB2, SSC-32 and Sabertooth on the tri-track? I may just be looking in the wrong place but I've not been able to find one.

Thanks,

Ern

edit: corrected a typo


User avatar
Guru ( offline )
Posts: 4902
Posted: 2012-03-10 10:31 
I have not seen your wiring, so don't know if there is an issue or not there. My assumption is that you have +5v, GND connected. Plus you have BB2 P15 hooked up to RX and P14 hooked up to TX and you have a jumper wire hooked up between RTS and CTS (like what is shown for the SSC-32: http://www.lynxmotion.com/images/html/build125.htm)

As for your program, your parameters to HSERIN has a problem:
Code:
hserin p14,[bt_data]

The problem is that the first optional argument to hserin is which USART you are using. In the case of a BAP28, the only valid value is 1. On Arc32 or Bap40 or Mad Hatter, the value can be either 1 or 2...

Personally my test program would probably have a little more stuff, to see if I get communications going either direction... Maybe something like:
Code:
    bt_data var byte
    loop_cnt var word
    ENABLEHSERIAL
    SETHSERIAL1 H9600, H8DATABITS, HNOPARITY, H1STOPBITS

   loop_cnt = 0
    main:
       if (hserinnext 0x81) <> -1 then
           hserin 1,[bt_data]
           serout s_out, i9600, ["data received = ", bt_data]   
        endif
       
        loop_cnt = loop_cnt + 1
        if loop_cnt = 5000 then   ; about every 5 seconds
           hserout 1, ["From BT", 13]
           loop_cnt = 0
        endif
       
        pause 1
        goto main


Rookie ( offline )
Posts: 11
Posted: 2012-03-13 16:20 
Thanks for that Kurte, it works now!


Rookie ( offline )
Posts: 23
Posted: 2012-05-31 10:02 
Hi all,

I am trying to connect a Bluetoodth Modem BlueSMIRF Gold (http://www.coolcomponents.co.uk/catalog ... p-134.html) to my BB2. The main porpose is to send data to the procesfor form a program writen in a different language. So far I am testing the connection, therefore I was doing a bit of research and I wrote a simple program.

Code:
enablehserial
sethserial1 h57600, h8databits, hnoparity, h1stopbits

main:   
   serout p14, i57600, ["Hello", 13]
   pause 1000
goto main


The best results got are with the code above.

The bluetooth modem is pretty much wired as kurte assumed +5v, GND connected and I have BB2 P15 hooked up to RX and P14 hooked up to TX and you have a jumper wire hooked up between RTS and CTS, however I switched RX and TX following the BlueSMIRF specifications (http://wiring.org.co/learning/tutorials/bluetooth/). Here I attached a couple of images of my connections in the robot.

Attachment:
photo (1).JPG
photo (1).JPG [ 133.98 KiB | Viewed 4706 times ]


Attachment:
photo.JPG
photo.JPG [ 87.26 KiB | Viewed 4706 times ]


By doing this I was able to get some type of communication and some undecipherable symbols. I assume these symbols are not caused because of the ambient noise as a change of transmitted message proves a change on the symbols in the screen. I also attach an image of my input.

Attachment:
foro.JPG
foro.JPG [ 19.17 KiB | Viewed 4706 times ]


I am quite desperated with this issue, I have tried some to of the codes on the forum but none of them seems to work. Do you have any suggestion? All of them will be more than welcome. oh... the code suggested in this thread was also tested.


Rookie ( offline )
Posts: 11
Posted: 2012-05-31 10:17 
Hey,

I'm slightly confused about what you're trying to achieve? Are you trying to transmit data from the BB2 over bluetooth to a PC?

The two possible issues that jump out at me are firstly in the code you've pasted there, you're setting up hserial, yet you're not using it, you're using normal serial output (serout). If you try hserout instead it may work:

Code:
enablehserial
sethserial1 h57600, h8databits, hnoparity, h1stopbits

main:   
   hserout 1, ["Hello", 13]
   pause 1000
goto main


The second possible issue is that you're using a baud rate of 57600. Have you set up the BlueSMiRF module to run at that baud rate? I know when we bought ours it was set to 115200 by default.

Let me know how that goes.

Ern


Rookie ( offline )
Posts: 23
Posted: 2012-05-31 10:29 
X250 wrote:
I'm slightly confused about what you're trying to achieve? Are you trying to transmit data from the BB2 over bluetooth to a PC?


I want to trasmit data from the BB2 over bluetooth to a PC at present. In the case I get it working, I would also want to receive data.

Will let you know how it goes, I will try it now.

Thanks for the quick answer.

Luis_York


Rookie ( offline )
Posts: 23
Posted: 2012-05-31 13:05 
Problem solved, I was sending the data with the right braud. It works perfectly now. Thanks for the advise.


New ( offline )
Posts: 1
Posted: 2012-11-23 10:58 
Hey guys,

I'm also going to be using a BlueSMiRF with Bot Board to control a Tri-Track for a project.

Out of interest, what sort of interface did you use to control the robot? A mobile phone app? A computer application?

Thanks.


Rookie ( offline )
Posts: 11
Posted: 2012-11-23 11:07 
Hey,

We were developing an Android app and it worked but not particularly well as I hadn't done much app development at that point.

We ended up using LabVIEW with two control interfaces; a joystick and a brain-computer interface headset. The details are over here if you're interested: http://ernarrowsmith.wordpress.com/2012 ... -mindwave/

Ern


 

All times are UTC - 5 hours [ DST ]. It is currently 2014-08-27 07:06
Feedback Form
Feedback Form