Robotics & Engineering Python
Advanced
60 mins
Teacher/Student led
+105 XP
What you need:
Chromebook/Laptop/PC

Wifi Signal Strength Scanner

In this lesson, you will create a Wifi Signal Strength Scanner using your Raspberry Pico. You will build a web page that displays the signal strength of nearby Wi-Fi networks, and learn how to connect your Pico to the internet.

Teacher Class Feed

Load previous activity

    1 - Import Libraries

    Start by importing the necessary libraries:

    import network
    import socket
    from time import sleep

    2 - Set Wi-Fi Credentials

    Replace 'Your_SSID' and 'Your_PASSWORD' with your Wi-Fi network's SSID and password:

    ssid = 'Your_SSID'
    password = 'Your_PASSWORD'

    3 - Create scan_wifi Function

    Create a function called 'scan_wifi' that scans for nearby Wi-Fi networks and returns a list of tuples containing the SSID and signal strength (RSSI) of each network:

    def scan_wifi():
        wlan = network.WLAN(network.STA_IF)
        wlan.active(True)
        networks = wlan.scan()
        wifi_data = []
        for net in networks:
            ssid = net[0].decode('utf-8')
            rssi = net[3]
            wifi_data.append((ssid, rssi))
        return wifi_data

    4 - Create webpage Function

    Create a function called 'webpage' that takes the Wi-Fi data list as an argument and generates an HTML string to display the Wi-Fi signal strength information in a table:

    def webpage(wifi_data):
        ... (include the full 'webpage' function code from the provided code snippet)

    5 - Create serve Function

    Create a function called 'serve' that connects the Pico to the Wi-Fi network, starts a web server, and sends the generated HTML string to clients when they connect:

    def serve():
        ... (include the full 'serve' function code from the provided code snippet)
    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2025. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more