Project Description

featured

Description

Arduino Ethernet Lib. Let’s experience SD file system and Ethernet communication simply by using WIZ550io, which is a representative Ethernet Shield of File transfer protocol (FTP) Client

 

Preparation materials

  1. Hardware :
    – Arduino board
    – Ethernet Shield : WIZ550io with ioShield-A (included Micro SD connector)
    – Micro-SD Memory card
  2. Software :
    – Ethernet Lib. : WIZ_Ethernet_LIB_IDE-1.5.7 (included FTPPassiveClient Sketch)
    – SD Lib. : https://github.com/adafruit/SD
    – Arduino IDE : IDE 1.5.7
    – Ethernet example : FTPPassiveClient sketch
  3. Etc
    – FTP Server on PC side

Arduino Due + Ethernet Shield is based on Ethernet and SD Lib. It uses FTPPassiveClient to connect to FTP Server on PC and download predefined file.

Download the Library from here: https://github.com/embeddist/WIZ_Ethernet_Library-IDE1.5.x

Zip File link: https://github.com/embeddist/WIZ_Ethernet_Lib_IDE1.5.7/archive/master.zip

 

Setting of FTPPassiveClient Sketch

  1. WIZ Ethernet Lib setting
    To use WIZ550io
    , check lines 19 ~ 24 of “~ / arduino1.5.7 / libraries / Ethernet / src / utility / w5100.h” file .
    #define W5500_ETHERNET_SHIELD // use WIZ550io or W5500
    #if defined (W5500_ETHERNET_SHIELD)
    #define WIZ550io_WITH_MACADDRESS // use WIZ550io’s MAC address
    #include “utility / w5500.h”
    #endif
  2. Network setting The
    Arduino Due + Ethernet Shield and the PC running the FTP Server must be set up on the same network, which can be set on the PC or Board side.
    First, if Sketch’s IP address is set to 192.168.1.10 and the subnet and gateway are set to 255.255.255.0 and 192.168.1.1,
    the IPaddress function of Sketch is set to
    IPaddress ip (192.168.1.177);
    IPaddress gateway (192.168.1.1);
    IPaddress subnet (255.255.255.0); 

    .
    The second method is Sketch’s network configuration. In case of windows, you can configure IP / Subnet / gateway using the address in the first example in Local area connection-> Properties-> Internet Protocol-> Properties .
  3. FTP address Account / password setting / filename
    FTP address, account, and passowrd can be applied to Sketch using the FTP server settings.
    For example, if the setting of the following FTP Server
    FTP in the Address IP: to 192.168.1.10
    the Account: Test
    Password: testtest
    test.txt: Download file name you want to
    be when in the Sketch to modify the section below. 
    -28Line: IPAddress server (192.168.1.10); // FTP IP address
    -36Line: char fileName [13] = “test.txt”; // Prepare test.txt on Server side !!
    -126Line: clinet.println (F (“USER test”)); // FTP account
    -130Line: clinet.println (F (“PASS testTest”)); // FTP account

Now that the preparation is complete, after downloading sketch to the board after compiling, I confirmed that the test.txt will be downloaded to the Micro-SD card of the board after logging in using FTP server account and password. It also reads the last file from the SD card and outputs it to the serial port.

Tip 1. WIZ550io and Micro-SD data lines use Serial Peripheral Interface Bus (SPI) and distinguish WIZ550io and Micro-SD with Chip Select (CS) signal. WIZ550io uses GPIO D10 and Micro-SD uses D4 as CS. In order to prevent collision of CS with existing code, D10 of GPIO is set to Output high before Init of Micro-SD, and then Init of WIZ550io is executed. In this sketch, WIZ55oio is initialized first and then SD is changed to Init. .

Tip 2. Space is required when setting FTP USER and PASSWORD. Because of this, I can not do login for a while. I figured out after I captured the packet with WireShark

Tags: 201802, WizFi250, Ethernet, Wiznet, Arduino, FTP

Source: https://medium.com/@embeddist/arduino-ethernet-lib-ftp-client%EB%A5%BC-ethernet-shield-wiz550io-%EC%97%90-%EC%A0%81%EC%9A%A9%ED%95%B4%EB%B3%B4%EC%9E%90-f6563270ed6c