How to Connect to an FTP Server With Raspberry Pi Pico W
by mahmoodmustafashilleh in Circuits > Raspberry Pi
3091 Views, 3 Favorites, 0 Comments
How to Connect to an FTP Server With Raspberry Pi Pico W
In this tutorial, I will demonstrate how to use FTP functionality to FTP into an external server with the Raspberry Pi Pico W.
FTP stands for "File Transfer Protocol." It is a standard network protocol used to transfer files from one host to another over a TCP-based network, such as the Internet. FTP is often used to upload and download files to and from a server, such as website files, software, and media.
I am making this tutorial because you cannot FTP out of the box with the Raspberry Pi Pico W and the micropython-ftplib library in Thonny is a dummy library that does not work. After doing some digging I found the micropython code online, however, the library in Thonny itself has yet to be updated.
-----
Before we delve into the topic, we invite you to support our ongoing efforts and explore our various platforms dedicated to enhancing your IoT projects:
- Subscribe to our YouTube Channel: Stay updated with our latest tutorials and project insights by subscribing to our channel at YouTube - Shilleh.
- Support Us: Your support is invaluable. Consider buying me a coffee at Buy Me A Coffee to help us continue creating quality content.
- Hire Expert IoT Services: For personalized assistance with your IoT projects, hire me on UpWork.
Explore our Stores for Premium Products:
- ShillehTek Store: Access exclusive discounts on Arduino, Raspberry Pi sensors, and pre-soldered components at our ShillehTek Website.
Shop on Amazon:
Supplies
1-) Raspberry Pi Pico W and Power Supply
This is all you will need.
I am assuming you have your device set up in a MicroPython environment.
Create a File on Your Raspberry Pi Pico
- Create a file called ftplib.py
- Create this file on the highest directory of your Raspberry Pi Pico
- Copy the contents from this GitHub file and paste it into the file you created, and save.
This is the code that is supposed to be in the library in Thonny. Had to go look for it on some corner online. I tested it out with a simple example and it worked.
Start Using FTP (Example)
I have an example on my GitHub page where I use this library and it works nicely:
The code contains the following:
from ftplib import FTP
print('Testing')
ftp = FTP('ftp.dlptest.com', 21, 'dlpuser', 'rNrKYTX9g7z3RgJRmxWuGHbeu')
ftp.pwd()
ftp.retrlines('LIST')
print('Done Connecting')
I simply connect to a test FTP server online and retrieve the list of files it has. It appears to work. Hope you have luck using this. If you did please subscribe to my channel --> Youtube.