Two software serial port using ParticleSoftSerial library


Is there any way to use two software serial using ParticleSoftSerial library?

I am already using particleSoftSerial library for one uart but i need second one in particle p1.

@ScruffR, Will you please give suggestion on this?


Nope. You can only have one PSS instance but the P1 also has two HW UARTs - whether both are available depends on your PCB design and whether you use the RGB LED on the same pins as the Photon or alternative ones.

But the limitation on PSS is also documented

*  Notes:
*  Import SparkIntervalTimer library (by Paul Kourany)
*    Due to limited free timers and to avoid interrupt mashup, only
*    one active instance is allowed.
1 Like

@ScruffR, Yes i am already using both hw UARTS - one for RGB led and other for serial log.

And Led indication is also require for me to get reset/connected/disconnected/safe mode indication.

Is there any way to shift led to another pins and also change in bootloader so i can use RGB led HW UART?

Thanks for quick reply.

You can use RGB.mirrorTo() to redirect the RGB output to three other PWM pins.
That setting can be made sticky so that even in SafeMode or when you flash other firmware the mirroring will still happen.
To undo that change you’d need to call RGB.mirrorDisable()


Ok. got it but also low on pwm pins…:confused:

Is there any way to change in code so i can get RGB signal on single pwm pin and instead of RGB led i will use neopixel led so i have HW serial free to use.


You can still use the default RGBR pin so you’d only need two alternative PWM pins and you can have either blue or green assigned to a non-existent pin.
If you want to use a NeoPixel you can’t use RGB.mirrorTo() but you can use RGB.onChange()
Which is also suggested by the reference docs about Serial

RGB.mirrorTo() came later so that’s not mentioned here as it is less flexible but has the benefit of being sticky, which RGB.onChange() is not.

You mean you have already used all 14 (+2 RGBB & RGBG) the available PWMs even the extra ones (P1S0, P1S1 & P1S6)?

1 Like

You can add an I2C or SPI UART easily. The SC16IS740 works great on the P1 (also the other 2nd and 3rd-generation devices) and you can connect many of them.


Not all pin as PWM but some of them as PWM, analog pins, software serial, HW UART so not any pin is free. even using one GPIO expander.


In that case I think you should definetly go with @rickkas7’s suggestion and opt for a UART expander and keep the RGB as is.

1 Like

@rickkas7, Yes that will be last option as i have to redesign pcb and thank you for IC suggestion.


@ScruffR Yes. I think that will be best.

Thank you for support. appreciate it.:+1:

1 Like

Hi @rickkas7

Any through hole I2C/SPI based UART IC for particle device suggestion please?

Thank you.

I think nowadays you’ll have much more luck looking for a breakout board that facilitates a SMT chip. There are many around for the SC16IS740 and with that you already have a working library.

Rick has even designed his own

@rickkas7, @ScruffR

Got SC16IS740 chip on my board.

Can’t I use MCP23017 and SC16IS740 library both in same code?

I am already using MCP23017 lib in my board but when i try to add SC16IS740 lib… RGB led show “1 blink between 2 SOS”. example of SC16IS740 is working perfectly in my board.


Which Particle device (Photon, Electron, Argon, etc.)?

Is the SC16IS740 in I2C or SPI mode?
Which MCP23017 library are you using?

It should work fine to have both connected to I2C.

The SC16IS740 uses addresses 0x4d, 0x4c, 0x49, 0x48.
The MCP23017 uses addresses 0x20 - 0x27.

Be a little careful with the pull-ups with multiple devices. If you are using bare chips you should only have one 4.7K pull-up on each of SDA and SCL.

If you are using breakouts with 10K pull-ups, it will probably be OK to have them on both devices so you end up with 2x 10K in parallel.

1 Like

Particle Device : P1

  • I2C

Using separate resistors of 2x 10K for MCP23017 and SC16IS740.

MCP23017 address is A2 - 0, A1 - 0, A0 - 0
SC16IS740 address is A1 - 0, A0 - 1

@rickkas7 Also SC16IS740 example working perfectly