Skip to content

How to add W5500 Ethernet to Raspberry Pi Pico (Python) – 1

HOWTO: Raspberry Pi Pico + WIZnet W5500 Ethernet + CircuitPython - Manual IP setting & Ping Demo

WIZnet

Published February 09, 2023

Original author: Bongjun HurOriginal source (new tab)

How to add W5500 Ethernet to Raspberry Pi Pico (Python) – 1

Components

Hardware components

WIZnet parts

Project description

1. Circuit Python install first!

Reason: lots of examples with W5500

https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/micropython-or-circuitpython

CircuitPython has a lot of examples and support!There are 260+ libraries for the standard CircuitPython API. Most of these will already work. Listed here

  • 1. Download the below uf2 file link on your computer

CircuitPython 6.2.0 – adafruit-circuitpython-raspberry_pi_pico-en_US-6.2.0.uf2

  • 2. Push and hold the BOOTSEL button and plug your Pico into the USB port of your Raspberry Pi or other computer. Release the BOOTSEL button after your Pico is connected.
  • 3. It will mount as a Mass Storage Device called RPI-RP2.
  • 4. Drag and drop the CircuitPython 6.2.0 UF2 file onto the RPI-RP2 volume. Your Pico will reboot. You are now running CircuitPython.

https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython

  • if you want, you can install MU editor to make your python code. But I think, it’s not necessary. Just use your Python IDE such as Notepad, VSCode, …

Then, you can see “CIRCUITPY” drive on your system.

circuitpy code.py
circuitpy code.py
 

Now, we’re ready to enjoy the code on python code.py with CircuitPython!!

Once you edit and save your code on code.py, run your code on the board.

Let’s test “LED on” and “LED off” code.

actually, just visit the below page to blink led on your rpi pico board.

https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/blinky-and-a-button

2. Pin connect to W5500, WIZ850io

use SPI1 on rpi pi board.

 
 
 
2. Pin connect to W5500, WIZ850io
 
1 / 2
 
  • SPI1_SCK => WIZ850io SCLK
  • SPI1_TX => WIZ850io MOSI
  • SPI1_RX => WIZ850io MISO
  • SPI1_CSn => WIZ850io SCNn
  • GP15 => WIZ850io RSTn

, and 3.3V, GND as well.

for your reference,

Pico connect to WIZ850io
Pico connect to WIZ850io
 

3. W5500 Reset Test

Copy below RESET_test code to code.py file on your rpi pico board.

https://github.com/bjnhur/pico-W5500/blob/main/W5500_Reset_Test.py

Every 6 second, RESET pin control => See the link on & off

 
 
 
Link ON
 
1 / 2 • Link ON
 

4. W5500 adafruit_wiznet5k python library

Before, ping test we prepare some libraries from Adafruit learning page.

https://learn.adafruit.com/ethernet-for-circuitpython/circuitpython-setup

Before continuing, make sure your board’s lib folder has at least the following files and folders copied over:
adafruit_wiznet5k
adafruit_bus_device
adafruit_requests.mpy

(Added 04-21, 2021) I put the latest files and folders on my github repo. download files from here.

For adafruit_wiznet5k, I forked & modified some code for DHCP operation. please visit & download code from

OR, original files can be download as belows.

Find and copy adafruit_bus_device & adafruit_requests.mpy file from Adafruit’s CircuitPython library bundle matching your version of CircuitPython. Don’t copy all files and folder in the library.

file location of adafruit_requests.mpy
file location of adafruit_requests.mpy
 

For adafruit_bus_device, download from below link.

Last, you copy the files on the lib director of CIRCUITPY drive.

prepare library for W5500 python code
prepare library for W5500 python code
 

5. W5500 PING Test

(UPDATED 04/12/2021) DHCP OK. refer from my repo. ~~I tried DHCP mode, but failed.~~

so first I’m trying to ping with manual IP setting

For this example, please visit the link.

I changed some information as my network env.

please refer my code.

just copy the content to code.py on your RPi Pico and save!! Done!!

PING test on my laptop. Result is 

ping success!
ping success!
 

6. REPL, Open serial terminal for printf()

I found the material for REPL, terminam open from Adafruit page.

Now you need to open PuTTY.
Under Connection type: choose the button next to Serial.
In the box under Serial line, enter the serial port you found that your board is using.
In the box under Speed, enter 115200.

putty serial configuration
putty serial configuration
 

Once your settings are entered, you’re ready to connect to the serial console. Click “Open” at the bottom of the window. A new window will open.

To see your COM port number, please open “Device Manager” on your Windows.

window device manager
window device manager
 
COM Port
COM Port
 

see the terminal screen as follows.

REPL screen
REPL screen
 

7. WebClient Demo

please visit next project story.

https://www.hackster.io/bjnhur/how-to-add-w5500-ethernet-to-raspberry-pi-pico-python-2-77c78c

Resource

All code, you can find the below repo.

https://github.com/bjnhur/pico-W5500

Comments

Similar projects you might like

Comments