Share + Wi-Fi + QR Code

Share Wi-Fi Using A QR Code

  • Adam Douglas

Sometime ago now, I decided that I had enough with the whole process of sharing one’s Wi-Fi SSID (service set identifier, network name) and password manually. One always ends up getting something communicated wrong or entered wrong when trying to connect to Wi-Fi. In the past, for a brief time period, I used NFC tags to make connecting to Wi-Fi easier. However, nowadays using NFC tags to connect to Wi-Fi are not well-supported, at least in my experience. Since I’ve been playing around with QR codes (How To Read The TOTP Secret Key from a QR Code Image) I thought why not use this as a solution since it is well-supported on most mobile devices. For those devices that cannot use QR codes to connect to Wi-Fi then the manual solution will be available as a back-up.

I found a good terminal based application for QR code encoding called “qrencode” and a graphical application called “QtQR” which just so happens to use qrencode. I installed the packages “extra/qrencode” and “community/qtqr” on my Arch Linux system, and began to play around with generating the QR codes that would connect to Wi-Fi. After I was done encoding the two QR codes, one for 2.4g and one for 5g, I then created an image in Inkscape that would have the QR codes, Wi-Fi signal strength, Wi-Fi SSID (network name) and password. Then I printed it all out on to card stock (199 g/m2 (100 lb.)), cut out along the cut lines and glued two strips of magnets two the back of each QR code, so I can attach them on to my fridge. I am happy to say they are working great and have simplified the process. Looking back though for manual use I maybe should have added the authentication type (e.g. WPA/WPA2/WPA3) or stated which line is the Wi-Fi SSID or password. However, I don’t think it will really become an issue since it is pretty intuitive and very little information available to confuse. The hardest part I found was figuring out the QR code input string format. I had to search for quite some time on this and eventually found it for Android and iOS 11+. If anyone finds a better source, please let me know.

Here is a brief run down of the steps I took using a Linux terminal to create the Wi-Fi QR codes.

Note

Refer to ZXing Wiki: Barcode Contents > Wi-Fi Network Config for specifics on Wi-Fi QR code input string formatting.

Install Packages

Arch Linux

# pacman -Syu qrencode

Debian

# apt install qrencode

Generate QR Code

Make sure to input corresponding values for each placeholder {SSID}, {AUTH-TYPE}, {PASSWORD}, {true/false/blank}). This includes the prefix curly bracket, placeholder name and suffix curly bracket.

QR Code Terminal Output

$ qrencode -s 6 -l H -o - -t utf8 'WIFI:S:{SSID};T:{AUTH-TYPE};P:{PASSWORD};;'
-s    Specify the size of the dot (pixel). (default=3)
-l    Specify error correction level from L (lowest) to H (highest). (default=L)
-o    Write image to FILENAME. If '-' is specified, the result will be output to standard output.
-t    Specify the type of the generated image. (default=PNG)
T     Authentication type; can be WEP, WPA, WPA2-EAP, nopass
S     Network SSID
P     Password
H     Optional, true if the network SSID is hidden; Can be true, false or blank

QR Code Output To File

$ qrencode -s 6 -l H -o "wifi-5g.png" 'WIFI:S:{SSID};T:{AUTH-TYPE};P:"{PASSWORD}";H:{true/false/blank};'
-s    Specify the size of the dot (pixel). (default=3)
-l    Specify error correction level from L (lowest) to H (highest). (default=L)
-o    Write image to FILENAME. If '-' is specified, the result will be output to standard output.
T     Authentication type; can be WEP, WPA, WPA2-EAP, nopass
S     Network SSID
P     Password
H     Optional, true if the network SSID is hidden; Can be true, false or blank

QR Code Output To File Example

Connecting to a hidden network SSID of “adamsdesk” using WPA/WP2/WP3 authentication type. Password is enclosed in double quotes to avoid issues. The generated QR code will be outputted to a filename of “wifi-5g.png”.

$ qrencode -s 6 -l H -o "wifi-5g.png" 'WIFI:S:adamsdesk;T:WPA;P:"p9XD`Cbca4@7_YCj";H:true;'

Wi-Fi QR Code Example

Share Wi-Fi Sign Example

This is an example of what I created within Inkscape to put on my fridge.

Share Wi-Fi sign example

This is post 6 of 100, and is round 2 of the 100 Days To Offload challenge.

    • correct Debian package install command
    • change topic
    • remove tag wifi
    • change topic
    • Change 100DaysToOffload message