I wanted to print a QR code for home guests to be able to connect to my wifi without me having to write down the password for them. I couldn't find any STL generators for QR codes, so I decided to make one using Python and Blender.
While I designed this with Wifi and 3d printing in mind, you could change the icon to something like a website icon or logo and then insert a URL instead of Wifi credentials. Even if you don't have a printer, you can use the files/qr.png
image that is generated and hang it up at home or hand it out.
-
pip3 install -r requirements.txt
For the quickest setup, just put your Blender path and wifi information into qr.py
with a text editor. If you want to configure the STL generation, use the following options:
-
qr.py
blender_path
: Path to blender program. On MacOS this is something like/Applications/Blender.app/Contents/MacOS/Blender
. Defaults for other operating systems are in the scriptauth_type
: Wifi auth type, valid inputs areWPA
,WEP
, and emptyssid
: Name of your Wifi networkpassword
: Password for Wifi network. This all runs locally, but keep in mind that if someone can see your QR code they can also extract the password
-
qr_blend.py
svg_path
: Path to QR code SVG file, default is fine if you're using the built-in SVG generatoricon_path
: Path to SVG of center iconoutput_path
: Where you want the resulting STL to goicon_radius
: How big to make space for the center icon, this should be small (0.005 - 0.02)qr_height
: Height in mm to make the 'black' part of the QR codeicon_height
: Height in mm to make the iconbase_height
: Height in mm to make the 'white' part of the QR codeqr_length
: Length in mm of the code portionicon_length
: Length in mm of the center iconbase_length
: Length in mm of the basemulti
: Experimental feature that generates three STLs independently for multi-colored prints
-
In
qr_img.py
The amount of redundancy can be adjusted which allows for things such as icons and such. However, to reduce the density of the code this can be lowered if desired:ERROR_CORRECT_L
: About 7% or less errors can be corrected.ERROR_CORRECT_M
: About 15% or less errors can be corrected.ERROR_CORRECT_Q
: About 25% or less errors can be corrected.ERROR_CORRECT_H
: About 30% or less errors can be corrected.
The scripts have other things you can tweak if you wanna dig into it, and I may add more options if it turns out people want some more.
If all of the dependecies are installed correctly and the Blender path is correct, running is as simple as:
python3 qr.py
The STL will end up in the current directory by default. A PNG will also be generated at files/qr.png
.
PrusaSlicer is what I use to slice my prints and it has a really cool feature that allows you to pause prints at a certain layer to change filaments. Simply import the STL, set the layer where you wanna swap, then the printer will pause at that layer and allow for a filament swap. I'm told that other slicers like Cura also have this feature.
I don't have a multi-color printer, but I attempted to implement an option that would generate three different STLs so that they can be printed in different colors within the same layer. To enable this, set multi = True
in qr_blend.py
. If you try it, please let me know if it works or not!
- Make sure you're using 3.x
- Make sure you're using Blender 2.8x
- Lots of people are having issues with modules being installed but not seen by Python, make sure that your paths are set up correctly. Stack overflow has tons of answers on this. Here's one
If you run into other issues, feel free to email me at lukerindels98@hotmail.com