Shop OBEX P1 Docs P2 Docs Learn Events
Rs232 communication problem with LRF and adaptor USB to 232 REV B Parallax — Parallax Forums

Rs232 communication problem with LRF and adaptor USB to 232 REV B Parallax

FoxFox Posts: 5
edited 2014-04-09 12:32 in Robotics
I have been working on a project to analyse body weight of a pig with 3 LRF. The project consist of creating a sass where the pig will walk inside it and 2 LRF will get the distance from left and right side of the pig inside the sass to get the width of the animal, the height will be taken from a top installed LRF. the 3 LRF are installed on servo-motor. the right and left LRF will be aligned to read the croup of the pig and to align the top LRF at the center of the pig for the height reading. Ha Ha! i already ear you asking how im gonna get the lenght of the pig? Well well well, with speed and time! with two fixed triggering pointing laser that the pig will break when it will pass in the entry. Before the pig pass between the fixed laser a LV-MaxSonar EZ3 high performance ultrasonic range finder will get the speed of the pig and the basic stamp will analyse the time the pig will pass over the two fixed laser , got it!. this is the project in brief.

My problem is that I try to communicate with a usb to 232 adaptor and the soft LRF ImageViewer to have a picture of the pig at the exit of the sass with an other LRF but i always have a time out error after a few second, sometime i see random ascii characteres passing in the terminal console, I tried with a internal PCI 485 Serial card with no success either and yes I had drop resistor the signal level . The usb to 232 adaptor Rev B is from Parallax. I connected the 232 RX to the JP1 Sout of the adaptor and the TX to the Sin. I think the communication signal of the adaptor is TTL level so I dont need resistor to drop the voltage level. The circuitry is on a Breadboard and wonder if it is only the problem because, with experience, i know breadboard can give bad contact or parasite to electronic signal.
If my setup is ok i gonna produce a nice little PCB to get a free error circuitry

after a day of debugging I'm out of imagination!

many thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-07-02 09:02
    You can't use a USB to RS232 adapter to interface USB to a TTL level device. The voltage levels are wrong and it's possible the USB to RS232 device can damage the TTL level device.

    Use a USB to 5V TTL adapter like Parallax's USB2SER.

    The USB to RS232 adapter outputs a negative voltage (typically -7V) for a logic low voltage and a relatively high positive voltage (typically +7V) for a logic high voltage. Both are very destructive to standard 5V logic inputs (like Sin).

    With a question like yours, you really need to post a schematic showing all the connections. It's very difficult to offer advice without more information.
  • FoxFox Posts: 5
    edited 2013-07-02 10:19
    Many thanks for your fast answer

    well about the main schematic of the project, I already produce the PCB for the main circuitry and it works well , i had only the problem with the usb interface to communicate with the LRF.
    But if you think it is a good idea to publish thoses schematic then here we go...
    MainSchematicProg.jpg
    MainSchematicSupply5-12.jpg
    MainSchematicCDS.jpg
    MainBoardBSII.JPG


    The main PCB is not exactly has the schematic since it is only a prototype for now, all inputs voltage capacitors will probably be replace with .33Uf ceramic, CDS Triggers have been change with LDR. The PCB for the LRF use for the image at the exit of the Sass is not made yet since I have problems with the breadbord setup.
    this is the physical prototype on a sketch design
    prototype2.JPG


    I'm not sure if you can see clearly the picture ?

    many thanks again
    bye
    1024 x 703 - 55K
    1024 x 740 - 67K
    1024 x 589 - 38K
    739 x 796 - 140K
    891 x 452 - 42K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-07-02 13:51
    In what manner are you trying to access the LRF via the serial port? As per your schematics the serial port is connected directly to a BASIC Stamp Microcontroller, not the LRF.
  • FoxFox Posts: 5
    edited 2013-07-02 21:26
    I know, the schematic with the LRF that will take a picture is not yet draw and it is not show on any schematics that you see presently , that is why I didn't understand why you asking me to show the schematics

    Lets resume!
    all the stuff that you see is for gattering the body weight of the pig. At the exit of the sass an other fixed LRF that is not installed on the sass but installed about 5 feet apart in front of the exit of the sass will take a side picture of the pig that fit the referenced weight for record. Since the pig have a painting number on then, the farmer with that record(the picture) later on will get those pigs by number that fit the right weight. The LRF that take the picture will be triggered by human with the Image viewer on a autonomous portable computer via the USB2SER adapter.

    you answered to my question a few threads ago ,well exactly your first one LOL
    and i ordered the adapter this morning.

    Sorry for the trouble and many thanks again

    bye
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-07-02 21:35
    I'd suggest you reread Mike Green's post. RS-232 is not the same as TTL. You may be using the wrong adaptor to communicate with the LRF.

    In post #1 you mention an USB to 232 adaptor while in post #5 you refer to an USB2SER adapter. Which is it?

    Is the serial connection to the LRF shared with anything else? I've read about problems when serial lines are shared that it possible to accidentally change baud settings in one device as the PC communicates with a second device connected to the same line.

    (BTW, Imagination is the key to an efficient prototype!)
  • FoxFox Posts: 5
    edited 2013-07-02 22:19
    A pin to pin connection.

    I will connect the rx and tx of the USB2SER adapter to the Sout ans Sin of the LRF.
    I think I dont need the rst pin!

    USB2LRF.JPG
    676 x 535 - 26K
  • FoxFox Posts: 5
    edited 2013-07-02 22:46
    Thanks Duane for my signature

    I have french background!
  • SabotSabot Posts: 4
    edited 2014-04-08 21:00
    Hello,

    Sorry to dredge up an old topic, but I was having a similar problem. I just ordered my LRF and got it today. I spoke with Chris on the phone on Friday about it before placing my order, and he recommended the 4D Systems USB Programming Adapter, which I believe is using RS-232 communication. So far, it works fine with the serial terminal. It's out putting numbers with no issue, but I had the same timeout issue when I tried to use the LRF Image Viewer.

    Based on what I'm reading here, it sounds like I may damage my LRF if I continue using the 4D adapter? Should I now be replacing my 4D with a USB2SER? I will be ordering another 2-3 LRF's, so I want to get it right.

    Thanks for the help!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-04-08 21:55
    A link to the 4D Systems adapter would help us answer your question.
  • SabotSabot Posts: 4
    edited 2014-04-09 08:44
    I just spoke with Chris again... Looks like I should be alright with the 4D systems unit. As he explained, (and I'm paraphrasing here) although RS-232 wiring could be problematic in some situations, the way that voltage is regulated on this circuit should be safe. I will be looking into latency settings to resolve my issue with the LFR image capture timeout. Thanks for the help though. I included a link the the 4D adapter below for reference.

    4D Systems USB Programming Adapter:
    http://parallax.com/product/28072
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-04-09 10:34
    RS-232 is an electrical specification for a single-ended driver of up to +/- 12V meaning the voltage swings both negative and positive. This is not a safe voltage interface to the LRF, however the 4D USB adapter is similar to our Prop Plug and USB2SER in that is is at TTL/CMOS levels which are compatible with the LRF. All too often I hear people say they're using RS-232 on an I/O pin when what they mean is serial. :nerd:
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-04-09 10:46
    I was surprised to see Chris Savage's response and not mine. Then I found my response still sitting in an open tab of my browser.

    I basically said the same thing as Chris but I took longer to say it. We both link to the same Wikipedia page.


    The reason the adapter is safe is it's not an USB to RS-232. The minimum voltage swing for RS-232 is -3V to +3V (it can be as high as -15V to +15V) . The 4D Systems adapter is similar to the PropPlug's 0V to 3.3V output.

    The 4D System adapter has lots of FTDI pins broken out so it can be a bit more useful than the PropPlug in some applications. It also has the 5V power output which is nice (though I agree it shouldn't be used to power the LRF).

    Unless you need the extra features the 4D System's adapter provides, if you're going to purchase more adapters, you might want to think about some of the inexpensive USB to serial adapters on ebay (or the PropPlug).
  • SabotSabot Posts: 4
    edited 2014-04-09 11:25
    Thanks for the additional info. I'm taking a crash course here, but I'm really enjoying it. My background is organic chemistry, but my father ran a TV repair shop out of our house, so I picked up the basics from him. I just need to learn more about the specific protocols that these units are using. The LRF's are for a work application, but after visiting the site, I'm becoming inspired to try a few more projects in my spare time!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-04-09 11:43
    Duane Degn wrote: »
    It also has the 5V power output which is nice (though I agree it shouldn't be used to power the LRF).

    Duane,

    Why would you not recommend powering the LRF from the 4D Systems adapter? I suggested it as a possibility because the adapter powers the uOLED displays which can consume more current than the LRF.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-04-09 12:00
    Duane,

    Why would you not recommend powering the LRF from the 4D Systems adapter? I suggested it as a possibility because the adapter powers the uOLED displays which can consume more current than the LRF.

    Because I was remembering incorrectly. I thought someone who knows more about this suggested against it but now that I stop to think, I realize I'm mixing up this thread with some other (either here on the Parallax forum or on the Let's Make Robots forum). I stand (gratefully) corrected.

    Edit: I just reviewed the thread and I couldn't find anyone warning against the use of USB power for the LRF. I had threads crossed in my mind. Maybe I should take up cross-stitching since I'm good at crossing threads?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-04-09 12:32
    Well, there is some weight to what you were thinking. In order for the USB to drive a device that draws over 90 mA the FTDI chip should really be programmed to request more power. So by default you probably shouldn't do it.

    That said, as I pointed out 4D Systems uses the USB Adapter (uUSB-PAS) to power the uOLED Displays when connected to the PC via this interface. So it should work.

    I was a little surprised to find that the adapter only requests 90mA from the port (the default value). It is possible that a device drawing more current will do one of three things...A) it may work just fine, B) it may cause the USB Hub to report excessive current or C) the devcie may simply not get enough current with no indication why and not operate properly. I could use M_PROG right now to set the adapter to request 500 mA, but I am surprised 4D did not set it that way when the 3.2" uOLED draws 165 mA with a mostly black screen. As I recall if the entire screen were white it would be much higher.
Sign In or Register to comment.