Shop OBEX P1 Docs P2 Docs Learn Events
Wheel Kit Position Encoders and 1-wire UART — Parallax Forums

Wheel Kit Position Encoders and 1-wire UART

spletcher1spletcher1 Posts: 7
edited 2011-02-08 15:23 in Robotics
Hi all,
Has anyone successfully controlled the "Motor Mount and Wheel Kit" motors and encoders from a standard microcontroller UART port?· I am using a PIC32 and having a heck of a time figuring out just how to hook this up and receive numbers correctly.· Currently, I have tied the rx pin of the PIC together with the data line of the encoder and pulled them·up to 5V (10K resistor).· I then connected the TX pin of the PIC to this bus with a diode (cathode at the TX pin) to allow the encoders to pull the line low when transmitting.· I am able to successfully transmit to the encoder and to receive bits back, but I consistently get the wrong information when reading back the response.· For example, when the reply to the 0x09 command is 0x00 0x00, I always receive 0xC0 followed by 0x80.· I have verified that the repsonse is indeed 0x00 0x00 but I am not reading it correctly.·

Any ideas on what might be going wrong here (perhaps I need a better buffer circuit to control the TX pin??)·or any suggestions in general for communicating between the encoders and· PIC would be appreciated.

Thanks!
Scott
·

Comments

  • Trust3rTrust3r Posts: 1
    edited 2010-05-23 00:00
    Hi,
    I have the same problem. I have the position controller kit but I don't know how to interface it with standard microcontroller UART port (I use the atmega1280).
    If anyone can help...

    Thanks
  • Ryan HickmanRyan Hickman Posts: 2
    edited 2010-07-03 21:07
    I would also like to know how to communicate with one of these. The website said "serial interface" and I assumed it was a two wire Tx/Rx solution. I have an Arduino and a serial Bluetooth device (BlueSMiRF) as well as a USB to serial adapter from Sparkfun. All of them have Tx and Rx pins and I'm not sure how to turn that into single wire UART.
  • hover1hover1 Posts: 1,929
    edited 2010-07-03 22:28
    I’m assuming we are talking about the Parallax product #27941, “Motor Mount and Wheel Kit with Position Controller”.

    While I do not own one, I will only try to offer some info from what I have read in the documentation.

    As with many Parallax products, this uses on line for transmit and receive. You will have to transmit a command or query on one pin, and then wait for the response on the same pin. It is standard TTL interface at 5 volts, Half-Duplex, at 19.2KBaud, 8 Bit, no start bit, no parity, 1 stop bit. You should not need any external components to connect to a 5 volt MCU.

    You may have to adjust the STXD (Set Tx Delay) time to create a delay for you particular MCU per the documentation.

    Jim
  • Ryan HickmanRyan Hickman Posts: 2
    edited 2010-07-09 02:29
    Thanks for the info hover1. I'm unfortunately not having any success.

    Has anyone connected the Parallax wheel kit position controller to an Arduino? A search on the interwebs didn't find anything. The software serial library only operates at 9600baud so I don't see how to make that 1-wire solution work for this.

    Even without reading back info, I can't get the right bytes sent. I can sometimes occasionally make the motor move but very unreliably. I've tried sending at 19200bps over Bluetooth, wired directly, and from an Arduino. Maybe I'm not reading the docs right on the high bit and low bit part.

    Is there a recommended micocontroller to work with this kit?
  • spletcher1spletcher1 Posts: 7
    edited 2010-07-14 00:57
    After some playing around, I was able to communicate from my PIC32 to the encoders using a standard UART port. Basically, I configured the port as you would for two wire UART using 19.2KBaud, 8 Bit, no start bit, no parity, 1 stop bit.·I then tied the rx pin of the PIC UART together with the data line of the encoder and pulled them·up to 5V (10K resistor).· I then connected the TX pin of the PIC to this bus with a diode (cathode at the TX pin) to allow the encoders to pull the line low when transmitting. Anything transmitted from the PIC will echo on its rx pin, but I just ignore those signals and then wait for the response from the encoders.· This works fine (for the most part), but I am still experiencing some strange behaviors when the wheels are moving at high speeds.· At low speeds I can query the controllers, set destination points, etc. without a problem.

    I am a bit of a hack, but I'd be happy to send you my code (in C) if you think it would be helpful.

    Scott
  • dracusdracus Posts: 9
    edited 2010-12-14 18:28
    Hi, spletcher1. Could you please send me the code as well as some small Diagram. I am using DSpic33 and I am having a hec of a problem trying to stablish communicatcion.
  • NikosGNikosG Posts: 705
    edited 2010-12-18 04:46
    Hi guys,
    I don't know if this help But I have successfully controlled the Wheel kit with position controllers using a Basic stamp 2e module.
    You can see the diagram on the bottom of my thread: "Nikos 4WD Rover"
  • AlkarexAlkarex Posts: 30
    edited 2011-01-21 13:01
    Hello,
    I have also the same problem, namely of how to talk to a Position Controller Kit #27906, and I would like to hear if there has been any progress or advice from Parallax since the last post on this thread.

    More precisely, I am trying to control the system from a PC via USB:
    PC/USB → [?] → Position Controller → HB-25 → Motor

    More details on my problem:
    http://forums.parallax.com/showthread.php?128787-Position-Controllers-from-a-PC-via-US

    As mentioned before, the issue is that the Position Controller kit communicates through a "Single-wire TTL-level UART @19.2 kbits/sec", which is not very standard or common, and therefore difficult to work with, especially for a software guy like me who was expecting plug-and-play...

    As far as I can see, there are 4 possibilities to talk to these strange beasts (ranked by my current order of preference):

    1) Find an off-the-shelve adaptor... but I have found none yet :frown:

    2) Transform a standard UART device (that has two distinct lines for Rx and Tx) into a single-wire UART (that has a single line for data).
    Some good explanation are given in the thread "Probably impossible: Position Controller 29319 with two-wire serial connection", which involves a 10KΩ resistor and a small diode.
    http://forums.parallax.com/showthread.php?123941-Probably-impossible-Position-Controller-29319-with-two-wire-serial-connection#post_922604
    In my case, I am considering doing this hack on a device such as the Prop Plug #32201
    http://www.parallax.com/Store/Microcontrollers/PropellerTools/tabid/143/List/0/SortField/4/ProductID/398/Default.aspx

    Another related thread with apparently conflicting informations:
    http://forums.parallax.com/showthread.php?104828-Position-Controller-from-Motor-Mount-kit

    3) Use a microcontroller board for the bridge between USB and the single-wire UART.
    I am considering reprogramming the firmware of the "Propeller Servo Controller USB" #28830 for this job (which I have erroneously bought). If it is not fit for the job, I could buy something like the "Propeller Platform USB" #32208, although it is quite expensive for such a small task.
    In any case, it would require writing the proper firmware or finding one doing the job (which I have failed to find yet).

    4) The last option I see is to re-wire properly the ATtiny 2313 microcontroler used by the Position Controller Kit in order to get a standard UART by wiring PDA0 to TX, and PDA1 to RX (I guess). A schema is given in the PDF documentation of the Position Controller Kit.

    Which of them do you believe is easiest and much likely to work properly (for a software guy)?

    Any further help on the matter would be appreciated.

    Thanks!
    Alexandre
  • dracusdracus Posts: 9
    edited 2011-01-24 04:56
    Hi...

    After so many trials, I´ve been able to controll the position controller kit from Parallax with the dspic. I am able also to read the data from the position controller. Next I am going to try to bring all of that to Matlab. I am using the explorer 16 board. There might be some bugs, which I am trying to correct, but right now I have a rough draft of the progres... I don´t know if that is of any help....
  • AlkarexAlkarex Posts: 30
    edited 2011-01-24 05:02
    dracus wrote: »
    After so many trials, I´ve been able to controll the position controller kit from Parallax with the dspic.

    Hello dracus,
    Thanks for your answer.
    Could you please say a few words about how you did the connection to the dspic?
    Best regards,
    Alexandre
  • dracusdracus Posts: 9
    edited 2011-01-24 05:10
    I used a Diode 1N4007, cathode to the Tx, Anode to Data of the Positon Controller, Anode to the Rx, Anode to 10 K resistor (pull up), 5 volts to the other end of the resistor. Someone in the forumbefore talk about this before.
  • dracusdracus Posts: 9
    edited 2011-01-24 05:47
    Dr. Alexandre.... Do you need any additional information??? Willing to help you out....

    Regards...
    Victor Costella
  • AlkarexAlkarex Posts: 30
    edited 2011-01-24 11:38
    Hello dracus,
    Thank you for your kind feedback. Yes, this is exactly the type of information I need. :smile:
    This procedure is indeed reported in http://forums.parallax.com/showthread.php?123941-Probably-impossible-Position-Controller-29319-with-two-wire-serial-connection#post_922604
    I have tried to make a schema out of it (I am not sure if it is correct, as this is not really my field):
    USB-to-single-wire-UART.png


    I have also found a USB adaptor that could apparently be used:
    Basic ATOM Nano USB2Serial Adapter #B0083
    http://www.basicmicro.com/Basic-ATOM...pter_p_35.html

    I still need to figure out what will be most convenient for my setup.

    The other issue I am facing is that I am unsure if I should let the Position Controllers talk to the Motor Controllers (HB-25), or if I should do that manually. The position controllers seem to be quite limited (e.g. no possibility to decrease speed while driving for smooth turns). But this is I believe the topic for another discussion thread!

    Thanks,
    Alexandre
    829 x 417 - 4K
  • dracusdracus Posts: 9
    edited 2011-01-31 19:33
    Hi again

    The diagram seems to be correct. I have used the HB25 alone to control a dc gearhead motor, yes is possible....

    What pic are u using???? I be willing to sen you the codes I have so far (in C), and I don´t see any need to use any other hardware....Perhaps some pictures will be of help.

    I am trying to build a robot for my PH D and I am going to get into a Zigbee device, so I can send the innstructions wireless...

    Regards...
  • AlkarexAlkarex Posts: 30
    edited 2011-02-01 01:19
    Hello Dracus,
    Thank you for your feedback.
    Right now, I am controlling the HB-25s from a "Propeller Servo Controller USB" (#28830), which works fine. I would however like to take advantage of the Position Controllers (to get position, speed, and e.g. drive more straight). I will probably only want to receive some information from them, and not use them to control the HB-25s due to their apparent lack of flexibility (e.g. decrease speed while driving) - I will have to check.
    When I find time in the coming weeks, I will investigate one or more of the following solutions:
    • Modify the firmware of my "Servo Controller USB" (P8X32A-M44 Propeller chip) to dedicate 2 pins to the communication with the Position Controllers.
    • Use a Basic ATOM Nano USB2Serial Adapter.
    • Buy another microcontroller board for this task (to be defined).
    Best regards,
    Alexandre
  • dracusdracus Posts: 9
    edited 2011-02-08 15:23
    Hi Alexandre...

    I am still working hard with the position controller. It is really tricky. Still I am expiriencing some reception problems....

    I was ckecking on the
    http://www.basicmicro.com/Basic-ATOM...pter_p_35.html

    but I am still not sure if if is the best choice. I am working with a dspic33 device. Seems that, if I get to recieve data correctly, the position controller is really cool, because it manages speed preciselly. Please let me know of any of your advances.

    Regards....
Sign In or Register to comment.