Converting a 3D Printer Into an Automatic Spray Coater
By Remi_Rafael
Introduction
This instructable provides guidance on converting a 3D printer into an automatic spray coater. The project aims to enable reliable and repeatable spraying of materials, such as conductive inks, using a modified airbrush controlled by a 3D printer's electronics and an Arduino.
The main components of this tutorial include:
- Making a spray head controllable with a servomotor.
- Setting up the electronics for automatic spray control.
- Generating G-code to control the machine.
Optional steps are also introduced:
- Adding a mechanical stirring system for ink suspension.
- Creating an adjustable support for spraying at an angle.
Review these additional steps to decide if they fit your project needs before beginning construction.
Supplies
Tools
- 3D printer
- Soldering iron
Supplies You Will Need
- 3D printer frame: Almost any 3D printer or CNC frame can be used. Reprogramming the motherboard is optional. A frame built from aluminum profiles will facilitate component fixation.
- Double-action air-brush pen: Most basic types will work. Avoid models with large handles or pumps directly attached to the intake.
- Pump, compressor, or compressed air source: Ideally with a pressure regulator.
- Arduino UNO or similar programmable board.
- DC to DC step-down transformer: To produce 5V. Example: HiLetgo DC-DC Buck Converter (ASIN: B00LSEBYHU).
- Servomotor: A "Slim Wing Servos" type, such as the King Max KM2607MD.
- Diverse small cables and Dupont connectors.
- Various M3 screws.
- Optional: M5 or M4 screws and T-nuts for attaching elements to aluminum profiles.
Optional for the Mechanical Stirring System
- A second Arduino.
- A stepper motor.
- A Pololu stepper driver or equivalent.
- Potentiometer.
3D models for printing: Thingiverse - Spray_pen_holder_part_1
Arduino routines for control and Python program for G-code generation: GitHub Repository
Step 1: Understand and Adapt the General Strategy
The core idea is to replace a 3D printer's extrusion head with a spray head built from an airbrush and control it via the original motherboard. The optimal strategy depends on your printer's frame and motherboard programmability. If your printer has a controllable cooling fan (12V DC signal), this can be repurposed to control the spray head via an Arduino UNO, converting the signal to PWM for the servomotor.
If your mainboard supports PWM and can be reprogrammed, direct control is more efficient but not covered here. If no cooling fan is connected, consult your mainboard documentation or use the command M106 S255
(cooling fan ON) to identify the correct pins.
The provided Python routine generates G-code using G1
commands for movement and M106
commands for spray control. Test your setup's reaction to these commands or develop your own control strategy.
Step 2: Principles of the Spray Head
Double-action airbrushes operate via a trigger with two functions: activating the air valve and pushing the needle back to allow ink flow. The trigger's horizontal movement controls air, while vertical movement controls ink. This dual action is complex to pilot with a single servomotor. The method described uses a servomotor to push the trigger back and a fixed "wall" to force it sideways, ensuring simultaneous activation. This system controls ink delivery based on the servomotor's programmed angle but introduces friction, requiring sufficient servomotor torque.
Step 3: Choose a Spray Head Model
Select how to attach the spray head to your printer using the 3D printable holder models named "Spray_pen_holder_part_1" on Thingiverse. Options include:
- "Vertical holes": Used by the author, with two long vertical screws for attachment.
- "No holes": For users who prefer to design custom holes in CAD software.
- "M4 holes" or "7mm holes for inserts": Both feature an array of 9 holes for M4 screws, spaced 15mm apart. "M4 holes" allows screws to form threads directly in plastic, while "7mm holes for inserts" is for using heat inserts.
Step 4: Building the Spray Head
Print the required parts from Thingiverse and assemble them using M3 screws, following the provided images. If friction is high and the trigger doesn't return properly, use graphite powder as a lubricant or add a rubber band. Graphite may stain, and the rubber band adds effort for the servomotor.
Step 5: Pre-Connecting the Spray Head
This step covers the electrical interconnection. The described circuit is valid for a 12V main alimentation and when using the printer's cooling fan control signal (>5V DC) to control the spray head.
ATTENTION: Before assembly, identify the cooling fan control pin on your printer's mainboard and check the main alimentation voltage (12V or 24V). The Arduino UNO accepts 6-20V on its VIN pin.
The servomotor requires 5V. While the Arduino can produce 5V, its current capacity is insufficient. A DC-DC step-down converter (e.g., LM2596) is required. Connect its input to the main alimentation, set the output to 5V, and connect it to the servomotor's VCC and GND pins. For optimal performance, verify the servomotor's ideal voltage.
If your main alimentation is 24V, do not connect it directly to the Arduino. Use the step-down converter to provide the correct voltage (at least 6V) for both the Arduino and the servo.
Step 6: Testing the Correct Servo Angles
Load a control program onto the Arduino to test servomotor angles. Use the Test_angle.ino
routine from the GitHub repository. This routine allows programming the servomotor position by changing the Target_angle
variable.
First, set the servomotor to position 0 and attach its arm to the trigger shaft. Then, fix the spray head to your printer frame.
You need to determine and record three key angles:
- A_min: The angle where the airbrush needle begins to move, opening the ink path.
- A_valve: The angle where the air valve opens, initiating the spray, though the ink path might still be partially blocked.
- A_max: The angle corresponding to the end of the trigger's travel, where the ink path is fully open and spray intensity is maximum.
A fourth angle, A_spray, is used for spraying and is set between A_valve
and A_max
to control spray intensity.
Step 7: Connecting the Arduino to the Motherboard
Connect the Arduino to the printer's motherboard to automatically detect and convert the cooling fan control signal for servomotor control. The implemented method uses Arduino's digitalRead()
to detect the HIGH/LOW state of the cooling fan pin and sends a target angle to the servomotor.
Printer mainboard signals are typically 0/12V or 0/24V, exceeding the Arduino UNO's 5V input limit. The Arduino interprets inputs between 0-1.5V as LOW and 3-5V as HIGH. Therefore, a signal voltage transformation is necessary.
A voltage divider bridge, composed of resistors R1 and R2, lowers the signal voltage. The equation V10 = R1/(R1+R2) x Vmb
relates the voltage at Arduino pin 10 (V10
) to the mainboard voltage (Vmb
). For a 12V control signal, R1=47kΩ and R2=100kΩ yield approximately 3.8V, compatible with the Arduino.
Step 8: Loading the Control Program and Test
After connecting the mainboard control pin and determining the correct servo angles, download the Control_spray_head.ino
routine. Adjust the angle variables to your preferences and load the program onto the Arduino.
Connect your computer to the printer's mainboard and send the command M106 S255
to activate the cooling fan. The spray head should move to the A_spray
position. If it doesn't, troubleshoot by reviewing the previous steps.
Step 9: Generating a Control File
Once the system is connected and responds correctly, you can generate control files. For drawing applications, consider using laser cutter G-code generation software and adjusting the distance between the spray head and the surface to control line thickness.
The author developed a Python routine to generate G-codes for uniform coatings. This routine and its associated wiki are available at: Gcode generation routine wiki.
To use this code, you need to measure:
- Spray head offset: Manually move the printer head to the origin point. The printer's coordinates are the opposite of the tool offset.
- Spray diameter: Place paper on the printer bed, fill the pen with ink or water, and spray at various positions (e.g., 10-80mm steps). Use commands like:
M106 S255
(Turn on spray)G4 P500
(Pause for 500ms)M106 S0
(Turn off spray)
Record the sprayed area diameter. Ink type, nozzle/needle diameter, and air pressure influence this value.
Step 10: Spray and Enjoy
With the spray coater built and functional, you can now use it. Enjoy your creation!
Step 11: Optional: Extend the Ink Tank
Airbrush ink tanks can be small, especially for diluted inks. To extend the capacity, use a 10ml syringe body attached to the tank opening. A 3D printed part is available to hold the syringe securely, printable in TPU or PLA (using a glove finger for water-tightness).
3D model: Thingiverse - Extension Part
Step 12: Optional: Add a Stirring System
For inks containing particles that can aggregate and clog the nozzle, a stirring system is beneficial. The author designed a system using a syringe linked to a tube and nozzle placed inside the reservoir. The syringe is driven by a stepper motor controlled by an Arduino and a Pololu stepper driver. This system is for niche applications, but CAD files and the Arduino control routine (Control_Strirrer_Stepper.ino
) are available.