3D-Printer Enclosure Fan Control

3D-Printer Enclosure Fan Control

The Tukkari TLX Enclosure

I have bought the Tukkari TLX version of 3D/printer cabinet for Prusa i3 MK3+. This nice enclosure comes as a kit and it comes with a active carbon- and HEPA filter in the kit to reduce nanoparticles and fumes that can come from the 3D printing process.

To get the sometimes toxic particles out of my room someting needs to be done.

Take a look at Tukkari’s page for the different products that the manufacture and sells>


Tukkari TLX Enclosure for Prusa i3 MK2/MK3 (White color)

Tukkari Printer Enclosure

A 120 mm. fan can be mounted either inside or on the back of your enclosure. As I plan to let the air out of the enclosure and guide it out of my room I install the fan on the back of the enclosure as shown here. The bolts are already included in the kit when buying the enclosure from Tukkari

Installing a fan to the enclosure (optional)

The enclosure comes with a filter that you can be mounted either on the inside or at the outside of the enclosure. As I want to mount a fan on the outside I mounted the filter on the inside.

The fan is an optional thing and are not included with the enclosure kit from Tukkari.

I ordered a 120 mm. noctura low noise 5V version to be able to power it from the Raspberry Pi I use as printer server.

In my case I ordered the Ultra Low Noise NF-F12 5V fan (5V USB cable included).

This noctua fan comes with different cable parts. When adding the USB Type-A to the end the cable length is long enough to be router from the back of the enclosure and into the left (seen from the front of the enclosure) cable entry and the to be mounted into one of the USB connectors on the raspberry Pi that I have added to the printer aluminum profile with a 3D printed box

Note! The image is for the PWM version. In the 5V version the cable part (USB-A) is included

Link to the fan at noctua’s webpage:


Setting up Octoprint to to start and stop the enclosure fan

To be able to control the Fan in the enclosure several things needs to be done

Adding system menu’s to control the USB power on the Raspberry PI

Shell scripts to control power to USB connector on Raspberry Pi

I created two different shell scripts. One to turn on USB power and one to turn off the USB power. In my case I use the Raspberry Pi 3B+. The version has 4 USB-A ports. Unfortunately these are all controlled simultaneously. If you turn off one the three others also will be powered off. In my case I have a Webcam, the fan and a LaMetric display connected to my Raspberry Pi. That is not a problem that they are all turned off when I want to turn of the power for the fan for the enclosure. On the Raspberry Pi 4 you can turn the two blocks of 2 USB connectors on and off independently

To be able to turn of the power for the USB connectors from the command line you first need to install the uhubctl USB Power Contrll package. This can be installed like here:

git clone https://github.com/mvp/uhubctl
cd uhubctl

This should generate uhubctl binary. You can install it in your system as /usr/sbin/uhubctl using:

sudo make install

Then you can call this library

usb_on.sh contains:
sudo /home/pi/uhubctl/uhubctl -l 1-1 -p 2 -a on

usb_off.sh contains:

sudo /home/pi/uhubctl/uhubctl -l 1-1 -p 2 -a off

To be able to call these two scripts from the Octoprint UI I will add two commands to the System menu on the printer interface. This can be done by changing the config.yaml file which can be found in the

/home/pi/.octoprint folder

