Skip to content

About

Generates 3D-printable enclosures for Raspberry Pi, Arduino and ESP32 boards. Exports STL and STEP, and SVG for laser-cut panels. Runs on your PC in the browser. Windows .exe available.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Enclosure Generator: 3D-printable enclosures for Raspberry Pi, Arduino and ESP32

The Enclosure Generator builds a printable case around your electronics boards. You choose the boards from a library (Raspberry Pi, Arduino, ESP32). You shape the case, place cutouts and vents, and check the result. Then you export the bottom and the lid as STL for your slicer and as STEP for CAD. The program is open source and runs on your PC in the browser. It needs no account.

Enclosure Generator: a Raspberry Pi 5 and Pico in a snap-fit case, with the settings on the left and the 3D preview on the right

What you can do

  • Choose modules from the library: Raspberry Pi 3B, 4B, 5, Zero 2 W and Pico, Arduino Uno and Nano, ESP32 DevKitC. Add your own modules, import STEP or STL files, or load more boards from the online library.
  • Make the case a rectangle, a circle or a polygon, with automatic or fixed size.
  • Choose a screwed lid, a snap-fit lid or a sliding lid, flat or as a tray.
  • Choose the fastening for each part: heat-set insert, self-tapping screw, hex nut (glued), pegs (with super glue) or clips.
  • Add round, rectangular or slot-shaped cutouts. Templates exist for USB-C, HDMI, buttons and cable glands. The program can place them at the connectors of your boards.
  • Add vents. Pick an area, a slot width and an angle. The slots fill the area.
  • Let the program place the modules, then move them with the mouse in the 3D view.
  • Add wall tabs or DIN rail (TS35) holders, moulded on or as a separate part.
  • Run the checks before export: closed model (watertight for the slicer), fits your printer, no thin walls, no collisions.
  • Use the options of version 1.1. They export walls and lids from acrylic or wood as SVG files for the laser cutter. They add accessories (feet, recesses for rubber feet, magnets, tripod thread, handle). They measure a module from a photo on millimetre paper.
  • Switch between English and German, and between light and dark mode.

Four examples: a rectangular case with vents, a hexagonal case with wall tabs, a round case and a laser-cut acrylic case with a handle

Laser-cut panels

You can make the walls or the lid from acrylic or plywood. The program exports one SVG per panel, 1:1 in millimetres, with kerf compensation. The printed frame holds the panels.

The Laser tab: a front wall and a lid in 3 mm acrylic, shown in the 3D preview

Download and install (Windows)

  1. Open Releases and download Gehaeuse-Generator.exe.
  2. Double-click it. If Windows shows "Windows protected your PC", click More info, then Run anyway. The file is not signed.
  3. Wait about 15 seconds. Your browser opens with the program. Close the black window to quit.
  4. Find your files in Documents\Gehaeuse-Generator.

To run it from source, download the ZIP (or clone the repository) and double-click Start.bat. On the first start, the script installs uv, Python and all packages. This takes a few minutes. The program needs Python 3.11 or 3.12, and uv fetches it for you.

The program runs only on your PC (address 127.0.0.1) and sends no data away. Only the button Load online library downloads module data from GitHub.

Frequently asked questions

Is there a free enclosure generator for the Raspberry Pi, Arduino and ESP32?

Yes, this one. It's open source under the MIT license.

Which file formats does it export?

It exports STL for slicers, STEP for CAD programs and SVG for laser-cut panels.

Can I use a board that is not in the library?

Yes. Enter its size, holes and connectors, import a STEP or STL model, or measure it from a photo on millimetre paper.

Does it work offline?

Yes. Your PC computes everything. Only the optional online library needs the internet.

What do the checks before export tell me?

They test that each part is a closed 3D model. This is what "watertight" means for the slicer. It doesn't promise a waterproof case. They also test that the part fits your printer, that no wall is too thin and that modules, domes and cutouts don't collide.

What is it built with?

Python with build123d for the 3D models and NiceGUI for the browser interface.

How to use it

The settings are in tabs on the left. The 3D preview is on the right. The program recalculates after every change, about one second later. You can switch this off with Auto update.

In the 3D preview, drag with the left mouse button to rotate, with the right button to move, and use the wheel to zoom. Drag modules on the floor or the lid to a new place. Blue is the case, light blue and transparent is the lid, and green are the modules.

