Second Serial Port and SoftSerial


I have a Photon that needs to be connected to two serial sensors. As the Photon only has one serial port (actually two but the other is used by the LED), I have used in the past the SoftSerial library which worked well.

However, I have a serial sensor that is giving wrong results with the SoftSerial library.

  1. What could the reason be? (Sensor is using 115200 baud but can use a lower speed).

  2. Is there an easy way to add more UARTs to the Photon?

Thanks in advance for any help.


ParticleSoftSerial is only good for speeds up to 28800 (maybe 38400/57600 for short messages).


Thank you @ScruffR. I will reduce to 38400.

Is there an easy way to increase number of UARTs on a Photon?


Depends what you deem easy.
You could use something like a I2C or SPI UART expander/bridge.


Thanks again @ScruffR.

Can you refer me to a link?


How about LMGIFY?


Thank you at @ScruffR .

Would this also work?


I rather thought of something along the line of this retired product
or this

or a board based on the MAX3107/3109 (or similar) SPI/I2C to UART bridges

or a dedicated UART expander like this

On the other hand, what have you got connected to Serial1?
And what is that sensor you want to run at that high rate on ParticleSoftSerial?


I prefer the SC16IS740. The MAX3107 is virtually useless for async serial without flow control. While it has a 128-byte FIFO, you can’t read from the FIFO while serial data is being received! You have to use flow control or happen to know that no data is being received, or the data can be silently corrupted with a repeated byte.

The RHR is the bottom of the receive FIFO and is the register used for reading data out of the receive FIFO. It contains the oldest (first received) character in the receive FIFO. RHR[0] is the first data bit of the serial-data word received by the receiver at the RX pin. Note that the data read out of RHR can be in error. This occurs when the UART receiver is receiving a character at the same time as a value is being read out of RHR and the FIFO level counter is being updated. In the event of this error condition, the result is that a character is read out twice from the RHR. To avoid this, the receiver should not be receiving data while the RHR is being read out. This can be achieved via flow control, or prior knowledge of the amount of data that is expected to be received.


Thank you @ScruffR.

I am running a distance measurement sensor with a high frequency.


Thank you @rickkas7.

Does the product @ScruffR mentioned above use the SC16IS chip?


The port expander is a different sort of thing, it splits a single serial port into multiple ports, allowing you to select which one you read and write to, one at a time.

As far as I know, no one has ported a driver for a SC16IS7x0 to Particle. I have the hardware and have been meaning to write one from scratch, optimized for Particle, but I haven’t done so yet. Thus it’s only theoretically possible to use one at this time.


In my case, while I do need 2 serial ports, I only need to use one at any given time.

In this case, will that port expander work? It uses the Altsoft serial library …