Arduino Serial throughput

Is there any details on the Arduino Serial throughput. I'm trying to poll digital pins and have my serial setup at 115200 baud/s but i am not getting anything close to this on my pc. This this setup i am getting somewhere between 3900 and 5,500 bit/s. I understand baud and bit are by no means equal but i wouldn't expect the overhead to be that much. Any notes or experiences i can sync my understanding with is greatly appreciated.

I am recording the output from the arduino via a serial terminal (screen -L /dev/ttyUSB0). So, the output from the arduino is being printed to the screen as im recording it. But the terminal is at a very low CPU usage so I assumed this was not the bottle neck.

Also, in my arduino code i have 2010 microseconds of set delay. Any other over head would be code from reading digital pins, writing out to digital pins. Is there a way to accurately measure code overhead?


Baud = bits/s. You are transferring bytes. A byte is 8 bits. So 115200 baud is 14,400 bytes per second.

If you are polling, that means you are sending a request to the Arduino for data. The Arduino then streams that data back.

All the data you send out needs to be added to that which gets sent back to correctly measure transmitted data per unit of time.

If you have the Arduino doing nothing for 2 seconds at a time, no serial I/O can happen, either.

If the idea is to get data back and forth as fast as possible, the delay is counter-productive. Why is it there?

So 115200 baud is 14,400 bytes per second

115200 bits per second is 11520 bytes per second maximum. One start bit, eight data, one stop, no parity.

2 seconds at a time

2.01 milliseconds. Still 23 characters' worth of a delay though. But serial rx can still occur during this time.

2 seconds; 2 milliseconds. There close...

The DigitalRead and digitalWrite functions in Arduino are quite slow. I don't know if that is your problem.

You can do it a lot faster with direct port manipulation, but not as easy of course :-)

This might help:

Of course, what would help even more would be to see some the OPs code.