Extending TTL signals

I have a serial (TTL) sensor that will be quite a distance away from the Photon (80 feet).

I tried connecting the sensor to an RS485 board which is in turn connects to another RS485 board (A to A, B to B, and GND to GND). The second RS485 board is connected to the Photon.

I can see the TXD led on the 485 board connected to the sensor, and the RXD led on the RS485 board connected to the Photon. However, the Photon does not seem to be reading anything from the sensor. (I am sure the sensor is working when connected directly to the TX and RX of the Photon).

I would appreciate the community’s help in resolving this problem and thanks in advance.

We would need to see a schematic plus datsheets for all devices as well as photos of the setup. 80 feet is far enough to start causing transmission line issues if the line impedance and terminations are not 120 ohms. People get away with Cat5/6 cable, but it really isn’t correct. H

I would get the 485 comms working separately from the sensor using a TTL-> serial converter first with a short transmission line and correct terminations, then try bridging the 80 feet.

Also, I’m assuming that your sensor natively reports in serial TTL.

Thank you @LabSpokane.

Yes, sensor reports in Serial TTL.

Currently, I am testing the setup where the two RS485 boards are 1 feet apart. I can prepare datasheets but here are the boards I am using.

First suggestion:

Swap TX and RX at the sensor interface. Sometimes these are marked as what they are at the source and sometime reversed.

Second:

I haven’t seen your wiring, but if you’re using a breadboard for the interconnect, use a directly soldered interface.

Third: I’m not sure what wire you’re using, but try using twisted pair Cat5/6 for a short interconnect.

Fourth: to debug comms issues, a pair of FTDI serial to TTL converters are invaluable. You obviously can use your Photon as a bridge, but FTDI has very robust, universal drivers that work well on PC and Mac. This will allow you to test each portion of this setup individually, then add another piece and test again. I would start out with two USB-serial converters each reporting to its own serial comm window (CoolTerm is a good one), and make sure those talk to one another via a direct connect by crossing over RX and TX. Then put the 485 bridge in the middle.

I’m not saying these are cheap, but they are very reliable and are guaranteed to have the FTDI chipset. You want that chipset because its driver well-behaved, particularly under Windows. Other drivers tend to not work well or enumerate new com port #'s every time they connect.

There appears to be little to configure on those and the chip markings are sanded off, so you can’t even search for datasheets. About all you can do is start off guessing that they are 9600-8-N-1 and then hunt and peck at other baud rates if that’s not it.

The last option (what I would suggest) is to simply buy another Photon that’s local to the sensor and then transmit the data over WiFi. That’s really how the device was intended: to get rid of the need to do long distance data cabling. If you’re doing this to learn how to build a RS-485 network, more power to you. I’d just invest in a few good debugging tools, and perhaps some converters that come with datasheets.

2 Likes

Thank you @LabSpokane for your time and detailed help.

I tried swapping cables and TX/RX but nothing worked. I am sure the Photon works, and also the sensor. BTW, I am also sure both my RS485 boards work because I have used them separately with a RS485 sensor.

I just tried a pair of RS232 to TTL converters (per your earlier suggestion), one male and one female, and that worked fine. They look like this:

The problem is that maximum cable length for RS232 is about 50 feet and I need 80 feet.

So the question is why does a pair of RS232 to TTL work but RS485 to TTL does not?

Hello @LabSpokane

Thank you for your time. I appreciate it.

I first swapped A & B but that did not work. Then as a final try, I swapped the Rx and TX lines coming out of the RS485 board going to the Photon and that worked! :slight_smile: :slight_smile: :slight_smile:

For some reason, the RS485 board swapped the RX and TX lines on the receiving side.

1 Like