Fast serial communication with Arduino

2 Просмотры
In this video I explain how to send data from your Arduino (or STM32) to you computer via the serial port at higher speeds. There are two ways of sending data: one is to send data by using the Serial.println() function which sends the data in “human-readable” format. And the other is by using the Serial.write() function which sends binary data to the serial port. The latter is way more faster but special attention is required when we send the data from the microcontroller and receive it on the computer. The data (typically a number) has to be divided into 1-byte (8-bit) parts then after receiving it on the computer it has to be reconstructed into the original number. Also, the serial port has to be polled by the computer and buffers are needed to read, process and write the data.

As an example, while the Serial.printl() function transfers nearly 93000 24-bit numbers to the computer in 5 seconds, the Serial.write() function is capable of transferring about 550000 (nearly 6x more) 24-bit numbers within the same 5 second time period.

Source codes:

If you want to buy the parts I used in the video and support me at the same time, you can use the following affiliate links:
Arduino UNO:
STM32F103C8T6 Microcontroller:
Комментариев нет.