I am using this adapter: https://www.pololu.com/catalog/product/391, connected to a sonar range finder (MaxSonar LV-EZ0) which returns RS-232 data.
Before using the adapter, I was using a standard DB9 wire coupled with an USB wire (you will find enclosed the wiring) and it worked well (no problem reading the ASCII output).
The device is correctly detected by the computer (driver installed), but the data I receive is inconsistent.
Instead of reading the range as follows :
I get this (some chars are missing, such as these: http://www.fileformat.info/info/unicode/char/25fb/index.htm) :
So, the “+” seems to match the original “R”, but I don’t how to read the others chars…
Any idea ?
The Pololu USB-to-Serial Adapter communicates with non-inverted TTL signals: LOW means 0, HIGH means 1. This is compatible with most microcontrollers.
The Maxbotix LV-MaxSonar-EZ0 Sonar Range Finder MB1000 uses inverted TTL signals: LOW means 1, HIGH means 0. The voltage levels are not technically RS-232, but since it is inverted you can generally plug it into an RS-232 port and it will work, as in your previous setup. However, you would need an inverter to connect it to the Pololu USB-to-Serial adapter.
There is more information from MaxBotix here:
You might be able to use https://www.pololu.com/catalog/product/1606 or https://www.pololu.com/catalog/product/127 but I have not looked into it enough to be sure.
Thanks for the quick reply.
The easiest and cheapest solution would be to use MAX232 inverters then, but I would have preferred a software solution…
Does that mean that I only have to use a NAND gate to make it work ?
I’ve tried finding a logic to the data received, but it’s just non-sense.
This adapter https://www.pololu.com/catalog/product/127, as you mentionned, seems to answer my need as it converts the TTL signal (low voltage) to standard RS232 voltage.
What if I try inserting it between the range finder and the USB-to-Serial adapter ? Will it work ?
I might still have to invert the signal afterwards, but I can do it in a code line.
You only need an inverter. It is possible to wire a NAND gate so that it acts like an inverter, and that would work. Another simple way to make an inverter would be to use a pull-up resistor and a transistor.
I checked the voltage thresholds on the Pololu 23201a Serial Adapter and it looks like it will probably work for you. You would not have to invert the signal afterwards.
I recycled a 4011 circuit and used one of its NAND gates. It works perfectly
Thanks for the help !