How to add DHCP into your Raspberry Pi Pico?

Dynamic Host Configuration Protocol (DHCP) is a network management protocol that automatically assigns IP addresses under your router’s IP network. This method provides the device within their network could communicate to the internet.

For creating this method, WIZnet’s has made a simple coding in their library for PICO users to easily get assigned IP address from your DHCP server. Please refer the steps below.

  1. Import libraries – wiznet5k
  2. Activate and set the GPIO pins for SPI communication and reset pin
  3. Set your MAC address settings
  4. Initialize your Ethernet interface with your Router
  5. Your router will automatically provide an IP address to you.

For more information, please refer the link below.

  1. WIZNet’s DHCP example codes-
  2. How to setup WIZnet Library into Raspberry Pi Pico? –
  3. How to create a simple TCP/IP connection? –

Used software:

  1. Thonny:
  2. Window’s cmd terminal
Step 1&2: Settings before creating a network
Step 3: Set the MAC address
Step 4: Active the DHCP for collecting IP
Step 5: Ping results from Serial terminal and from cmd terminal