By: Jason Brownstein
This is a technical post for embedding electronics in a 3D print. We are using a Taz series Lulzbot printer from Aleph Objects. This post assumes you already know how to use a 3D printer and how to edit gcode.
We are pre-prototyping a product for our Kickstarter, Build Upons. To prototype Build Upons before going into insert molding, we used everything from super glue and copper tape to our Taz Lulzbot 3D printer to do all of our DIY-style prototyping. Build Upons will allow people to light up an existing LEGO™ set with light up bricks! Below is a photo of a StarWars™ set that shows off our light up bricks.
To prototype these, we had to put an LED on a circuit board in the middle of our 3D printed brick. We wanted to share our process so you can embed circuit boards in your fabrications.
The image below is a 1×1 LED brick printed with natural PLA containing a printed circuit board (the wires attached are for connectivity to a power source).
Below is the circuit board that is used in this brick. These boards have been custom made by Gold Phoenix with edge plating. The wire is coiled up to fit in the socket of the LED brick while the print continues.
The root of all 3D printing machines is gcode. This code tells the 3D printer where it should go and what it should do at that specific point and how fast to do it. Once a 3D model is created, it can be opened in a variety of slicing and gcode generating programs. There are several slicer and gcode generators, for example, Cura, Slicer, or Simplify3D.
It is possible to pause a 3D print mid print via the LCD on the Lulzbot but has unwanted side effects, mainly the extrusion head will continue to ooze. In addition the head would then be in the way of the cavity. It is possible to move the z axis on the LCD while the print is paused but the printer will not remember exactly where it was before, so the best way to complete this process is within the gcode.
There are some basic gcode commands that help to understand what is basically happening on each line of code that is getting passed to the 3D printer. Gcode is editable and viewable in most text editing softwares, for example, TextWrangler is nice because it lets you retain the initial file extension. All of the gcode commands are conveniently laid out in a wiki provided by reprap, but here are some of the basic commands:
G0 or G1 (they are interpreted the same) : Move Command
- Arguments : G0/G1 Xnnn Ynnn Znnn Ennn Fnnn
- This command will tell the extrusion head where to move in space (x,y,z) then how much filament to extrude (e) and at what feed rate (f).
G28 : Move to origin
- Arguments : G28 None or X Y Z
- This command when used alone will home all axes but when used with the argument x, y, or z the command will only home those axes specified.
M25 : Pause Print from a SD card
- This command has no arguments. When executed it will finish all buffered commands and then pause the print just like the command on the Lulzbot LCD would.
M104 : Set extruder temperature
- Arguments : M104 Snnn
- This command is usually automatically included at the end of gcode to turn the extruder off when the print is complete. But can be used to set or change temperatures during a print using S then the temperature value.
M140 : Set bed temperature
- Arguments: M140 Snnn
- This command is the same as M104 for the extruder but controls bed temperature.
M106 : Control fan speed
- Arguments: M106 Snnn
- This command is will control your fan speed and is a PWM value so on the Lulzbot (0-255).
All of these commands are on the reprap wiki but the above are useful to know when inspecting gcode.
The below gcode pauses the print, then lifts the extruder head to a distance that you can access the 3D print and resume the print on the LCD once the electronics have been inserted. The extrusion head will return to the last position and continue printing. Below is the original code in the left column and the altered code in the right column.
You will need to determine the layer you want to pause the print. In Simplify3D there is a visual representation of all the tool movements and you can see the part being built layer by layer. Find the point in which the cavity is finished to put the PCB in, (layer 88 in the example) and make the adjustments to the code in this layer.
It is important to remember that when you insert the PCB into the 3D part the circuit board must sit lower than the current layer height. Otherwise the extruder head will run into the circuit board. Another way to determine the correct layer to alter, is by finding the exact z height that the print should be at given the height of the cavity in the 3D model. This method becomes a little confusing since the height will not be exactly correct as the slicing software will have broken the model up into distinct layer increments based on the layer height as determined in the settings of your software. For example, if you are printing on fine mode, the layer height is 1/10mm so all layer steps will occur as increments of .1mm but if the layer height was .2mm all layers would increment in .2mm heights.
Once you have your location specified, add the code to pause the print and raise the print head. Add the M25 command to pause the print before making any moves to the print head. The printer will have buffered all G1 commands before the pause so you can make sure the print stops right after the commands are complete. Then add the move command to be right after the z step to the next printed layer. The printer will run through the first set of G1 commands before pausing (It stops at G92 E0). Be careful not to indicate the return height before the G92 E0 command.
Once the printer has paused and moved itself out of the way, put the circuit board in the 3D printed piece! Depending on the size of your print and the snugness of the fit for the circuit board be careful not to knock the print off the print bed. Resume the print via the LCD, and the printer will cover up the circuit board and you’ve successfully embedded a PCB in the 3D printed part!
Another application for using this method is an effective way to change filament midway through a print if the printer has only one extrusion nozzle. This solution of pausing the print and moving the head out of the way can be useful when changing the color or type of filament. This method allows for a more dynamic print while utilizing the base model of most 3D printers. More than just circuit boards can be embedded with this method if a part needs to have metal inserts or if internal cavities need to be coated in an epoxy to make a part water proof for the inside of a vase. The applications are endless!