Sunday, December 22, 2024

UART Automatic Baud Rate Detector

AshwaniWhile 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.

POC Video In English:

POC Video In Hindi:

- Advertisement -

Parts List

  • Arduino Uno
  • Jumper Wires

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.

Time Baud Rate
3333µs (3.3ms) 300
833µs 1200
416µs 2400
208µs 4800
104µs 9600
69µs 14400
52µs 19200
34µs 28800
26µs 38400
17.3µs 57600
8µs 115200

Table 1. Standard Baud Rates

- Advertisement -

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


 

1 COMMENT

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Truly Innovative Electronics

Electronics News

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×