{"id":19213671,"url":"https://github.com/predmijat/qr_wifi","last_synced_at":"2025-05-12T22:18:39.233Z","repository":{"id":97311066,"uuid":"575574381","full_name":"predmijat/qr_wifi","owner":"predmijat","description":"Joining a Wi-Fi network with style!","archived":false,"fork":false,"pushed_at":"2024-04-05T10:51:43.000Z","size":883,"stargazers_count":44,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-12T22:18:31.588Z","etag":null,"topics":["figlet","mikrotik","python","qrcode","raspberry-pi","wi-fi"],"latest_commit_sha":null,"homepage":"https://sre.rs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/predmijat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-07T20:26:07.000Z","updated_at":"2024-12-28T11:45:01.000Z","dependencies_parsed_at":"2025-04-20T18:34:34.617Z","dependency_job_id":"f2f7a3a4-1d1f-4482-8318-a5a26d4a6f54","html_url":"https://github.com/predmijat/qr_wifi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/predmijat%2Fqr_wifi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/predmijat%2Fqr_wifi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/predmijat%2Fqr_wifi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/predmijat%2Fqr_wifi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/predmijat","download_url":"https://codeload.github.com/predmijat/qr_wifi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253831018,"owners_count":21971009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["figlet","mikrotik","python","qrcode","raspberry-pi","wi-fi"],"created_at":"2024-11-09T14:06:59.046Z","updated_at":"2025-05-12T22:18:39.221Z","avatar_url":"https://github.com/predmijat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"assets/img1.png\" alt=\"image\" width=\"800\"/\u003e\n\n## What is this?\n\nThis repository will show you how to display a QR Code on a Raspberry Pi Pico display,\nso that you can join a Wi-Fi network with style!\n\nThe acompanying video is on [YouTube](https://youtu.be/APTqu29ApRc).\n\nDisclaimer: there are probably better ways to achieve this.\n\n## TL;DR\n\nCreating a guest Wi-Fi network on a router is something you'll have to figure out yourself for your router model.\n\nGenerate a QR Code with ASCII characters.\nThe string you encode must be in the correct format: `WIFI:S:\u003cSSID\u003e;T:\u003cWEP|WPA|blank\u003e;P:\u003cPASSWORD\u003e;H:\u003ctrue|false|blank\u003e;`\n\nPrepare `main.py` (depends on the display you have), add QR Code in ASCII format, and copy `main.py` to your Pico.\n\nCheck `create_new_password_and_regenerate_qr_code.sh` for a all-in-one solution.\nIt uses MikroTik router as an example, SSH-es to it, resets the guest password,\nand then creates a new QR code with Wi-Fi network credentials.\nIt also shows you how you can restart Raspberry Pi Pico without unplugging it.\nWith few modifications you can run this script in `cron` and reset your guest\nWi-Fi network on a schedule of your choosing.\n\n## Details\n\n#### Requirements\n\nYou'll need to create a guest Wi-Fi network on your router and you'll probably want to drop network packets\nbetween that guest network and your private network.\n\nThis project uses Raspberry Pi Pico and a [Waveshare's Pico OLED 1.3 screen](https://www.waveshare.com/wiki/Pico-OLED-1.3) (64x128 pixels).\nYou'll need to edit the drawing logic in `main.py` if you are using a screen with different resolution.\nYou also can't use long SSID and/or long password on a screen this size. Limit calculations left as an exercise to the reader.\n\nFor adding support for MicroPython on your Raspberry Pi Pico, check the [official documentation](https://www.raspberrypi.com/documentation/microcontrollers/micropython.html).\n\n#### Generating QR Code for joining a Wi-Fi network\n\nTo be able to join a Wi-Fi network by scanning a QR Code,\nthe string you encode must be in the following format:\n\n`WIFI:S:\u003cSSID\u003e;T:\u003cWEP|WPA|blank\u003e;P:\u003cPASSWORD\u003e;H:\u003ctrue|false|blank\u003e;`\n\nFor my network with SSID `sre_g` and password `sre_gst!`, the string looks like this:\n\n`WIFI:S:sre_g;T:WPA2;P:sre_gst!;;`\n\nFor encoding, I'm using `qrencode` tool, which by default creates a .png file.\nI want to show it on a [Waveshare's Pico OLED 1.3 screen](https://www.waveshare.com/wiki/Pico-OLED-1.3) (64x128 pixels),\nand you can do that by creating a QR Code with ASCII characters, and then paint the pixel WHITE if the character is present,\nor paint it BLACK if the character is absent (actually if the character is space - ' ').\n\nAnother thing `qrencode` does by default is it creates an image (or ASCII, or whatever) which is larger than 64 pixels,\nso you have to use additional flag to bring the size down (check `qrencode --help` for details).\n\nThe final command looks like this:\n\n`qrencode -t ASCII -m 0 -o qr_ascii.txt 'WIFI:S:sre_g;T:WPA2;P:sre_gst!;;'`\n\nNow you have QR Code in ASCII (`qr_ascii.txt`), but the dimensions are a bit off - it's 50 columns wide, but only 25 rows tall (this will depend on the length of SSID + password).\nWhile it might look OK in a text editor, displaying it on pixel matrix will make it look like a rectangle,\nso you'll have to duplicate each row:\n\n`sed -i -e '/\\(.*\\)/p' qr_ascii.txt`\n\nand then you need to prepare this as a list of strings (surround it with double quotes and add a comma at the end):\n\n```\nsed -i -e 's/\\(.*\\)/    \"\\1\",/' qr_ascii.txt\n```\n\n#### Displaying QR Code on the display\n\nNow you can insert the contents of `qr_ascii.txt` to `qr_code` list in `main.py`.\n\nYou should also edit the `msg` list in `main.py` to your liking.\nI used `figlet` to create these.\n\nFirst part of the code which initializes the OLED screen is taken from the [Waveshare Pico OLED 1.3 Wiki](https://www.waveshare.com/wiki/Pico-OLED-1.3).\n\nConnect Raspberry Pi Pico to your computer and copy `main.py` to Pico (you need to figure which /dev Pico is on your machine, or use Pycharm/Thonny):\n\n`rshell 'cp main.py /pyboard/main.py'`\n\nand then replug your Pico.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpredmijat%2Fqr_wifi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpredmijat%2Fqr_wifi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpredmijat%2Fqr_wifi/lists"}