Shop OBEX P1 Docs P2 Docs Learn Events
PLEASE HELP with SERIN, newbie so close to breakthrough!!! — Parallax Forums

PLEASE HELP with SERIN, newbie so close to breakthrough!!!

reenignEreenignE Posts: 3
edited 2009-07-02 23:27 in BASIC Stamp
I will admit I have made no contribution to this forum, however when I complete the first working version I will post what I have on the completed projects section.· First however I will need help with having my BS2e accept what I assume should be TTL data on PIO 3 from my bluetooth module (Bluesmirf).··

I`ve set every UART setting on both the Bluesmirf and Hyperterminal to 2400-8-N-1 and confirmed via hyperterminal command to/from Bluesmirf via bluetooth command `G` after connection. As you can see below my source for the SERIN command uses a baud value of 396 or 2400 after conversion.

My basic stamp is part of ARobot (link below) and my bluetooth module is on the optional·expansion board that can ship with ARobot.· The bluetooth module is a Bluesmirf RP-SMA (links below)·and it outputs data from the Stamp to the Bluesmirf, over bluetooth to my PC's hyperterminal quite well.· I can even detect the data·received from the·PC on the TX of·the Bluesmirf·after my voltage divider. Moreover,·that data looks nearly IDENTICAL to the output from the stamp!?!?!


I've attached a basic schematc and screenshots of my oscilloscope readings (letter `k` from Bluesmirf, and I don`t remember what came from the Stamp); my source code is below.· Links to·ARobots and Bluesmirfs user guides will·precede my·source code below.


http://www.sparkfun.com/datasheets/Wireless/Bluetooth/rn-bluetooth-um.pdf· (data commands for Bluesmirf)
http://www.sparkfun.com/datasheets/RF/BlueSMiRF-RPSMA-Schematic.pdf· (Bluesmirf shematic)
http://www.arrickrobotics.com/arobot/guide.pdf·(PAGE 31 for ARobot·PINOUT / shematic)

SOURCE

' {$STAMP BS2e}
' {$PBASIC 2.5}
··· T2400············· CON····396
··· T9600············· CON····84
··· T16780············CON···· 16780···· '2400 baud, inverted, N, 1
··· T16468············CON···· 16468···· '9600 baud, inverted, N, 1
··· strData············VAR····· Byte
··· strOutput·········VAR······Byte(10)
··· S_IN··············· PIN······3 'pin 8 on the primary pinout - see ARobot User guide
··· S_OUT·············PIN····· 5 'pin 10 on the primary pinout

SEROUT S_OUT, T2400, [noparse][[/noparse]"Connected!", CR]· 'This is received by PC's Hyperterminal nicely!
Main:

DO
· SERIN S_IN, T2400, 10000, Main, [noparse][[/noparse]strData]
· '
· 'cycle the lights each loop cycle to provide visual feedback
· HIGH 10
· LOW 11
· PAUSE 2000
· LOW 10
· HIGH 11
LOOP
END


Please help a total electronics newb, I gave this a SERIOUS attempt before bothering you fine folksjumpin.gif

p.s. this is like my 5th time using an oscilloscope ever so I don't know if that could be the problem. Also there is continuity between the TX on the Bluesmirf and PIO3 on the stamp, I checked with a DMM.

Best regards,

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-02 05:49
    The problem may be the resistors. You should use something like a 1K resistor between the Bluesmirf RX pin and the Stamp I/O pin and a 1K resistor between the Bluesmirf TX pin and the Stamp I/O pin. That's all.
  • stamptrolstamptrol Posts: 1,731
    edited 2009-07-02 15:05
    · Your Bluetooth modules are designed to use "real" RS-232 signal levels.

    · When using them with the Stamp i/o pins, you'll probably have to use the "inverted" settings for the SERIN and SEROUT.

    · Alternatively, you can use i/o 16 which is the programming port which has the level shifting built in.

    · Cheers,



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • reenignEreenignE Posts: 3
    edited 2009-07-02 19:14
    Thanks for both your replies.· I only have PIO 2 through PIO 7 available to me on the BS 2e as it's part of ARobot.· Almost all documentation has covered communication over pins 0/1 but I have found very little on the exact needs of data sent to the other IO pins on the stamp.· I'm pretty sure they are supposed to be TTL (0-5V) so I'm wondering if my voltage might be to higher or lower (between 2 and -8V now)·or whatever.· I have oscilloscope screenshots for those who might use them.· As for the idea about 1 kOhm resistors, I'm going to the electronics store now to buy some.· Page 19 of this manual http://www.sparkfun.com/datasheets/Wireless/Bluetooth/rn-bluetooth-um.pdf

    specifies the use of a voltage divider, would this be connected to the TX pin of the Bluesmirf since I'm running a 5VDC power supply?


    THanks again for any help, I feel like I'm so close hereshocked.gif
  • reenignEreenignE Posts: 3
    edited 2009-07-02 23:27
    Mr. Green you have made my day.· I have to admit I had little faith but as always experience reigns supreme. The Bluesmirf's TTL output is recieved by the Basic Stamp; the 1 K Ohm resisor made all the difference! At this point I'm not even sure if the Stamp is getting readable data, but SERIN accepts it and my LED changes color.· THANKS to both of·you have really made my day.· I will try to post if and when I am able to do so confidently. If anyone's interested, I will email you schematics and source for Bluesmirf/Basic Stamp 2-way serial communication.



    BEST REGARDS yeah.gif <= this actually expresses how I feel quite well.
Sign In or Register to comment.