Shop OBEX P1 Docs P2 Docs Learn Events
Probably impossible: Position Controller 29319 with two-wire serial connection — Parallax Forums

Probably impossible: Position Controller 29319 with two-wire serial connection

CliffSCliffS Posts: 12
edited 2014-05-20 14:31 in Robotics
This is probably impossible:

I have a Motor Mount (27971) with the integral Position Controller 29319. They work well under the basic stamp control.

The position controller uses a single-wire serial connection: the DATA communications line is used to send and receive daa, and connects to a single-wire UART bus.

I'm trying to connect the position controller to a system that has a TWO-wire serial communications.
That is, the microprocessor has one wire for transmit data, and a different wire for receive data. (all TTL levels)

I'll bet that this is impossible. Ideas? Suggestions?

Comments

  • TimmooreTimmoore Posts: 1,031
    edited 2010-07-15 01:27
    Get a open collector non-inverting driver, connect its input to the uart tx pin and then connect the output of the OC driver to the position controller and the uart rx pin.
  • CliffSCliffS Posts: 12
    edited 2010-07-15 02:23
    Uhhhm, thanks Tim.

    I just googled "open collector non-inverting driver" and found a TI SN5407 Integrated Circuit.

    So far, so good.

    I buy this chip.

    Then I connect the input of this to the microprocessor's UART transmit pin. OK, so the microprocessor's output goes to the chip.

    Then I connect the output of the chip-driver to the position controller. This will cause the microprocessor's output to go to the position controller. So far, OK.

    Then I connect the output of the chip-driver also to the UART Receive pin. This step is baffling to me:
    This means that the output of the chip-driver goes to both the position controller and the uart receiver.
    Will the Position Controller's output *also* go to the UART receiver?
    (is there magic inside the SN5407 chip that sends its input messages to its output but does not bother other signals that appear on its output?)

    Youth wants to know...
  • spletcher1spletcher1 Posts: 7
    edited 2010-07-15 02:24
    Hi CliffS,

    I have this working using a standard UART on a PIC32 using a simply diode to interface the tx and rx pins on the PIC to the communication bus.· I was having some problems, but this is not related to communication. Right now my post is immediately below yours!·

    http://forums.parallax.com/showthread.php?p=921994



    Scott
  • spletcher1spletcher1 Posts: 7
    edited 2010-07-15 02:26
    Oops I pasted the wrong link. See my original post on this thread.



    http://forums.parallax.com/showthread.php?p=907856



    Scott
  • CliffSCliffS Posts: 12
    edited 2010-07-15 02:39
    Hi Scott,


    Yes, I am facing the exact same problem that you are. *sigh*

    I will try your 10K resistor & diode trick.

    MANY THANKS!

    -Cliff
  • TimmooreTimmoore Posts: 1,031
    edited 2010-07-15 04:22
    CliffS, When you send a command to the position controller, you will also receive it on the uart, so your code will have to ignore commands you send. If I remember correctly the position controller doesn't send except in response to a command. So you send a byte and drop the next incoming byte, any additional received bytes are from the controller
  • CliffSCliffS Posts: 12
    edited 2010-07-15 04:29
    Tim, that makes sense. I'll have to receive all bytes and discard sent bytes.

    These programming problems grow out of using the same line for both transmit and receive.

    Tomorrow, I'm tacking together a 10K resisitor / diode to connect the two-wire microprocessor to the one-wire Parallax encoder. I'll let you know how (if?) it works...


    Cheers all around,
    -Cliff
  • CliffSCliffS Posts: 12
    edited 2010-07-26 00:14
    Thanks for advice and help.

    I built the Arduino to Parallax Motor/Encoder interface (just a diode & 10K resistor to convert from the 2-data wires used by the Arduino serial port
    to the 1-wire system used by the Parallax motor/encoders.)

    I've also written a set of functions to drive the Parallax Encoder/Motor system from the Arduino Mega.

    I've attached the sample program and code to this note (I hope!). Enjoy!

    Best wishes to all,
    -Cliff Stoll
    Oakland, California 2010/July/25
  • Steve_LSteve_L Posts: 3
    edited 2014-04-29 02:07
    Hello Cliff !

    I would like to thank you because your work on those position controllers helped me so much.
    I took a look at your code and it's very rigorous and so well commented.
    I have the exact same configurationn and your "firmware" is very effective and so much things are so simple now...:smile:

    Thank you.

    Sincerely,

    Steve
  • rsummanrsumman Posts: 5
    edited 2014-05-20 14:31
    Hi

    I have a version of the above code (Cliff_Stoll_Parallax_Motor_Control_Functions_for_Aduino.pde‎) which I am running on an Arduino making use of the diode and resistor documented at the top of this file to do the conversion from 2 wire to 1 wire UART. The arduino is wired to the position controllers as follows:
    UART_wiring.jpg

    I have the right motor set as reversed. When the TRVL command is issued with positive counts, the motor mount kit (36 count encoders) behaves as expected. However, when passed a negative number of counts the motors do not reverse, instead they rotate in the positive direction for greater than the (absolute value of) issued counts. Any ideas as to why this would happen? Note that my code 9 (attached) is the same as the above appart from the line that writes to the serial port - I use serial.write(x) instead of serial.print(x,BYTE) since the latter has become deprecated. Would this cause a problem?

    Cheers
Sign In or Register to comment.