1. Modules tab

  1. Choose a module from the library and click +. A check mark means the dimensions match the official drawing. A question mark means you should measure the real board.
  2. Set these values for each module:
    • Mounting surface: floor, lid (hanging) or a wall.
    • X and Y: the position of the module centre. On walls, X runs along the wall and Y is the height.
    • Rotation in degrees, and height above the surface (from the floor to the underside of the board).
    • Fastening and thread.
    • Connector sides to the outside: tick the sides that face out of the case (front, back, left, right, top, relative to the module). The program cuts matching openings and moves this side to the wall when it places the module.
  3. To add a new module, enter its own dimensions (length, width, height, holes, connectors). Click Apply and save. The module goes to My modules and stays in the list.
  4. To import a STEP or STL file, load the 3D model of a board, for example from the maker. The board must lie flat. The program finds the holes in STEP files by itself. The editor opens so you can check the result.
  5. Load online library fetches new modules from the GitHub project.

The button Place automatically (above the preview) arranges all modules on the floor. Modules with connector sides go to the walls and the others go to the middle. Then you can move them.

2. Case tab

  • Shape: rectangle, circle or polygon (you choose the number of corners).
  • Size: automatic, or fixed (length and width, or the outer diameter).
  • Height: automatic, or fixed.
  • Wall thickness, floor thickness, lid thickness and corner radius.
  • Material: sets the matching tolerance (PLA 0.2 mm, PETG 0.25 mm, ABS and ASA 0.3 mm). It also sets how far snap-fit hooks may bend.
  • Gaps: between module and wall, at connector sides, and above the modules.
  • Lid type: screwed, snap-fit hooks or sliding lid (rectangle only). Lid height 0 makes a flat lid. A larger value makes the lid a shallow tray.
  • Heat-set insert preset: Generic or CORGI (your values from the old project).

3. Cutouts tab

  1. Click Add cutout.
  2. Choose the surface (wall, lid or floor), the position and the shape. You can also choose a template: USB-C, Micro-USB, USB-A, HDMI, Ethernet, DC jack, button, rotary encoder, toggle switch, LED, cable gland and more.
  3. Templates with a part behind them (for example a button) add the space this part needs.

The check reports a collision with a module. On walls, X runs from the wall centre to the right (seen from outside), and Y is the height from the lower edge of the case. On the lid and the floor, X and Y match the preview.

4. Vents tab

Place an area (rectangle or circle) on a wall, the lid or the floor. Then choose the slot width, the slot angle (0 degrees is horizontal) and the web between the slots. The slots fill the area by themselves.

5. Mounting tab

  • Wall tabs: moulded on (two tabs on the floor) or as a separate wall bracket.
  • DIN rail TS35: a separate bracket (recommended, prints without supports) or moulded on.
  • For separate parts, two countersunk screws hold the case to the bracket from inside. The bracket takes a hex nut, a heat-set insert or a self-tapping screw.

Accessories at the bottom of the tab:

  • Feet: four printed feet under the floor.
  • Recesses for rubber feet: flat recesses for self-adhesive rubber feet.
  • Magnets: pockets from below for disc magnets (glue them in), for example for metal cabinets.
  • Tripod thread 1/4 inch: glue a 1/4-20 hex nut in from inside. The case then fits any photo tripod.
  • Handle: a separate part, screwed on from inside with two M3 screws.

6. Laser tab (new in version 1.1)

You can make the walls (of rectangular cases) or the lid from a sheet of acrylic or plywood instead of printing them.

  1. Click Add panel.
  2. Enter the surface, the material, the sheet thickness and the kerf of your laser (typically 0.1 to 0.2 mm).
  • A wall panel turns the printed wall into a frame (you set the frame width). The panel sits inside behind the frame. Ribs on the floor and the sides hold it, and the lid holds it at the top. Push the panel in from above before you close the lid.
  • A lid panel makes the whole lid a sheet with the screw holes.
  • Cutouts and vents on this surface go into the panel.
  • The export makes one SVG file per panel, 1:1 in millimetres, with red hairlines. The kerf is already included (the outer contour is a little larger, the holes are a little smaller). Open the SVG in your laser software (for example LightBurn) and set the red lines to cut.

7. Measure from a photo (new in version 1.1)

  1. Put the module flat on millimetre paper. The whole sheet must be in the photo. Use a darker table, good light and little shadow.
  2. Take the photo from straight above.
  3. In the Modules tab, click Measure from photo and choose the photo. The program detects the grid size by itself. You can also choose 1, 2, 5 or 10 mm by hand.
  4. The program finds the sheet, corrects the perspective, finds the grid and measures the outline and the holes.
  5. The module editor opens with a check image. Red is the detected outline and blue are the detected holes. Check the values and correct them. A photo from above can't measure the height, so enter it by hand. Click Apply to put the module in the case.

