B4R Tutorial Arduino - PC File Transfer

Discussion in 'B4R Tutorials' started by Erel, Jun 8, 2016.

  1. Erel

    Erel Administrator 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.
    The updated rSD library (v1.02) is attached. You need to copy it to the internal libraries folder.

    Attached Files:

    Last edited: Jun 8, 2016
  2. Mostez

    Mostez Active Member

    Thanks Erel
  3. rbghongade

    rbghongade 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?
  4. Cableguy

    Cableguy Expert Licensed User

    My answer would be yes, but not with an ethernet connection.

    There's already a simple WiFi server example, for esp8266, so the rest should be straight forward
    rbghongade and Peter Simpson like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice