Shop OBEX P1 Docs P2 Docs Learn Events
Connecting the BS2 Board to TTL wireless modem via the BS2 serial port — Parallax Forums

Connecting the BS2 Board to TTL wireless modem via the BS2 serial port

edited 2012-01-22 06:49 in BASIC Stamp
Hi,
Can someone help me please with the problem I’m facing connecting the BS2 board to TTL wireless modem the TTL wireless modem have D9 connector?
Please find attaché all related documents with the VB and BS codes plus the wireless modem manual
What I’ trying is:
1- The first connection is connecting the first wireless modem the RS-485 to the laptop directly to run the VB program to turn ON / Off the LED’s on the BS2 Board.
2- The second connection is connecting the second wireless modem TTL to the BS2 board, which I don’t know how to connect the TTL modem to BS2 serial board. If I connect them directly it will not work.
Thanks in advance for your help

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2012-01-18 09:42
    Welcome to the Forums.

    I couldn't view your diagrams, so I'm somewhat limited in my understanding of your problem.

    First, get the system to work with a direct connection. If it won't work over a cable, it won't work over the radio. If necessary, use the example in the Helpfile under SERIN.

    Secondly, when using pin 16, use the TRUE mode of the SERIN/SEROUT as it will align better with commercial rs232 device signal levels. Similarly, when using any other pin, use the INVERTED mode as it better approximates real RS-232 signals of commercial products.


    Just after the SERIN line in your code, put in a DEBUG statement so you can see what characters are being received. Also, at least during testing, use a real ASCII character, perhaps "#" or "*" instead of 255. It is easier to see on the DEBUG screen.

    Cheers,
  • edited 2012-01-18 09:56
    Hi,

    If I connect the directly (connection between BS2 board and laptop via USB/ RS 232) then it will work. The question how I can connect with the TTL D9 connector and the BS2 board?
    I have converted the word document to PDF for your review please.

    Thanks
  • stamptrolstamptrol Posts: 1,731
    edited 2012-01-19 05:18
    Very good diagram.

    If the system works by direct connection, it should be able to work via radio.

    One point of confusion. You describe the radios as RS-485 modems when the the radios shown are clearly RS-232. Two completely different serial communication standards. The radio may be able to do RS-485, but the PC and Stamp are using RS-232. It also appears the radios are set up for normal serial voltages, not TTL.

    There are two things to check:
    1. make sure that the PC to radio signals are correct: that is Rx -> Tx, Tx -> Rx. At the Stamp end, also confirm Tx -> Rx, Rx -> Tx. The Stamp SERIN/SEROUT should be set to TRUE if using the built in 9-pin connector.

    2. There is the possibility that the modem doesn't fully implement the RS-232 signal levels. I have found this on some older equipment which depend on being connected to a PC or other device with the full negative voltage circuitry. Using a voltmeter, check from (ground) pin 5 to 2, and (ground) 5 to 3 on the modem used at the Stamp. Either pin 2 or 3 should be a negative 7 to 12 volts with the modem powered up and not connected to the Stamp.

    Cheers,
  • edited 2012-01-19 09:22
    Hi Tom,

    I have checked the voltages on the TTL modem as followed:
    Pin 5 and 2 is 5 volts
    Pin 5 and 3 is 5 volts
    Both voltages are positive not negative as you did mentioned.
    Is it possible to connect the TTL modem directly to the stamp serial port?
    Do you know how I can connect the TTL modem to the basic stamp even if I have to use other pin’s not necessarily pin 16 if yes can I have a diagram and the code please

    Cheers,
    Karabet
  • stamptrolstamptrol Posts: 1,731
    edited 2012-01-19 09:44
    Just to be absolutely clear when measuring the modem connector volatges, the meter negative lead stays on pin 5 and the positive lead measures pin 2 and then pin 3.

    If they are truly +5 volts, then we must assume the signals are TTL levels only. This will complicate life a bit. See page 5 in the modem manual.

    The stamp will have no trouble if you use other pins for Tx and Rx. But, the signals coming from your PC are not TTL. A signal shifter chip like MAX232, MAX233 or ST232 would be needed to translate the RS-232 levels to TTL for the modem used at the PC.

    I didn't read the entire manual, but you could check to see if one modem can be set to use TTL and one set for RS-232, but I don't think so.

    Cheers,
  • edited 2012-01-19 10:05
    Hi Tom,

    That is true the voltages are +5 V.
    The modems I have can communicate between each other on RS and TTL levels.
    Can I use the following in my BS code instead of pin 16?
    SERIN 0,16780,[WAIT(255),PinNumber,PinState]
    SEROUT 1,16780,[PinNumber,PinState]

    Cheers,
    Karabet
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-19 12:50
    Page 16 of the manual mentions a rotary knob to select the communication protocol.

    Do your radios have this option?
  • stamptrolstamptrol Posts: 1,731
    edited 2012-01-20 05:53
    Karabet,

    Assuming TTL levels, the use of PIn 0 and PIN 1 should work. Note that 255 is a poor choice for a wait character, IMO.

    That doesn't address the issue at the PC end. Are the levels switchable, as queried by Duane?

    Cheers
  • edited 2012-01-22 06:49
    Hi,

    Problem solved, with changing the entire Buda rate to T9600 in the stamp and the wireless modems and it is working.

    Tom, Thank you for your support and advice.

    Duane, Thanks for your advice.

    Cheers,
Sign In or Register to comment.