Wheel Kit Position Encoders and 1-wire UART
spletcher1
Posts: 7
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
·
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
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
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
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?
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
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"
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
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....
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
Regards...
Victor Costella
Thank you for your kind feedback. Yes, this is exactly the type of information I need.
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):
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
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...
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
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....