Skip to content

Raspberry Pi Pico W FTP (ftplib): Connect to a server | ShillehTek

October 22, 2023

Video Tutorial (Optional)

Watch first if you want to follow the full setup for enabling FTP on the Raspberry Pi Pico W in MicroPython.

Project Overview

Raspberry Pi Pico W + MicroPython FTP (ftplib): In this tutorial, you enable FTP support on a Raspberry Pi Pico W by adding a working ftplib.py file, so you can connect to (FTP into) an external FTP server from MicroPython.

The Pico W does not support FTP out of the box, and the micropython-ftplib library shown in Thonny can be a non-functional (dummy) library. This approach uses the real MicroPython-compatible code from GitHub.

  • Time: 5 to 15 minutes
  • Skill level: Beginner
  • What you will build: A Pico W MicroPython setup that can use a working FTP library to connect to an external FTP server

Parts List

From ShillehTek

External

Note: The key requirement is placing ftplib.py on the Pico W filesystem (top-level directory) so your MicroPython code imports the working library instead of relying on a non-functional Thonny package.

Step-by-Step Guide

Step 1 - Create ftplib.py on your Pico W

Goal: Add a working FTP library file to the Pico W so MicroPython can import it.

What to do: Create a new file on your Raspberry Pi Pico W named ftplib.py in the highest (top-level) directory on the Pico.

Copy the contents from this GitHub file and paste it into your ftplib.py, then save:

Expected result: You can see ftplib.py on the Pico W filesystem, and it is ready to be imported by your MicroPython scripts.

Step 2 - Use the FTP library in your MicroPython code

Goal: Confirm you can begin using the FTP library in your project.

What to do: Use the example provided here:

Expected result: Your Pico W code can import the library and you can start FTPing (connecting to an external FTP server) from MicroPython.

Conclusion

You set up FTP support on a Raspberry Pi Pico W by adding a working MicroPython ftplib.py file to the Pico filesystem, enabling your scripts to connect to an external FTP server.

Want parts for your next Pico W build? Grab what you need from ShillehTek.com. If you want help adapting this workflow to your device, network, or product requirements, check out our IoT consulting services.