Arduino Mega 2560 R3 - Many many serial devices

Good day all!
Sorry for the many words below, but I'm trying to be good and not require you to do a ton of "please tell us x"


  • I've done a lot of searching trying to do my due diligence before posting, but Google runs purple instead of blue now...
  • I'm pretty new (read: 1 week) to arduino / micro controllers / programming - but have already made some pretty good strides and will try to keep up, I might not call things the right thing, but will clarify as much as possible
  • I realize my project is pretty ambitious for a newcomer but I'm loving it and really having a good time, I hope to help others when I know more too


  • Read from 12 "real"(as in +/- 12v) serial devices
  • Program arduino to read serial inputs and then output via CAN (succeeded with reading serial and encoding into CAN! Helpful info here with my posts ERRP | Expired Registration Recovery Policy)
  • Create custom PCB as needed (I have eagle)

Here's where I need help, I first got the Mega thinking I'd be able to do this all via software serial but it looks like there are a lot of limitations there. The serial devices send 6 bytes at a time via RS232 and even though I don't need to read them simultaneously it seems like arduino would essentially get stuck waiting for that many devices to send their data (9600baud) if I set it to poll the ports sequentially and wait for the characters. So, ideas:

  • Change extra UARTs to all receive? Basically: Change pins 14 16 18 to receive buffers instead of transmit. This sounds like it would be amazing, I don't need to EVER transmit to these devices. I'm not sure if this is even possible but I read a post that I cannot find again that mentioned it was possible to change the serial pins to receive instead of send (they were commenting that if you did the wrong one you could break your arduino because it wouldn't be able to talk to the computer. To implement it seems I would need to change the pins_arduino.h file somehow, but interestingly this comment is present
// A majority of the pins are NOT PCINTs, SO BE WARNED (i.e. you cannot use them as receive pins)
// Only pins available for RECEIVE (TRANSMIT can be on any pin):
// (I've deliberately left out pin mapping to the Hardware USARTs - seems senseless to me)

which makes me wonder if this is even possible.

  • Additional Megas via i2c or spi or something I haven't done this before but it looks like I'll need another Mega anyway for this project to talk to the main one, but to get 12 serial receives I would need 3 megas, which my enclosure might not have room for (also increase the cost greatly!)
  • And finally, a UART multiplexer
    octal SC28L198 | NXP Semiconductors comes to mind, but I have no idea at the present how to use one, though I'm willing to learn and about to research more. Since I need to eventually put this all on a PCB that should be fun! But 4 onboard and 8 on the multiplexer would give me 12 and really simplify my design I think. If this is the way to go... any tips on the best way to get twelve incoming serial lines into this chip without frying it?

To those that made it this far:

You may use your Mega (4 UARTs) plus 8 ATtiny2313s (each 1 UART) connected by a I2C bus. The Tinies are able to buffer the serial data till you're able to get it and they're quite cheap (about $2.50/pcs).

Oh wow, that sounds like the perfect price!
Should I invest in one of these for the easiest programming of them?

If i switch to one of these (operates at 18.8-5.5 V) can I plug 12v serial directly into them?

Thanks so much!

Ah, I wondered why the operating voltage went down from 18 to 5... it appears to be a typo on their site. Meh :frowning:

The device operates between 18.8-5.5 volts.

I guess that wouldn't have accommodated the negative voltage either. Silly me.

I'm looking into how to do this, but if anyone has suggestions for a way to condense the required circuits for 8 of those I'm game.

Should I invest in one of these for the easiest programming of them?
MPLAB PICkit 4 In-Circuit Debugger - PGM-15797 - SparkFun Electronics

No, this is for PICs not for AVRs.

If i switch to one of these (operates at 18.8-5.5 V) can I plug 12v serial directly into them?

First of all: that's 1.8V to 5.5V, nothing of 12V.

And even if it would run on 12V, RS232 has +/- 15V, the minus part would kill your inputs anyway if connected directly, as you found out yourself in your last post.

If you play with RS232 signals with AVR you must use MAX232 chip to translate RS232 signal to TTL.

Disregarding price I see no point in using more processors. All you get is a UART that you have to program yourself and implement a programming scheme when they are all on the same PCB.

The octal chip is pretty expensive, but the dual SC16IS752 is only about $2-4, you only need 6 and you don't have to program them.

can I plug 12v serial directly into them?

No. As mentioned you need to shift the levels and the most common way to do that is with a MAX232-style chip. But with these you waste 2/3rds of the chip because you're not transmitting so don't need the drivers or the caps.

If you are only receiving you could use diodes and resisters.

Another option is to use the MAX3180/1/2/3, it's just a single RS-232 receiver for 80c in a SOT23-5 package.


MAX208 has 4 RS232 channels if you need more RS232 buffering.

Thank you all for your additional input!
pylon- thanks for clarifying that there is a difference, I'll have to look that up
Graynomad - awesome suggestion on the little MAX318x chips these sound perfect.

Another option is to use the MAX3180/1/2/3, it's just a single RS-232 receiver for 80c in a SOT23-5 package.

MAX3181 looks like the best bet for me because it has a "standard inverting output" and auto wake up. But wait, inverting output- does that mean it takes the +/- 12 and converts it tp +/- 5.5 or 3.3, which would not be useful right? I would want to match its output with the input of the SC16IS752 which would be TTL 0-5+ right?

CrossRoads- Thanks for your dedication to this forum, I've read many of your posts and they've been helpful for other parts of this project so far! With regard to the MAX208 - It appears that it doesn't do SPI or I2C so how does it talk to the arduino?

With regard to the MAX208 - It appears that it doesn’t do SPI or I2C so how does it talk to the arduino?

It is just a data translator, it turns your +/-12V RS232 signal into a TTL one. It does not communcat with the arduino you need on on the front of any device that does like the MAX3180.

But wait, inverting output- does that mean it takes the +/- 12 and converts it tp +/- 5.5 or 3.3, which would not be useful right

Unless you want inverted TTL signals then don’t use an inverting output device.

It wasn't clear to me what you are after. I read the thread as you needed RS232 drivers as well as additional UARTs.

Would it be insane to do this with 3 ATMega1280s?

My total cost would be $33 instead of $24 for 6x SC16IS752.
(I know I would still have do to LLC)

Would certainly be more straightforward coding, just use Serial, Serial1, Serial2, Seriar3 on each board.
How about 2 quad UART chips? <$8 each

Write some code to use 8 bit parallel data interface.
64 byte buffer too, nice & big.

(LLC?) Sorry I saw that on sparkfun and thought it was a common way to say logic level conversion

After further research I found these

Would it be troublesome to load arduino software onto these to program them? They are very inexpensive and still pretty powerful (7UARTS) and I wouldn't mind this board having them on it.

As a side note, my current plan is the following:
Custom PCB with
1-2 ATSAM3X8EA-AU (new ARM Due chips, if I'm not mistaken)
2-3 of the above atxmega256a3u (these connected via SPI bus- unless better options?)
2 RS485 (for Modbus) chip
1 RS-232 Serial Transmit
13 RS-232 Serial Receive
2-4 CAN Rx/Tx
IOIO for android bluetooth control / monitoring

In a form factor that would fit into an already chosen environmentally sealed, vibration reduction optimized, industrial rated case with the following ports exposed via ~50pin Deutsch connections
all serial lines
GPIO necessary for raspberry pi addon
some digital / analog pins
4pin ethernet
1-2 TTL uart

These would be built by Screaming Circuits (possibly with their class III inspection)

With all that above stated... is this a place to ask if people are interested in that kind of thing (I don't know if something this insane/ambitious has been undertaken before? Tell me if so cause maybe I'll just buy them?!) and if they don't mind giving input (in case they love this idea and would like some customization that could be engineered in for them) I could spare a few boards at cost for them?

Arduino hasn't adapted for those chips yet.

Arduino hasn't adapted for those chips yet.

And probably never will be as they aren't very popular.

That said I think I saw an Xmega Arduino clone a while back, maybe someone has done a port.


Well.. maybe 4 of the new

instead of mucking around with the other stuff :astonished: thanks for the tips on the other, I got really excited with that price and capability. It looks like the Xmegaduino is rolling on that chip but I don't want to play with beta stuff for this :frowning:

Which parts of this are you interested in?

– USB 2.0 Device/Mini Host: 480 Mbps, 4-kbyte FIFO, up to 10 bidirectional
Endpoints, dedicated DMA
– Up to 4 USARTs (ISO7816, IrDA®, Flow Control, SPI, Manchester and LIN support) and one UART
– 2 TWI (I2C compatible), up to 6 SPIs, 1 SSC (I2S), 1 HSMCI (SDIO/SD/MMC) with up to 2 slots
– 9-Channel 32-bit Timer/Counter (TC) for capture, compare and PWM mode,
Quadrature Decoder Logic and 2-bit Gray Up/Down Counter for Stepper Motor
– Up to 8-channel 16-bit PWM (PWMC) with Complementary Output, Fault Input, 12-bit
Dead Time Generator Counter for Motor Control
– 32-bit Real Time Timer (RTT) and RTC with calendar and alarm features
– 16-channel 12-bit 1Msps ADC with differential input mode and programmable gain stage
– One 2-channel 12-bit 1 Msps DAC
– One Ethernet MAC 10/100 (EMAC) with dedicated DMA
– Two CAN Controller with eight Mailboxes

A simpler approach might be to program 12 avrs that talk to those devices and then hang off a spi/i2c bus with your mega. With this set-up, you can easily add or subtract additional receivers and implement your own protocol.
I just found this project, it looks like they are developing a mini board for the Due processor, which would allow me to simply design a PCB using their connectors (not even need to connect their "bus" necessarily) but save me tons of money on the fab/assembly as I won't have to pay the extra for extra fine pitch or BGA chips... I'm kinda digging that.