Second Serial Port

Hello,

I understand that the Photon has just one serial port. If I need that port for debugging, what is the best way to connect a serial sensor (TTL) to the Photon?

For example, can that sensor be converted to i2C etc.

Thanks in advance.

There’s more than one serial port and the way to connect is simply matching the TX and RX pins.

Not so sure what you mean by making it into I2C

I’m guessing Jimmie is thinking of connecting a serial sensor to the I2C line using and I2C uart chip? Although without knowing anything about the nature of this serial device, that is by no means a given.

Serial connectivity to the photon includes the USB port, Serial1 on the RX/TX pins and Serial2 described in this post… Using Serial2 on the Photon which does look fun.

Thank you @kennethlimcp, but I thought that the Photon has only one hardware UART and does not support software serial?

Thank you @Viscacha.

Yes, I am looking to convert my serial device to an i2C device to connect it to the i2C lines on the Photon. Given that i2c can be daisy-chained, this would allow the Photon to read from multiple serial devices all connected to the i2c lines …

Serial2 is too complicated to implement.

Is there a ready-made board that incorporates the serial to i2c change?

Thanks again.

And there also is ParticleSoftSerial.

But for debugging (as mentioned in the OP) Serial and USBSerial1 would be my first choice (in connection with the logging features) .

1 Like

A quick google did bring up a Sparkfun board that is no longer made, I presume there are/were others, however multiple Serial I2C/SPI adaptors on one line is probably a nightmare anyway, serial comms doesn’t always have predictable timing (i.e if you ask a device something it might not answer as quickly as you would like or with all the bytes close together) handling buffers and interrupts for multiple devices doesn’t sound like fun to me. I would look for sensors that already use I2C/SPI, one-wire or even analogue outputs you can more easily interface with the Photon.
There is one downside to using the USB serial port and that is that it also powers the device, so if you had a fault elsewhere that would otherwise brownout or upset the normal power supply you could be oblivious to it.

1 Like

Thank you @ScruffR, I was not aware of a softserial library for the Photon. This is very helpful.