B4R Tutorial Arduino - PC File Transfer

Similar threads

B4R Tutorial ESP8266 - Getting Started
B4R Tutorial MQTT
B4R Tutorial SD cards
Other B4R v1.20 BETA - Support for ESP8266 Boards
B4R Tutorial HC 05 Classic Bluetooth


Staff member
Licensed User
In this example the Arduino board acts as a server. Clients can list the available files and can download files stored on the SD card, which is part of the Ethernet shield.

To make the solution more reliable, the communication is stateless, similar to HTTP requests. The client sends a request, the server (Arduino) sends the response and closes the connection.

The client verifies that that the response is complete and then analyzes the response.

The SD and the ethernet features cannot be used at the same time as both work with the same SPI lines. We need to select which SPI peripheral is active. This is done with the SetSD sub.

Note the usage of the large buffer in the client program. It simplifies the client solution.

I've tested it with files of several mega bytes and the files were transferred successfully.

The size of the compiled program is 35kb which means that you need a larger board such as the Arduino Mega.

During the tests I've found a bug in SD.ListFiles which can cause some of the files to be omitted.


Last edited:


Active Member
Licensed User
Dear friends,
Can we transfer files stored on SD card connected to WEMOS mini D1, to Android device, with similar code?