Close

Oops. Ran out of serial ports on the Pi.

A project log for USB connected Laser particle detector for IAQ

Measure air particulate density levels for PM1 PM2.5 and PM10 on Raspberry Pi and OSx

carboncycleCarbonCycle 10/04/2018 at 05:540 Comments

My favorite sensor platform is Mycodo, that runs on the Raspberry Pi.  And when you use sensors on the Pi, you run out of serial ports quickly.  And I'm coming across more and more sensors that work best via the serial port.  So I have a simple modification of a common USB-UART bridge that solves my serial port count problem.

I chose the CP2102 because one nagging problem that does come up with USB devices is having a consistent device name to reference.  Every time you plug in a device, you may not end up with the same tty port.  Random port assignments take the joy out of plug and play.

The way to fix the random port assignment is to have something in the USB attributes that is unique to that device.  When you purchase these boards, they all have the same information.  You really don't want to change VID and PID because then the driver will note recognize the device and once again, sad face. It doesn't plug and play.

Fortunately Silicon Labs, the maker for CP2102 has a tool they offer that allows you to modify some of the fields in the EEPROM USB attributes like power consumed, Product Name and Serial Number.  This allows modifications on the host udev  configuration so that the USB device ends up with a consistent device name.

The other attribute you can set is power consumed in milliamperes. This is important for power budget calculations done by host devices and some powered hubs.  If the onboard 3.3v is used, you are limited to less than 100mA in any case.  I usually specify 20% above what I have measured as worst case power draw for the attached sensor device.

Discussions