Shop OBEX P1 Docs P2 Docs Learn Events
bluesmirf and basicstamp — Parallax Forums

bluesmirf and basicstamp

flippydooflippydoo Posts: 8
edited 2008-05-20 05:21 in BASIC Stamp
Just got my hands on both a bluesmirf and a basicstamp2+boe, and I'm completely lost. I've managed to get them hooked up and vaguely communicating through Hyperterm, but now I'm wondering about how exactly to program them.

I want to start by using a simple signal sent to the bluesmirf to activate an equally simple function on the bs2 (ie blinking led, or something equally basic). I'm completely new to programming, and have no idea how this would work. Any ideas?

Comments

  • AmaralAmaral Posts: 176
    edited 2008-04-30 17:10
    Sorry what is a bluesmirf ??

    Amaral
  • AmaralAmaral Posts: 176
    edited 2008-04-30 17:15
    I found it !

    can you send serial data to the bluesmirf ? if yes m send in let's say 9600 baud 8n1 , get the signal that you are seding with SERIN comand and keep going!


    Amaral
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-05-01 15:29
    The Bluesmirf is available from Sparkfun. It would help to post a link to the datasheet when asking for help on a product. In any event I seem to recall that there was an article in a recent Nuts & Volts, Servo or Circuit Cellar that dealt with the Bluesmirf and how to connect it and use it. But if memory serves, it is simply a serial device so as Amaral said, you could use SERIN/SEROUT for communication.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • flippydooflippydoo Posts: 8
    edited 2008-05-06 18:41
    I'm very new to programming (ie playing with it over the past few days), so I'm still trying to figure out how the SERIN commands work precisely. In theory, if I'm communicating with the bluesmirf through hyperterminal, and I tpye something like "a" would this program work to activate my blinking led?



    ·· Main:
    ·· IF SERIN 4, 16468, [noparse][[/noparse]a]
    ·· THEN LOOP

    ··········· HIGH 8· 'Turn off LED
    ··········· PAUSE 100··· 'Short pause
    ··········· LOW 8· 'Turn on LED
    ··········· PAUSE 500
    ·GOTO·LOOP· 'Jump back to beginning


    If this does work, how would I then turn the loop off with another·SERIN command?·Thanks for any help you can give, I'm lost with this stuff.
  • Matthew BurmeisterMatthew Burmeister Posts: 49
    edited 2008-05-06 18:50
    don't you have to loop back to main if you don't get the command (a) so the program doesn't stop?
  • AmaralAmaral Posts: 176
    edited 2008-05-06 19:02
    would be better if you receive the comm first and then condition to task

    SERIN ..... 'take a really long look here is a very powerfull comand with many features, look at modifiers and timeout !

    IF var = ... then
    ...
    ... 'and so on , I know is very hard to settle donw and read a bunch of stuff with your mind sparkling , but try it , if that does not work , try again !


    go ease, and keep going

    hope to help

    Amaral
  • voodoofishvoodoofish Posts: 67
    edited 2008-05-06 21:38
    I picked up a one of the bluesmirfs(the rp-sma model) as well a few weeks ago along with a couple of um96 wireless transceivers. I've been working with the um96's for the most part, but the bt module is part of my next project. I've got an extra hw board that I can see if I can get it working on.
  • voodoofishvoodoofish Posts: 67
    edited 2008-05-08 22:20
    After looking at the documentation for my module, it appears that you need to be able to communicate with the bluesmirf at 115,200bps. This is the default hw setting for the device, so unless you have a bs2p, you wouldn't be able to set the baudrate down to 9600 through the stamp. This is mentioned in the command set doc and also mentions that it can be set to 9600 if you short a pin(not easily done on these modules). It does however mention a way to set up the bluetooth device remotely, though only problem is i don't see a way to save this setting, so every time you restart it, you'll lose the setting and wont be able to initially communicate with it through the stamp. I would check to see if this is the case for yours as well as you'd need to set it some way to get it to communicate.

    Actually found some info on saving the setting and communicating with it...though this is for a different device(Arduino), this guy explains the issues that he had....could be useful
    http://tryingtodotheprojects.blogspot.com/2007/12/arduino-over-bluetooth.html

    This is the original link with several other articles related to his projects.
    http://tryingtodotheprojects.blogspot.com/2007_12_01_archive.html

    Post Edited (voodoofish) : 5/8/2008 10:30:38 PM GMT
  • voodoofishvoodoofish Posts: 67
    edited 2008-05-09 21:34
    I ended up connecting my bluesmirf to my rs-1 serial interface board to get a direct serial connection and in an attempt to set it to 9600. Only after fiddling with it for a few hours was I able to get it to set. I had initially tried to set it via a direct bt connection, but getting it to connect proved to be a difficult task. When I was able to connect to it via serial I would get garbage, which seemed like it was a setting issue, but I had verified the settings at least a half dozen times. finally I just tried using the steps that were mentioned in the link from my previous post, noting the garbage output was consitent(it was recieving and sending repsonses) and was able to get it to set to 9600. So at the moment my smirf is set to 9600 and I can see it via my serial connection. I can also now get into the settings mode and no longer see garbage. My next test is to get the bt usb key that I have to communicate with the bt smirf . Once I have that set up and running I'll connect it to the bs2 and see what I can do at that point. I'll post my findings.
  • voodoofishvoodoofish Posts: 67
    edited 2008-05-11 08:22
    alrighty, tonight, or this morning as it were, I was able to connect to the smirf device and send from it to the bt usb key using the spp(serial port protocol?) service on com 3. I was able to recieve data from the bs2 hw board and also was able to attempt to configure it through the bt connection from hyperterm. next is connecting it though my linux setup and writing a perl script to process some data and communicate.
    some notes:
    when first installing the bt dongle(trendnet BT usb key) it detected the smirf and added two ports 3 and 4.
    I wasn't able to connect to these though for some odd reason and both showed up as connected by default.
    Initially i did NOT enter the passkey when asked(1234).
    on the second attempt I did. I also noted that the com ports no longer existed. when in hyperterm so I went to the bt tools util and noted that there was now only one com port, com 3, and that it was disabled. I enabled it(it stated some different info, like setting up basic serial connection) and was able to make a connection using com 3.
    Another note is that when you are not connected via the bt connection, a red led will blink(first 60 seconds fast for config mode, then slows down).if you are successful in connecting, you will get an additional led that is green(data mode) this is what you want.

    Anyway, the above might or might not be useful, but it was important to know that i had a connection before attempting to even try to send data through.

    So here is the last bit, my prog and setup is pretty simple, I have a ds1620, an led that blinks when i send the data(push the button), a push button that listens for a button press and the bt smirf device to transmit at the moment.
    When i press the button it sends me to a subroutine that gets the ds1620 data. that in turn calls the transblue subroutine. the led turns on when the button press is detected, then turns off after the subroutines finish.

    this is all i use for the bt device.
    [noparse][[/noparse]snip]
    ' Project: bluetooth smirf on bs2
    '========[noparse][[/noparse]setup for modems]========
    BAUDMODE CON 84 ' Set BS2 Baudrate to 9600,8,N,1 Not Inverted (TRUE)
    RX PIN 13 ' Receive pin ' connects to the tx pin on the smirf
    TX PIN 12 ' Transmit pin 'connects to the rx pin on the smirf
    'i used 10k ohm resistoers for the connections to the tx/rx bs2 pins and shorted the cts to rts as stated in the smirf doc.
    'the main section was added as an afterthought in case you try to copy and paste.....it should work
    main:
    do
    debug "sending test", CR
    high 14 ' your led
    gosub transblue
    pause 2000
    low 14
    loop
    end

    transblue:
    PAUSE 100
    'this will use the bluetooth transmitter to transmit serial data to the comp
    'SEROUT TX, BAUDMODE, [noparse][[/noparse]SDEC DSdata," degrees F", CR]
    SEROUT TX, BAUDMODE, [noparse][[/noparse]"test", CR]
    RETURN

    [noparse][[/noparse]snip]

    transblue is called after getting the temp data from the ds1620.

    this could be any data though....

    Post Edited (voodoofish) : 5/11/2008 8:33:25 AM GMT
  • flippydooflippydoo Posts: 8
    edited 2008-05-12 21:20
    thanks so much for your help, I haven't had any time these past few days to play around with it, but I'll see if I can get it working tonight.
  • flippydooflippydoo Posts: 8
    edited 2008-05-14 03:10
    ok, so I can get my computer to recognize the bluesmirf (it lists it as fireflysomethingsomething), and it has it outgoing on COM4 and incoming on COM5. I can connect on COM4 via hyperterm, and the green light on the bluesmirf goes on, but nothing I type gets a response, which I'm guessing has to do with the baud rate? But when I go to configure the com port settings in hyperterm, nothing happens--the "configure" button, which usually makes the little settings window pop up, does nothing.

    Reading through the making things talk page, it looks like he was able to communicate with the device through hyperterm to change the baud rate, but I can't seem to get any response at all from the smirf. is this because I've got it hooked up to the basicstamp at the moment? do I need to use some other device while I change the baud rate?

    thanks!
  • voodoofishvoodoofish Posts: 67
    edited 2008-05-14 21:45
    It should recognize it as firefly[noparse][[/noparse]2 hex values] so yours sounds like it's finding it correctly.


    For the first issue on not being able to edit the com settnigs, this is correct. the button was grayed out for me as well, but you can configure it elsewhere. I'll check this out when I get home though I think it can be set up either by editing the com port in the bluetooth utils(whatever is installed on your windows setup).

    As far as communication, if you have the baud rate and all set up correctly, have you tried to get it into command mode using "$$$"? without quotes of course...
    You have 60 seconds from powerup to get into this mode. once there you should be able to check your settings or configure them if you are set to the correct baud and other settings.

    As far as responses, unless you have the stamp set up to respond or transmit continuously, you most likely won't see anything. Just typing stuff into hyperterm won't warrant a response unless again, you have the stamp set up to respond. Also make sure you have the wiring correct, this is critical. I have 2 10k ohm resistors connecting the transmit and receive pins to the bs2.
    If anything, I would first program the stamp to transmit a string(something like "4 8 15 16 23 42") to make sure you can receive it first. This is the easiest thing to test when starting wireless transmissions. Once you are receiving in hyperterm, then you can code the bs2 to respond to your commands.

    You're at least at a good point where you can connect to it...so, thats half the battle. [noparse]:)[/noparse]

    I can post the code(when I get home) I have which I added some two way com to mine now. The bs2 sends data then waits for a response. if it gets the correct response, it resends the all clear.

    --edit--

    okay to get to the com port config, right click on my computer, click manage then go to device manager. From there click on Ports(com & lpt)
    in there you should see the port that you are using(serial over bt com 3 for me) go to properties then port settings and you should be able to modify the settings

    Post Edited (voodoofish) : 5/15/2008 6:25:45 AM GMT
  • flippydooflippydoo Posts: 8
    edited 2008-05-20 05:21
    okay, I got in through my computer and edited the com settings, but still when i type in $$$ (or anything else) I don't get any response from the smirf, when I think that I should be getting OKs. So even though the led on the smirf switches from blinking red to green as soon as I establish the connection through hyperterm, I feel like there must be something going wrong connection-wise.

    I've still got it hooked up to the basic stamp, since I don't have any separate serial communication device, but I'm not looking for any responses from the bs2 just yet, since I still haven't managed to change the baudrate on the smirf from 115200 to 9600...I'll keep fiddling, but no luck so far. I shouldn't need the baudrate to be at 9600 just to get the first few OKs in hyperterm, right? even though I'm using the bs2 to power the smirf at the moment, i figure that since it's establishing a connection with the computer the baudrate shouldn't be an issue.

    Post Edited (flippydoo) : 5/20/2008 5:53:14 AM GMT
Sign In or Register to comment.