Raspberry Pi Pico W can act as a webserver but it needs to first connect to a wifi router. How to make it so that multiple mobile phones can connect to it directly without the need for a router and serve a html file when users visit in the browser

  • No router? How do you expect the mobile phones to see the pico then? Jul 8, 2023 at 11:29
  • You might possibly want a zero instead. Jul 8, 2023 at 11:29
  • @ThorbjørnRavnAndersen You expect them to see the Pico the same way they would see a router -- or access point, the difference between which is the former forwards traffic back and forth between the WLAN it manages and an external network via a second inet interface, whereas the latter only connects and manages a WLAN. Access point tech is also used to implement things like what the OP is talking about, devices you can connect to without a router/AP in the middle. All kinds of IoT devices use this for initial setup so you can provide them with a password to get on your LAN proper.
    – goldilocks
    Jul 8, 2023 at 13:38
  • ...Which a quick online search reveals that the wifi chip on the Pico does have an access point mode hence could be used to do what's required here. Search was for "pi pico w access point". I did not read anything beyond the start of this thread where an issue seems to be that there's no WPA implementation, ie., it would be an unencrypted open network. So at a minimum you should be able to use that.
    – goldilocks
    Jul 8, 2023 at 13:42
  • @goldilocks yes. The point is that OP is not aware that the software needed for this is more than what may be available for such a small device. Jul 8, 2023 at 13:55

2 Answers 2


First install RaspAP (Access Point)The easiest, full-featured wireless router setup for Rapberry pi devices. Second setup your web server. Third let all your guest connect to your raspberry router as clients. Voila! Serve your html files, doc, etc


You can set-up Raspberry Pi Pico W as a HTML webserver with no internet. Just follow the instructions in https://microcontrollerslab.com/raspberry-pi-pico-w-soft-access-point-web-server-example/

 import usocket as socket        #importing socket
 import socket
import network            #importing network
import gc
ssid = 'RPI_PICO_AP'                  #Set access point name 
password = '12345678'      #Set your access point password

ap = network.WLAN(network.AP_IF)
ap.config(essid=ssid, password=password)
ap.active(True)            #activating

while ap.active() == False:
print('Connection is successful')
def web_page():
  html = """<html><head><meta name="viewport" content="width=device-width, initial-scale=1"></head>
  <body><h1>Welcome to microcontrollerslab!</h1></body></html>"""
  return html
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)   #creating socket object
s.bind(('', 80))
while True:
  conn, addr = s.accept()
  print('Got a connection from %s' % str(addr))
  request = conn.recv(1024)
  print('Content = %s' % str(request))
  response = web_page()

Now, my problem is that the Raspberry Pi Pico W runs out of memory due. I'd like to know whether it is RAM or Storage as the latter could be expanded but the former can't. The HTML file could be uploaded into the Raspberry Pi but once you run it it says MemoryError: memory allocation failed, allocating ### bytes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.