Baud rate and transmission speed

How long (in milliseconds) does it take to serial transmit (using TX and RX hardware serial on Arduino Uno) 2 integers, 3 floats, and 2 characters all converted to a string when using 2400 baud?

1 Start Bit + 8 Data Bits + 1 Stop Bit = 10 bits per data byte transmitted. 2400 bits / second How many bytes you sending?

Also, what about delimeters?

gfvalvo: 1 Start Bit + 8 Data Bits + 1 Stop Bit = 10 bits per data byte transmitted. 2400 bits / second How many bytes you sending?

2x2+3x4+2x1=18 bytes. So from your post: 180 bits. Overhead: I think none except stop, start and parity. Delimiters: none as far as I know, edit: one start and one endmarker, so add 2x1byte=20 bits. Total: 200bits.

Are bitrate and baud rate the same, as I read differently?

Each bit is 1/2400 seconds

180/2400 =

The rate for transmitting bytes is about 1/10th of the baud rate because an 8-bit byte needs 10 bits to transmit when you count in the start and stop bits. So 2400 baud is about 240 bytes per second.

…R

Assume asynchronous frame length is 10 (1 START Bit, 8 Character Bit, 1 STOP Bit), the transmission times for --

1. 1 integer type data (0x0000 - 0xFFFF) : 4x10x1/2400 = 16.67 ms

2. 1 float type data (binray32 format) : 8x10x1/2400 = 33.33 ms

3. 1 character type data ('A' = 0x41) : 1x10x1/2400 = 4.17 ms

brice3010: 2 integers, 3 floats, and 2 characters all converted to a string when using 2400 baud?

brice3010: 2x2+3x4+2x1=18 bytes.

The first would be true if you would just send the varaibles. But you say you convert it to a string so you're not... A int can have anywhere between 1 (for example '5') and 6 (for example '-32768') characters ;) For a float it even depends on the number of decimal places you tell it to print. But because more then 6 digits is useless that will vary between 1 character and 8 characters (minus and decimal included).

GolamMostafa: Assume asynchronous frame length is 10 (1 START Bit, 8 Character Bit, 1 STOP Bit), the transmission times for --

1. 1 integer type data (0x0000 - 0xFFFF) : 4x10x1/2400 = 16.67 ms

2. 1 float type data (binray32 format) : 8x10x1/2400 = 33.33 ms

3. 1 character type data ('A' = 0x41) : 1x10x1/2400 = 4.17 ms

Is integer not 2 bytes, float 4 bytes?

septillion: The first would be true if you would just send the varaibles. But you say you convert it to a string so you're not... A int can have anywhere between 1 (for example '5') and 6 (for example '-32768') characters ;) For a float it even depends on the number of decimal places you tell it to print. But because more then 6 digits is useless that will vary between 1 character and 8 characters (minus and decimal included).

Yes, all.converted to string (using Robin2 fantastic serial tutorial). I would assume worst case, ie. for integer -from your example- 6 characters. Does this mean 6 bytes?

brice3010:
Are bitrate and baud rate the same, as I read differently?

Absolutely different, but have become interchangeable with the demise of telephone modems.

Baud refers to the sine wave of the tone used to send data via modems. The old 300 baud and 600 baud modems encoded one bit per single sine wave. There the bit rate and baud rate were the same.

Even when moving to faster modems, 1200 baud, they still encoded one bit per tone cycle, but changed electronically so the modem could send and receive at the same time, full duplex. Two different tones were used and filters kept them separated in the electronics.

Faster, 2400 modems used entirely different coding structures. They encoded each tone cycle with phase changes so 3 eight-bit bytes could be sent with each tone cycle. 2400 bits-per-second, but one baud.

Telephone lines, by design, have limited audio response, so more exotic coding schemes were developed.

The downside of faster bit rates was the delay necessary to accumulate enough bits to begin to encode the tone cycle.

Paul

Paul_KD7HB: Absolutely different, but have become interchangeable with the demise of telephone modems.

Baud refers to the sine wave of the tone used to send data via modems. The old 300 baud and 600 baud modems encoded one bit per single sine wave. There the bit rate and baud rate were the same.

Even when moving to faster modems, 1200 baud, they still encoded one bit per tone cycle, but changed electronically so the modem could send and receive at the same time, full duplex. Two different tones were used and filters kept them separated in the electronics.

