3
\$\begingroup\$

I'm developing a set of boards that will all be listening to a single 3.3V 38400 baud UART (single TX device, my boards all listen to this line, no "RX" line). They are designed such that there are two RJ12 jacks per-board, and the signal and ground is just passed between the RJ12, with the signal going to the uC on each board. The idea is to daisy chain up to max 5 of these boards, with less than a foot of cable between boards.

multiple boards strung together

Here's what the signal looks like after 1x 6" cable, a board, and another 6" cable.

oscope1 oscope2

How far can I reasonably expect this setup to work? I'm considering scrapping the whole thing and using RS-422 or RS-485 drivers, but that feels silly when these boards will have a 6" cable between them.

On a broader scale, how do you predict usable cable length given a baud rate and voltage level?

\$\endgroup\$
  • \$\begingroup\$ wait, is this a multi-tap bus (i.e. all µC inputs are electrically parallel) or is this a daisy-chain design where the first µC gets a signal on RX, and repeats it on its TX, which connects to the second µC's RX, and so on? \$\endgroup\$ – Marcus Müller Aug 11 at 15:43
  • \$\begingroup\$ This is a multi-tap bus. \$\endgroup\$ – willem.hill Aug 11 at 16:41
  • \$\begingroup\$ hm, might be interesting to see how much of the signal is swallowed by capacitive loading. You don't happen to have an oscilloscope? \$\endgroup\$ – Marcus Müller Aug 11 at 16:59
  • \$\begingroup\$ by the way, these output transistors look beefy; nice thing! \$\endgroup\$ – Marcus Müller Aug 11 at 17:00
  • 3
    \$\begingroup\$ @willem.hill the resistors do make a lot of sense once you go high enough in rates; good idea to have them. Now, the scope picture looks extremely good. \$\endgroup\$ – Marcus Müller Aug 11 at 17:25
3
\$\begingroup\$

To find the distance a signal can go the physical layer of communications needs to be specified. RS-422 & RS-485 define a physical layer that can be "looked up". Descriptions such as UART do not define a physical layer and so are difficult to "lookup up" or comment on.

The cable used for long communications connections can play an important part in delivering a strong signal while mitigating the effects of electrical noise. Registered Jacks sometimes use twisted pair cables to accomplish this. But specifying an RJ12 Registered Jack does not ensure this type of cable is used.

There are several other concerns when dealing with communications over cables. Ground Loops being among them. In extreme cases optical isolators are used to mitigate the effects of Ground Loops.

For this particular case, 0 to 3.3 V swing at 38400 baud over a 6 inch cable, it can only be said that it is a bit surprising that it does not work. Consider the wiring is faulty or the signal is logically inverted. Then consider that the protocols at both ends do not match (such as parity, number of bits & length of stop). Finally consider the speed it too great for the hardware or software to handle.

On a broader scale, how do you predict usable cable length given a baud rate and voltage level?

It would be difficult. Many other factors affect the signal such as line, source and termination impedance. Inspecting the signal with an oscilloscope at the source and destination may give some insight.

\$\endgroup\$
  • \$\begingroup\$ Sorry to not be clear... The cables are 6 inches, but the signal is also getting passed through a 6" long PCB from the RJ12 jack on one side to the RJ12 jack on the other side. Here's a render of the exact project I'm working on: github.com/willemcvu/midi-solenoid-driver/raw/master/hardware/… \$\endgroup\$ – willem.hill Aug 11 at 16:45
  • \$\begingroup\$ It works, I just would like to theorize how much distance I could get with the current setup safely. \$\endgroup\$ – willem.hill Aug 11 at 17:18
  • 1
    \$\begingroup\$ Do you have common grounds? \$\endgroup\$ – MadHatter Aug 11 at 17:19
  • \$\begingroup\$ @MadHatter Yes, the grounds are guaranteed to be common. \$\endgroup\$ – willem.hill Aug 11 at 18:28
1
\$\begingroup\$

With actual RS-232 buffering a simple daisychain connection should work just fine at that baud rate. The limits cited for RS-232 are typically 50 feet or a max cable capacitance of 2500pF for rates up to 20kbit/s. Longer distances or higher rates are possible with low-capacitance cables.

Now, with the 3.3V TTY link you're proposing? Not so much. The noise margin of such an approach is suspect at best; you have multiple boards to deal with so ground loop issues can be a problem. If you insist, you should consider rebuffering the signal.

Your intuition to use RS-485 is a good one. It would solve those problems and help future-proof your design. RS-485 avoids a number of issues that RS-232 has, such as noise immunity and more-limited speed at distance. Since you’re already using RJ12 you have enough pins, so might as well go with that. And it can share the 3.3V supply with the rest of your logic.

Oh, and you can choose RS-485 that doesn't load the line down if the module power is off. This isn't so straightforward with logic-level interfacing, though it can be done.


Going Further

There is a popular protocol used for theatrical lighting called DMX512, that functions exactly the same as what you’re building. It’s a multi drop serial line, and each client is addressable. DMX512 uses RS-485, with up to 64 clients per loop and up to 400m in length running at 250 kbit/s.

More about DMX512 here: https://learn.sparkfun.com/tutorials/introduction-to-dmx/all

At the risk of killing your enthusiasm, are you possibly reinventing the wheel with your MIDI-to-solenoid idea?

MIDI to DMX: https://www.instructables.com/id/MIDI2DMX/

DMX solenoid driver: https://www.amazon.com/Switch-Dmx512-Controller-Output-Control/dp/B00S9KABRA/ref=asc_df_B00S9KABRA/

\$\endgroup\$
0
\$\begingroup\$

Electricity travels 1 nanosecond per foot (+-). 40,000 BAUD system has 25,000 nanoseconds per baud, or 5 miles. At twisted-pair (SWAG) of 30 picoFarad/foot, the buss drivers need to handle? the TwistedPair impedance of about 100 ohms, or 50 milliAmps for 5 volt bus levels.

If you get reflections, then all bets are off.

To avoid problems with reflections, have slow rise/fall times, perhaps 10% of the baud time, and let the reflected energy get absorbed during the edge times. That limits you to 0.5 miles.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.