Edit the config.yaml file and add the following code (place it in just before the temperature: part of the file.

  - action: Uoff
    command: /usr/local/bin/scripts/usb_off.sh
    name: Turn USB Power Off
  - action: Uon
    command: /usr/local/bin/scripts/usb_on.sh
    name: Turn USB Power On

After this and restarting the Octoprint you can then find two new commands in the Octoprint userinterface

User rights to run the shell command from Octoprint

Some more thing needs to be done before being able to control the USB power from Octoprint. You need to change the user rights for this.

Go to a shell and do the two following chmod commands

chmod a+x /usr/local/bin/scripts/usb_off.sh


chmod a+x /usr/local/bin/scipts/usb_on.sh

This will add permission for all users to execute the two .sh files

chmod: change mode (permissions) of a file.
a+x: for all (a) users, add (+) the execute (x) permission

Now trying this out from the system menu results in the following where we get "Success" response from the system:

Make the fan turn on and off automatically when printing

To be able to turn on the printer when starting to 3D print it can be nice if this can be done using G-CODE commands that is commonly being used in computer-aided manufacturing to control automated machine tools like 3D-printer and CNC milling machines.

When in my case the PrusaSlicer tool slices a STL file into a machine script file, it could be nice also to be able to turn the enclosure fan on before starting to print. And to turn it off again after the print has been finalized.

Lets define two G-Code commands. In my case have made GCODE10 which call the usb_on script and a GCODE11 which calls the usb_off script. Look below to see the two definitions

Now we have these we need to be able to inject those GCODE commands during a print of a part. The most of the GCODE comes from the PrusaSlicer output file.

In the menu Printer | GCODE Scripts you are able to add more commands that call be call before, after a job completes and after a job is cancelled and after a job is paused.

In this case we will add the two newly defined GCODE commands in the start and after job completes section of this setup page. Look here where marked with arrows.

Now the enclosure fan turns on when the print job starts. And after the print completes it automatically turns off the enclosure fan turns off.

Adding a Fan Shroud to the backside of the fan

To be able to attach a tube to let the fumes out of the enclosure to open air. A shroud is needed to be attached to the fan on the rear side of the enclusure.

As this is a 120 mm fan I get the measures from a drawing which shows the default hole position for such a fan. I design it in SolidWorks. In version 3 of the file the holes has been changed to 4.2 mm. each and not 4.0 as can be seen on the image below

Here a viewer showing the final STL 3D-file. Below you can download a copy and print it for yourself for free.

Loading file
  • Fullscreen
  • Wireframe
  • Zoom In
  • Zoom Out
  • Rotation
  • Screenshot
  • Help


  • Rotate with the left mouse button.
  • Zoom with the scroll button.
  • Adjust camera position with the right mouse button.
  • Double-click to enter the fullscreen mode.
  • On mobile devices swipe to rotate.
  • On mobile devices pinch two fingers together or apart to adjust zoom.
  • On mobile devices 3 finger horizontal swipe performs panning.
  • On mobile devices 3 finger horizontal swipe performs panning.

Here you are welcome to download the file:

Or you can now also find it on Thingiverse where I have created it to my list of designs:


My other Thingiverse design:


That’s it!

Mission Complete!!

Share this content:


watch series Posted on00:52 - July 9, 2022

I got what you mean,bookmarked, very nice web site. Michal Wemmer

watch series Posted on00:18 - July 11, 2022

Way cool! Some extremely valid points! I appreciate you writing this post and also the rest of the website is really good. Laverne Kagan

bets10 giris Posted on16:24 - July 16, 2022

I visited several web pages but the audio feature for audio songs present at this website is truly excellent. Tanner Waughtal

bets10 giris Posted on13:28 - July 17, 2022

Merely wanna comment on few general things, The website design and style is perfect, the written content is really superb : D. Chad Laruffa

erotik Posted on02:28 - July 18, 2022

I was reading through some of your content on this website and I believe this website is real instructive! Continue putting up. Luke Redondo

sikis izle Posted on15:17 - July 18, 2022

Watch Online Bollywood 2018 Full Movies in Best HD Print Quality,Download These Movies From our Website,We Have All Indian Movies For The Year 2018. Jimmie Kerr

bets10 giris Posted on01:25 - July 19, 2022

You made some good factors there. I viewed the net for the issue and discovered most people will certainly go along with with your web site. Augustine Durett

bets10 giris Posted on05:03 - July 19, 2022

I have been checking out a few of your articles and i must say pretty nice stuff. I will surely bookmark your website. Arron Farris

zoritoler imol Posted on22:09 - August 2, 2022

Good ?V I should definitely pronounce, impressed with your site. I had no trouble navigating through all the tabs and related information ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or anything, site theme . a tones way for your client to communicate. Excellent task..

bahis Posted on16:56 - August 7, 2022

New TOR address for the Wild Neutron hacking group. Garfield Orzalli

eskort bayan Posted on04:33 - August 8, 2022

Very happy to have the opportunity to read Lithuanian papers again. Antione Yanity

porno Posted on22:59 - August 9, 2022

Well I really enjoyed studying it. This information provided by you is very constructive for accurate planning. Moshe Giacomo

eskort bayan Posted on15:56 - August 10, 2022

Excellent, what a blog it is! This website presents valuable facts to us, keep it up. Sanford Thompkins

viagra Posted on00:27 - August 11, 2022

Looking forward to reading more. Great article post. Thanks Again. Great. Stanley Sagun

buy viagra Posted on19:13 - August 12, 2022

What a information of un-ambiguity and preserveness of valuable know-how about unpredicted feelings. Derek Liedy

eskort bayan Posted on01:13 - August 13, 2022

Hi there, after reading this remarkable paragraph i am also cheerful to share my knowledge here with colleagues. Allan Offermann

Gal Jerman Posted on21:26 - August 26, 2022

Top ,.. top top … post! Keep the good work on !

Mark Posted on09:45 - September 10, 2022

Thanks for your blog, nice to read. Do not stop.

Sheri Scott Posted on07:54 - September 15, 2022

Thanks consequently much for the article post.Really thank you! Much obliged.

Leave a Reply