Faster, 2400 modems used entirely different coding structures. They encoded each tone cycle with phase changes so 3 eight-bit bytes could be sent with each tone cycle. 2400 bits-per-second, but one baud.

Telephone lines, by design, have limited audio response, so more exotic coding schemes were developed.

The downside of faster bit rates was the delay necessary to accumulate enough bits to begin to encode the tone cycle.

Paul

Great explanation! Thank you.

Are bit rate and baud rate the same, as I read differently?

Bit Rate vs Baud Rate (Bd): In communication theory, Baud Rate (Bd) refers to quantitative measure of information being transmitted/received by a carrier. A carrier is said to be conveying information when the modulating signal (the information) brings changes in its amplitude, frequency or phase. Every change in the carrier is an information bit (the baud).

In asynchronous serial communication, there is no carrier. The bits being carried out over the TX-line are all information bits. So, the Baud Rate is equal to the Bit Rate.

Figure-1: Waveform for asynchronous data frame for character A (TTL Logic)

(a) Assume Bd = 4800; Even-parity (number of 1s in the data field is even).
(b) Frame Length : 11 (1-Start Bit, 8-Data bit, 1-parity bit, and 1-Stop bit)
(c) Bit Rate = Baud Rate = 4800. Bit Period = 1/4800 = 208 µs.

There are cases where Baud Rate is different from Bit rate. For example: The Bell 212A type modem uses 1200 Hz sine wave carrier for transmission. It uses the so called ‘dibit encoding’, where ‘2 consecutive bits’ in the data stream is treated together. In this scheme, the value of these two bits determines the amount of phase shift to be occurred in the carrier. The relationship is:

dibit value phase shift
00 00
01 900
11 1800
10 2700

Now, assume that the bit pattern 00 11 01 01 11 01 would be transmitted using the dibit encoding scheme. The relationship between the values of the dibits and the phase shifts of the carrier is depicted below in Fig-7.1. The value of the 1st dibit is 00, so there is no phase shift of the carrier. The value of the 2nd dibit is 11, so the phase shift of the carrier is 1800 and it has occurred at the elapse of 1800 from point B. In a similar way, we have indicated the phase shift points for the remaining dibits of the data stream.

Figure-7.1: Waveform for simple phase-shift modulation

Now, we are in a position to explain the difference between the Bit Rate and the Baud Rate. At 1200 Hz carrier frequency, one cycle period is required for the shifting of 1-bit data into the phase-shift keying modulator. In the example of Fig-7.1, we have 12-bit data; we need 12 clock cycles to shift them into the modulator. So, the Bit Rate: 1200 bits/sec.

Now, let us look at the carrier; we observe that there are only 6 changes in the carrier. The 12-bit data have brought only 6 changes in phases of the carrier. The information content is 6 Baud. The Baud Rate is half of the Bit Rate and it is: 600 Bd.

GolamMostafa: Bit Rate vs Baud Rate (Bd): In communication theory, Baud Rate (Bd) refers to quantitative measure of information being transmitted/received by a carrier. A carrier is said to be conveying information when the modulating signal (the information) brings changes in its amplitude, frequency or phase. Every change in the carrier is an information bit (the baud).

In asynchronous serial communication, there is no carrier. The bits being carried out over the TX-line are all information bits. So, the Baud Rate is equal to the Bit Rate.

(...)

Great post, thanks!

In your post #6 you use 4 bytes for an integer, 8 for float: should that not be 2 and 4 bytes?

In your post #6 you use 4 bytes for an integer, 8 for float: should that not be 2 and 4 bytes?

1. An integer type data is 16-bit long : 0x0000 - 0xFFFF (2-byte = 4-digit = 4 characters). In asynchronous communication, data transmission/reception takes place one character at a time. Therefore, we need 4 frames to transmit 4 digits (4 characters) of an integer data.

2. A float data type like: float x = 3.14; When a user makes the above definition in the sketch, the compiler creates a 4-byte wide (32-bit) memory space and deposits there (lower byte enters into lower memory location) this bit pattern (0100000 01001000 11110101 11000011 = 40 48 F5 C3). This bit pattern is known as binary32 format (aka IEEE-754 Standard). There are 8 characters in this data item which require 8 frames for transmission. (If using binary64 format, 16 frames would be required to transmit a floating point data item.)

3. We may execute the following codes to generate/print the bit pattern of Step-2.

