When the NXT was being developed, the engineers added support for a functionality that was rarely used for about 5 years; RS485. It took me a while to gather together what it really is, what it can be used for, and how it works. Here is some information that I wish I knew a couple years ago, and may answer some questions you have about RS485.

On the NXT, the RS485 bus pins are sensor port 4’s digital pins. RS485 signal A is pin 6, and signal B is pin 5. A common ground is not necessary, but recommended (I think the max difference is 7v, but I’m not 100% sure). Sensor ports’ pins 2 and 3 are both ground.

To connect two NXTs directly, I usually use a standard NXT cable between port 4 on both NXTs. To connect more than 2 NXTs, I use a port splitter. Both of these methods will share a common ground between all NXTs, so you don’t have to worry about a ground voltage difference.

The RS485 transceiver in the NXT is an ST485. Based on the datasheet, the max number of devices on the bus at a time is 32 (due to impedance).

The NXT is set up for Half-Duplex RS485. That means that only one device can be talking on the bus at a time, so flow control must be implemented into the software.

From here on, I will be talking specifically about what NXC and the EFW supports (the software side of things).

You can send/receive up to 64 bytes at a time (that is to say, the rx and tx buffers are 64 bytes each).

The EFW supports 16 baud rates from 1200 through 921600.

AT91SAM7S256 (main processor in the NXT) supports (and I think the EFW also supports):
5, 6, 7, or 8 data bits.
Even or Odd parity.
1 or 2 stop bits.

It should be reasonably easy to interface the NXT to something like an Arduino or PICAXE through RS485, and with the wide range of speeds and modes, possibly many other serial devices.

As I am able to, I would like to expand on this page. Some possibilities include NXT > NXT code (already partially developed), NXT > Arduino code and HW specifics, and maybe an NXT > RCX project.

Another project I am thinking about, is an RS485 hub. It would be an active “multiplexer”, probably taking advantage of the 4 UART ports on the Arduino Mega 2560. Ideally it would have buffers for each of the ports, which the NXT could read at it’s own choosing. The advantages would be that the NXT could be on multiple “networks” at the same time, and most importantly, communicate with several devices without worrying about data crashing into data from other devices. On the three UART lines from the Arduino, not all of them would need to be converted to RS485; some could remain TTL UART or be converted to RS232 levels for non-RS485 UART devices.


2 Responses to NXT RS485

  1. Hi I use RS485 before with 2 nxt only.
    I saw you use port splitter but it has out of stock
    Do you have any alternative ways?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s