The accuracy is about plus or minus 1 mm. For holes that must fit exactly, measure with a caliper.

8. Check tab

The check tests that all parts are closed (watertight), that they fit the build volume of your printer, that no wall is thinner than 1.2 mm and that nothing collides. It runs automatically at export. Green means fine, yellow is a hint and red is an error.

9. Settings tab

  • Printer: the Bambu Lab A1 is preset. Choose another printer, or Custom printer with its build volume.
  • Folders for export, projects and your own modules.
  • Tables: heat-set inserts, materials, printers and cutout templates are YAML text files. Click Open tables folder, change a file with an editor, save it, and click Reload.

Save and open a project

  • Save (top) writes a project file (.yaml) to the Projects folder.
  • Open loads a project file. All settings come back.
  • New starts an empty project or one of the examples.

Export and print

  1. Click Export. The files go to Ausgabe\<project name>:
    • ..._Unterteil.stl and .step (bottom), ..._Deckel.stl and .step (lid), and maybe a wall bracket and a DIN rail bracket.
    • ..._Baugruppe.step: everything assembled with the modules, to check in CAD.
    • The project file.
  2. Open the STL files in Bambu Studio. They already lie correctly on the build plate (the lid is turned over). You normally need no supports.
  3. After printing, press the heat-set inserts in straight with a soldering iron (about 220 °C for PLA).

Example projects

Open them with New, or find them in the folder Beispiele.

Example What it shows
Example Pi 4 A simple box, a screwed lid, heat-set inserts
Example Pi 5 and Pico Connectors to the outside, automatic placement, snap-fit hooks, a round vent in the lid
Example ESP32 hexagon A polygon, clips instead of screws, a cable gland, a button, an LED, wall tabs
Example Zero DIN rail A sliding lid, a separate DIN rail bracket, hex nuts, a vent on the side
Example Uno round A round case, the lid as a tray, pegs, a DC jack and a toggle switch
Example laser front Front and lid from acrylic (SVG), feet, handle

Where the module dimensions come from

Module Source Checked
Raspberry Pi 5 official drawing yes
Raspberry Pi Zero 2 W official drawing yes
Raspberry Pi 4B official drawing no (same hole pattern as Pi 5, measure the connectors)
Raspberry Pi 3B official drawing no (same hole pattern as Pi 5, measure the connectors)
Raspberry Pi Pico datasheet no
Arduino Uno R3 docs.arduino.cc no
Arduino Nano docs.arduino.cc no
ESP32 DevKitC V4 Espressif no

Checked means that the values match the text of the official drawing. For the other modules, measure the real board before the first print. The program shows a hint for this. Corrections and new modules are welcome as a contribution on GitHub (folder src/enclosure_gen/data/library, entry in index.yaml).

For developers

uv sync                 # set up the environment
uv run pytest           # all tests (geometry, checks, library, interface)
uv run enclosure-generator
powershell -ExecutionPolicy Bypass -File packaging\build_exe.ps1   # build the Windows version

The program uses Python 3.12, build123d (OpenCascade) for the solids and STEP, NiceGUI for the interface and trimesh for the checks. To publish a new version, build the .exe with the build script. Then create a release vX.Y on GitHub with Gehaeuse-Generator.exe. The tests run automatically at every upload.

File Contents
model.py Project data (saved as YAML)
shapes.py, layout.py Case shape, size, position of the modules, automatic placement
enclosure.py Bottom, lid types, domes, clips
features.py Cutouts, connector cutouts, vents
accessories.py Wall tabs, DIN rail bracket
checks.py Checks before export
laser.py Panels for the laser cutter, SVG export
addons.py Feet, magnets, tripod thread, handle
photo.py Dimensions from a photo (OpenCV)
library.py Module library, import, online library
app.py Interface
locales/*.yaml Texts. To add a language, copy a file and translate it.

The file docs/Version-2.md describes how the functions of version 1.1 work (photo, laser, accessories).

License

MIT, see LICENSE.

About

Generates 3D-printable enclosures for Raspberry Pi, Arduino and ESP32 boards. Exports STL and STEP, and SVG for laser-cut panels. Runs on your PC in the browser. Windows .exe available.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages