Skip to content

M.R. ENGINEERING

Home » UART Automatic Baud Rate Detector

UART Automatic Baud Rate Detector

Spread the love


Comment errors or corrections found for this circuit, and get the chance to win big!

While tinkering with electronics Oftentimes I end up with some sort of device that uses UART interface, but that I don’t have any idea what baud rate it uses, etc. Connecting it to a serial monitor application and checking with different baud rate is a time-killing process. So I decided to build an arduino based hardware device which can be used to find the unknown baud rate of uart devices.

Parts List

The Basic Idea :

All you need is to measure the shortest interval between two flanks(rising →falling or falling → rising)for some amount of traffic.Assuming the communication wiring is good,the shortest duration between two flanks will be the duration of a single bit.The baud rate will then be 1 divided by that duration(in seconds). You probably want to round to/adjust that to be the closest “standard “ baud rate once measured.

TimeBaud Rate
3333µs (3.3ms)300
833µs1200
416µs2400
208µs4800
104µs9600
69µs14400
52µs19200
34µs28800
26µs38400
17.3µs57600
8µs115200

Table 1. Standard Baud Rates

Connection Diagram:

  Fig 1. Connection Diagram
Fig 1. Connection Diagram
  • Connect UART device’s GND to GND of Arduino UNO
  • Connect TX pin of UART device to RX(0th pin – D0) of Arduino UNO

Launch Arduino IDE Software and select the correct COM Port and upload auto_baud_detector.ino arduino Sketch.

Once the arduino sketch is uploaded, open the arduino serial monitor or any other serial console application with 9600 baud rate.Connect TX pin of unknown UART device to RX pin of Arduino Uno.It will display the nearest standard baud rate.

The following screenshot shows one of the test results.

  Fig 2. Screenshot of serial console application (putty).
Fig 2. Screenshot of serial console application (putty).

Conclusion:

I have tested and verified the following baud rates.

300,600,1200,2400,4800,9600,14400,19200,28800,38400,57600,115200.

Note :This baud rate detection algorithm may fail to predict if characters with multiple zero bits in a row are received.But that is a rare condition.The documentation for pulseIn states that it can be used for intervals of 10 microseconds to 3 minutes. This cannot be used to check above 115200 baud rate.

Download Source Code




Source link


Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *