Draw Rangoli Using 3D Printer | 2D Plotter
by indoorgeek in Circuits > Electronics
1352 Views, 2 Favorites, 0 Comments
Draw Rangoli Using 3D Printer | 2D Plotter
Hello folks, Shubh Deepawali to you all!
Let us step into the future of festive artistry with this latest project! In this Instructables, I am turning a 3D printer into a Rangoli Plotter, as you all liked the earlier one where I had turned the same into a pen plotter. Imagine intricate rangoli designs coming to life effortlessly. It's the perfect blend of tradition and technology, creating a celebration that's both mesmerizing and modern. Let's light up this Diwali with innovation and color!
Supplies
The Plan
A few years back, I made Instructables where I showed how you can draw on paper using a 3D printer, basically converting your printer into a 2D pen plotter. You guys loved it a lot!
Now, on the occasion of Diwali, I got the idea to use a similar approach to draw Rangoli with it, not a complete one with colors filled, but just an outline would be a great start.
The plan is to replace the extruder carriage with a mechanism that can dispense rangoli powder. The problem with this, unlike pen plotter, is that it should have some way to turn ON & OFF the flow of rangoli powder. There are no spare I/Os available that I can tap into. However, since we won't be using the print cooling fan, I decided to use the commands meant for the fan to control the dispenser. This will require some modifications to the g-code which is discussed in detail in the upcoming step.
G-code
Before we go any further, let us first understand what exactly is G-code. It is a widely used programming language for any CNC machine including 3D printers. G stands for "Geometry" and G-code is basically a text file with lines of code instructing the machine or printer where & how to move. Don't be daunted by the word "programming" because it is very easy to read and understand. Each line starts with a G-code command followed by the parameters. There are two types of commands:
- G - General
- M - Miscellaneous
For example:
G0 X10 Y10
G0 is a command for linear movement and the parameters are the X & Y cartesian coordinates (10, 10). It tells the print head to move in a straight line towards point (10, 10).
Another example:
G1 X10 Y10 E1.5
G1 is for linear movement but it is used whenever we need extrusion. Again, this line tells the print head to move in a straight line towards the point (10, 10) but this time 'extrude' 1.5mm of filament while moving.
As a standard practice, most of the slicers use G0 for non-extrusion movements and G1 for moves that include extrusion. This becomes important to modify the g-code as you will see later.
Another type is Miscellaneous which does not involve motion.
M104 - sets the hot end temperature
M106 - sets fan speed
M140 - sets bed temperature
and so on...
I used Octoprint on Raspberry Pi to test out the g-code commands.
The commands that are mostly used for 3D printing are just a few from a long list of commands. Refer to this complete guide if you wish to know all the other available commands.
Modifying G-code
The commands for turning ON/OFF print cooling fan are:
- M106: Turns ON the fan. If no speed is specified, it will default to full speed. That's what we want
- M107: Turns OFF the fan.
However, for this to work, we would require the dispenser to start dispensing whenever there's a command to "extrude" filament. As stated in the previous step, the G1 command is used for moves that include extrusion. That's what we would be looking for in the code. We need to insert additional lines to the code such that the fan or the dispenser should turn ON for the G1 command and turn OFF for the G0 command. It should look like as seen below.
Before
G1 F1197 X123.871 Y131.7 E6.60572
G1 F1103.4 X123.838 Y131.832 E6.61064
G1 F2700 E1.61064
G0 F6000 X123.838 Y132.731
After
M106
G1 F1197 X123.871 Y131.7 E6.60572
M106
G1 F1103.4 X123.838 Y131.832 E6.61064
M106
G1 F2700 E1.61064
M107
G0 F6000 X123.838 Y132.731
This is how it should look, but doing this manually is practically impossible. That's why I decided to put Python to work. With very little experience in Python and very limited time, I took the help of ChatGPT which didn't disappoint with a fully working code. All I had to do was specify the g-code location and it spits out the modified g-code.
Downloads
Electronics
I got my PCBs fabricated from PCBWay. The electronics are very basic and can be built on a simple perfboard but I decided to keep things neat and designed a small PCB in EasyEDA.
The circuit contains an N-channel MOSFET to switch the electromagnet. The gate of the MOSFET is driven by the 'fan' signal from the control board of the 3D printer after passing through a voltage divider to step down the 24V to a lower voltage less than the maximum Gate-Source voltage of the MOSFET I am using.
I have added a voltage regulator to power the electromagnet. In my case, I found an electromagnet that works on 24V and so does Ender 3. I will be powering the electromagnet directly from the printer's power supply by-passing the voltage regulator.
Click here to download the Gerber files.
Downloads
Assembly
There are two main portions of the build. One is the dispenser along with the latch to control the flow of powder and the other is the mount to help attach the dispenser to the hot-end carriage. The electromagnet on the dispenser pulls the lever to dispense the powder. For the lever mechanism to work, I initially used a spring from a similar mechanism that I had lying around but it turned out to be too tight for the electromagnet. So I decided to 3D print a thing that acts in the same way. The spring helps the latch to go back to the 'closed' position when the electromagnet is de-energized. The latch, spring, and main body are held together by a pin, which in my case is just a nail.
First, remove the hot-end assembly (2 cooling fans & hot-end itself) and install the mount in its place with the help of the same screws and holes meant for the hot-end.
With all the mechanical stuff out of the way, let's now move on to the electronics. Remove the lid of the control box to access the controller.
- Tap into the 24VDC to power our PCB.
- There should be a fan connector plugged into the controller. Remove the fan connector and add jumper wires back to our PCB.
- Connect the electromagnet to the PCB.
Enjoy!
Finally, I made all the connections to the screw terminals on the PCB and fired it up! Well…that was easy - is what I thought! After a lot of trial and error, I finally managed to print something usable.
It was fun though! There’s definitely a lot of scope for improvement and creativity. We will continue to work on it and come up with something even more awesome till next Diwali. But that’s it, for now. Hope you all enjoyed this Instructables. Give a like if you did and subscribe for more such projects. See you in the next one.