void setup() 
{
  Serial.begin(9600);
  float x = 3.14;
  long *ptr;
  ptr = (long*)&x;
  long m = *ptr;
  Serial.println(m, HEX);  //shows: 4048F5C3

}

void loop() {
  // put your main code here, to run repeatedly:

}

4. We may consult this link (Storing Floating Point Number in Memory) for study on binary32/64 format.

GolamMostafa: Assume asynchronous frame length is 10 (1 START Bit, 8 Character Bit, 1 STOP Bit), the transmission times for --

1. 1 integer type data (0x0000 - 0xFFFF) : 4x10x1/2400 = 16.67 ms

2. 1 float type data (binray32 format) : 8x10x1/2400 = 33.33 ms

This is rubbish. Please stop it, @ GolamMostafa.

You post nonsense, wrapped in a film of false authority.

"integer data type" - well, "unsigned long" is an integer data type, as is "char", as is " unsigned long long".

To transmit "0x0000" is going to take at least 6 x 10 / 2400 seconds.

I have no idea (and I firmly believe you don't either) what "binray32" format is., or why an arbitrary float variable should be printed as eight characters.

GolamMostafa: 1. An integer type data is 16-bit long : 0x0000 - 0xFFFF (2-byte = 4-digit = 4 characters). In asynchronous communication, data transmission/reception takes place one character at a time. Therefore, we need 4 frames to transmit 4 digits (4 characters) of an integer data.

2. A float data type like: float x = 3.14; When a user makes the above definition in the sketch, the compiler creates a 4-byte wide (32-bit) memory space and deposits there (lower byte enters into lower memory location) this bit pattern (0100000 01001000 11110101 11000011 = 40 48 F5 C3). This bit pattern is known as binary32 format (aka IEEE-754 Standard). There are 8 characters in this data item which require 8 frames for transmission. (If using binary64 format, 16 frames would be required to transmit a floating point data item.)

3. We may execute the following codes to generate/print the bit pattern of Step-2.

void setup() 
{
  Serial.begin(9600);
  float x = 3.14;
  long *ptr;
  ptr = (long*)&x;
  long m = *ptr;
  Serial.println(m, HEX);  //shows: 4048F5C3

}

void loop() {  // put your main code here, to run repeatedly:

}




**4.** We may consult this link [(Storing Floating Point Number in Memory)](https://forum.arduino.cc/index.php?topic=512331.msg3492120#msg3492120) for study on **binary32/64** format.

Great post! Thks!

But in view of previous post by TolpuddleSartre maybe some clarification would probably be useful?

brice3010:
In your post #6 you use 4 bytes for an integer, 8 for float: should that not be 2 and 4 bytes?

If you are sending data in binary format from an 8-bit Arduino (such as an Uno or Mega or Leonardo) then you are correct - an int takes 2 bytes and a float takes 4 bytes.

Personally I much prefer to send data in human readable form with Serial.print() rather than Serial.write() as it makes debugging much easier. I only send binary data when the extra speed is essential. The largest value for an int is -32768 which is 6 characters so sending it that way would take 3 times as long as sending the binary value.

…R
Serial Input Basics - simple reliable ways to receive data.

Robin2: If you are sending data in binary format from an 8-bit Arduino (such as an Uno or Mega or Leonardo) then you are correct - an int takes 2 bytes and a float takes 4 bytes.

Personally I much prefer to send data in human readable form with Serial.print() rather than Serial.write() as it makes debugging much easier. I only send binary data when the extra speed is essential. The largest value for an int is -32768 which is 6 characters so sending it that way would take 3 times as long as sending the binary value.

...R Serial Input Basics - simple reliable ways to receive data.

Hi Robin2, first of all big thanks for your great tutorial on Serial Input Basic, it has been very usefull for a large project of mine. In view of this thread I have to clarify that data being sent involved here is in string format, just as you already use in your tutorial. So I assume that indeed an integer will not just be 2 bytes, but rather 6 characters, hence 6 bytes?

brice3010: I have to clarify that data being sent involved here is in string format, just as you already use in your tutorial. So I assume that indeed an integer will not just be 2 bytes, but rather 6 characters, hence 6 bytes?

If the data is being sent with Serial.print() then the number of characters will depend on the printed size of the number. For example 8 will be one character and 123 will be 3 characters even though both are represented as 2 bytes in an int

...R