16 Devices using USB-to-Serial Adapter

I want to connect 16 devices, each one using “Pololu USB-to-Serial Adapter” and a USB HUB. All the devices are identical, but I want to access them independently. Will I be able to address them independently? How the COM ports will be distributed between them ? randomly?

Hello,

Each adapter has a unique serial number that allows the operating system to address each unit individually. Each adapter will get assigned a different COM port, and you can set the port numbers in the device manager.

Some software can have trouble using serial port numbers above COM4. If you are not sure about your software, you could get one adapter and configure it to a higher port number to do a test.

- Jan

Further to your discussion above…say I connect 1 adaptor to my pc…

Q1: then connect tx of adaptor to rx of adapter to…will it pass the hyperterminal-loop test ?

Q2 : say I get it as COM4… How do I address the COM4 thru VC or VB… i.e. COM1 is 0x3F8 - 0x3FF, but what about COM4 ?

Please help !

Hello.

I’m not familiar with the hyperterminal loop test. Connecting RX to TX on the same unit will result in the data you send to get sent back; some programs need the hardware handshaking lines to be connected in certain ways, too.

I think Windows doesn’t let you write directly to hardware addresses that way since about Windows 98, but I don’t know that much about Windows programming. The recent versions of Microsoft’s free .NET tools (including VB and C#) have direct support for accessing COM ports. You can look at a tutorial by one of our customers for an example: http://www.colinkarpfinger.com/pololu/.

- Jan

Thanks for above Jan. One more thing.

I am using UART of ATMEGA16 (AVR microcontroller). So I can connect Tx of usb-to-serial adaptor to Rx of ATMEGA16 & Rx of usb-to-serial adaptor to Tx of ATMEGA16 without anything else & software drivers provied by pulolu…Hope I am right ?

Right. (You’ll still have to write the main code on both sides.)

- Jan

With reference to “…both sides…”, I can understand writing main() & other code at the microcontroller side. But I think I will have to install driver for the adapter on my laptop but no code needs to be written in addition to it. Hope I am right ?

The driver just makes the adapter look like a serial port. You still have to write the code that will do something with that serial port.

- Jan

I can use Matlab to read & write to this serial port, right ?

Yes, you can use Matlab to read from and write to any serial port installed on your computer, including USB-to-Serial adapters. After you install the adapter drivers, it will work just like any other serial port on your computer, so you can use Matlab, a terminal program, or software you write yourself to read from it and write to it. It’s your choice.

If you search the forum for ‘matlab’ (using the ‘Advanced search’ link) you’ll find some discussions and example code, and be sure to let us know if you run into trouble.

-Adam

Thank you Adam.

I am using Dell - Inspiron 6400 laptop with windows XP SP2. Hope the adaptor will work smoothly with it ?
Please suggest.

I’ve had very good experiences with Pololu USB to Serial adapters and windows XP. I particularly like them because they’re so small, but they still bring out all of the handshaking lines, which can be a real lifesaver if it turns out your device needs to do some hardware handshaking (like a serial radio that can’t buffer new bytes while it’s transmitting for example). I’ve also used them with Matlab in a couple of projects with no trouble, although I haven’t tried such high com port numbers before.

If you need to buy so many there are some slightly cheaper boards available from other suppliers (SparkFun for example), usually based on FTDI usb to serial chips. Pololu uses the Silicon Labs CP2102 chips: different brand, similar functionality. I’m personally biased against the FTDI chips because I had one up and die at a critical time, but they’re quite widely used and work just fine most of the time (I’ve never heard of someone else having a similar experience).

If you’re sure you only need very basic TX and RX functionality you can occasionally find really cheap basic breakout boards on eBay for $6 or so, but I don’t see any on there right now.

Anyway, I hope that information helps you make your decision. What are these devices that you want to control 16 of from your laptop?

-Adam

A little followup to the concern Jan raised, I just tried writing to and reading from a USB to serial adapter set as COM16 using Matlab, and it worked perfectly!

-Adam

Actually it is like this. I purchased a new BAFO usb-serial adaptor which did not work on my laptop. It failed even the loop test. So I am being a little thoughtful before going for this adaptor. I am happy to know that it worked well with Windows XP

Unless I’m missing something, it looks like BAFO only makes USB to RS-232 serial adapters, for devices that would normally plug straight into a computer serial port.

The Pololu USB to sreial adapter outputs TTL-level serial, which is not the same as RS-232.

Do you know if you need RS-232 or TTL level serial? They use similar protocols, but the voltage levels are very different (and inverted) so they’re not compatible. What devices are you planning on hooking up to these serial adapters?

-Adam

I need TTL (5V) levels as I want to hook on the UART of ATMEGA16 (AVR) microcontroller.

I think Serial port output is 9-10 V which need a level converter etc. to convert to TTL levels. So Pololu adaptor must work fine.

As I understand, the Pololu adaptor inverts the output. So if I send “1100” to the adaptor thru my program on my laptop, I must catch “0011” at the UART of the microcontroller. Hope I am right ?

Yes, you can connect the Pololu USB to Serial adapter directly to an AVR UART. The Pololu adapter will output exactly the serial protocol the AVR UART uses, so if you send “1100” to the adapter, the AVR UART will receive “1100”.

You might want to use a 10Kohm resistor to make the connection between TX on the adapter and RX on the AVR. Since they are powered separately (the adapter gets its power from the USB bus) the TX line of the adapter is normally high, and this can weakly run the AVR when external power is disconnected.

The BAFO adapter wouldn’t have worked for you without an additional level shifter/inverter. Aside from the voltage level problem, if the signal was inverted TTL serial, the AVR would receive garbage (not “0011”), since the start and stop bits would be inverted as well.

So, what are your plans for 16 ATMega16’s linked to a computer?

-Adam

Noted Adam. Thanks.

Well about 16 AVRs…its like this…this thread was started by Hugo on Mon Feb 28, 2005 3:17 pm…then Jan replied…then I took over…& Jan & I & you & I & Jan & you & I …and so on…so perhaps Hugo has plans to connect 16AVRs :slight_smile:

So I am yet to connect my first AVR UART to my laptop after I purchase an adaptor. Surely, no sooner than I do that I’ll inform you of how it went !!

Well one thing. Pololu adaptor’s output is 3.3 V & it can accept 0-5 V. Will 3.3 V signal from Pololu adaptor be able to drive AVR UART ?

Aah, well that explains my confusion.

The AVR I/O pins are very forgiving when it comes to input signal voltages, so they’re great for talking with 3.3V devices, so long as the 3.3V device can stand the 5V signals it receives in return, which, as you note, the USB to serial adapter can. Looking at the electrical characteristics section of the ATMega16 datasheet, anything less than 0.2VCC will register as low, and anything greater than 0.6Vcc will register as high. So running at 5V, signals less than 1V will register as low, and anything greater than 3V will register as high.

0.3V for a high signal seems like a narrow margin, but I have used the Pololu USB to serial adapter with a variety of AVR microcontrollers (ATMega8, ATMega168, ATMega128, ATMega32, ATMega324, ATTiny2313) and never had a communication problem. The only trouble is that, since they’re powered separately, the high signal line from the adapter’s TX pin to the AVR’s RX pin can weakly power the chip, but that’s a problem you’ll see when you apply power to the pins of any microcontroller that’s powered down. As I mentioned before, an in-line resistor will take care of that easily.

Good luck, and let us know how it goes!

-Adam

I received the USB-to-Serial Adapter & did the following with it…

  1. Installed it as mentioned on this website…all went well…it was at COM9
  2. Connected the Tx pin to Rx pin.
  3. Made a serial connection at COM9 with Hyperterminal & tried to establish a connection in this manner…
  4. Now I expected that whatever I type on keyboard will go to Tx pin, got to thr Rx pin (as it is connected to Tx pin) and return to Hyperterminal screen.

But it did not happen. In short … it failed the loop test. Please advise.