# A basic question about output rate and sampling rate in serial communication [closed]

This is a very beginner question. And below is an arbitrary made up example:

Imagine you established communication with a USB device through your PC's USB COM port.

The USB device is measuring the voltage through it's analog input and then converting it to digital by its ADC. And through its port sending the 10-bit serial data to the PC through the USB cable.

Now the device has a sampling rate of 1kHz, i.e it takes 1000 samples of voltage per second.

And when I set the baud rates and the rest by using HyperTerminal and connect to the port, I can see 4 voltage readings per second as incoming lines.

My questions are:

1-) The analog sampling rate of the device was 1kHz, but I receive 4Hz per second. Does that mean the data is averaged? So does each received line in PC correspond to the average of 1000/4 = 250 samples' average?

2-) What is the 4 samples per second received by the PC called in literature? In data-sheets I cannot see a term called "output rate".

## closed as unclear what you're asking by Trevor_G, Wouter van Ooijen, RoyC, Voltage Spike, Marcus MüllerMar 29 '18 at 16:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Since this is a made up example the received line data can be anything you imagine it to be... and you can call it whatever you want.... – Trevor_G Mar 29 '18 at 15:16
• You're intermixing many very different things: USB, a serial-port like tunnel through USB which may or may not ever inside your device involve electrical signaling at the configured baud rate, ADC sampling, a program rendering sample values to text, and a program displaying virtual serial port data. Any of these could be a cause of slowdown. Typically there would not however be averaging at the timescale you notice, unless you write code to do so. In terms of the printout rate observed at the pc, the most applicable term is "design error", but more detail is needed to determine where. – Chris Stratton Mar 29 '18 at 15:17
• @user1234: 'Hz' is a per second measurement so we don't say "Hz per second". Just "4 Hz" is correct. – Transistor Mar 29 '18 at 15:22
• sorry it would be 4 samples per second. I know at least that much trust me:D – HelpMee Mar 29 '18 at 15:24

Imagine you established communication with a USB device through your PC's USB COM port. ... I set the baud rates and the rest by using HyperTerminal and connect to the port, I can see 4 voltage readings per second as incoming lines.

Many USB devices that appear to PC software as "COM ports" don't actually involve an UART hardware. They likely ignore the baud rate setting that you provided through hyperterminal.

These devices should be able to achieve a good fraction of the USB data rate, so at least 100 Mb/s.

It's not clear why you would only receive 4 readings per second.

The analog sampling rate of the device was 1kHz, but I receive 4Hz per second. Does that mean the data is averaged?

If you are designing the ADC device, you could design it to average 250 samples and send the averaged value rather than send every individual sample.

Or you could design it to throw away 249 samples and send the 250th.

Or you could design it to send all 250 samples.

It would be up to you, as the designer of the ADC device.

What is the 4 samples per second received by the PC called in literature?

Usually we specify ADCs in "samples per second". So we'd say this ADC is providing "4 samples per second". If you were getting thousands or millions of samples per second you might talk about "ksps" or "Msps", but I've never seen it abbreviated for such low rates. Maybe you could say your ADC provides 0.004 ksps.

• regarding your last section, so first of all the term "sampling rate" is the samples taken by the adc per second okay.. but the converted samples being sent per second is called what? you didn't call it output rate. "samples per second" can be both sampling rate and output rate its kind of confusing. – HelpMee Mar 29 '18 at 15:58
• @user1234, I don't see why anybody would care about samples that were taken but not transmitted to the control PC, or otherwise made useful to the user. – The Photon Mar 29 '18 at 16:00

1) No, the data are not being averaged. The path from the ADC to Hyperterminal goes through a number of buffers, and data can not get through at the rate you are actually sampling at. There is a buffer in your sending device's UART hardware, and data is being written into that when it's free, while the ADC is continually updating in the background. What you are actually seeing in Hyperterminal is whichever individual sample gets into the UART.

To get the individual values with no averaging, set up a larger buffer at the ADC end, sample for a set amount of time and then send this larger buffer. If you want averaging, calculate this at the ADC end and send this. Let's say that 4 Hz is the most your connection can do, you could take 256 samples (at 1 kHz sampling rate), add them together, and divide by 256. This would give you an approximately 4 Hz data rate (to get 4 Hz exactly, set your sampling rate to 1024 Hz).

2) This would typically be called "throughput".

• How do you know how this hypothetical device works? – Wouter van Ooijen Mar 29 '18 at 15:44
• @WoutervanOoijen Almost certainly an Arduino (given the OP's question), and the answer is pretty generic anyway. Feel free to point out anything controversial. – awjlogan Mar 29 '18 at 15:49
• no its not an arduino. its a situation i sometimes encounter with sophisticated devices. im sure some do averaging. – HelpMee Mar 29 '18 at 15:53