It isn't a new idea. Many people done something like this on the internet. It isn't unique. It is just my journey of designing, building something useful moving thing, what I can use to support my other creations. Anyhow, designing, building is fun.
Tried to use a few gcode sender, but finally kept using the Rasberry PI/Ubuntu/Octoprint set. As I'm quite familiar with it from my 3D Printing past.
The toolhain above has some drawbacks:
I wasn't able to produce correct scaling. I don't know it is just my inability or problem of the software used.
The DXF2GCODE is more likely a basic CAM software and not just a plug and play conversion solution. The plotter needs much simpler gcode than a CNC Router, and the functionality of working with tools, pockets unnecessary at this point.
There is a drawn line between the home point and the start of the spiral what isn't in the original drawing. It is not caused by the toolchain. I'll will come back to this issue later
At this point I was thinking a bit differently. The DXF is a mechanical CAD format, so not really designed for pen plotters, but the HPGL definitely the language of the HP pen plotters.
I searched for a program what is able to convert HPGL to G code. I found a few converters. None of them was fit into my needs. Most of them was not able to convert the HPGL AA arcs to G2, G3 gcodes. This conversion needs some trigonometrical knowledge so it looked hard to achieve for some programmers. After a few trials I gave up to use something I found on the net.
So I wrote one. It is in the github repository of the plotter:
It still has some problems like incomplete error handling and lack of path optimization, but does it's job.
Now let see, how the toolchain works
Here is the original drawing:
First all of the object in the drawing must be converted to path, otherwise it will not represented in the HPGL output:
When it's done, you can save it as HPGL:
Now the bit tricky part coming:
The InkScape HPGL save dialog default parameters are mainly setup for cutting and not drawing plotters. Therefore most of them need to be changed according to the following:
Now you have to convert it to G code.
I used two different settings. The reason is the G code of my plotter use M280 P0 S50 command to lift the pen and M280 P0 S0 to put it down.
The usual CNC routers use G1 command to move the Z axis. The widely used G code simulator CAMotics Doesn't understand my pen up and down commands, so for the simulation I changed them to G1 Z5 F50 and G1 Z-2 F50 respectively:
And here is the result in the simulator:
As it looked good, I made the conversion for the plotter:
As you can see, the PenUp and PenDown parameters are missing here. The reason of this that it was setup in the application config file.
After this uploaded it to the Octoprint and sent out to the plotter. The result is disaster. It drawn a 2cm dashed line from the home point towards the starting point of the drawing, then drawn the whole drawing in the air (pen lifted).
I known what is the problem, from the first moment. It is the same problem what I mentioned at the beggining of this post (line from the home point to the beggining of the spiral). The G code commands are not executed in order.
I know about the Marlin firmware that it queue the commands and some commands are executed in order and some out of order. I was reading the source code of the Marlin for a few hours to find, how to change this behaviour Unsuccessfully. I gave up at this point and asked in the Marlin forum.
The answer was much more easier than I ment. Adding an M400 command (wait for finish of the previous commands) before an out of order command solve the issue. I wasn't even need code change for this as my pen hadling commands are represented in the configuration file.
The only trick here that the handling of the multiline string in the .Net config file. So the parameters look like this now:
Built the whole thing, assembled, then redesigned most of the pen holder.
The problem was the following:
The SG90 microservo I intended to use was not strong enough
The line I wanted to use to pull up the Z carriage was a bad design decision
The arduino was not able to provide enough current to the stalled microservo, so it rebooted when the pen pulled up.
In the new design:
The SG90 replaced with a more powerful MG995
The servo moving the carriage directly
Added a 6V regulator for the servo, what gets its power from the beefy 12V PSU and not the arduino.
The electronics on the head still messy as I don't designed a proper PCB yet (but it will only happen when I finish the milling and the laser engraving head design):
And finally here is the first video of the working unit:
I've a Proxxon Micromot drill. I'm planning to attach it to the plotter as replacement to the pen, to be able to do some light cuts.
For this I don't want to use it's original power supply unit. As the speed control is located in the power supply I wanted to know it's properties:
How the motor driven? Pure PWM or filtered to DC?
What is the PWM frequency?
To measure this without disassembling, not looked like an easy task. The reason is that Proxxon uses a proprietary connector, what is not available on the market. So I measured the diameter of the pins and looks like with two 2.3mm drill bit I made it:
The measurements:
Without load:
At minimum speed:
At maximum speed:
It is a bit noisy to my taste and figured out that it runs at 100Hz and not really filtered.
Based on this I can design the new electronics into the plotter.
More than three month ago I had a conversation with my son. He told me that he want to build a "drawing machine" essentially a pen plotter together with me. I started to design one. After a few conversation he told me that he wanted to build it from Lego.
I was already too deep in the designing already, so I didn't want to stop. In addition I was planning to add exchangeable head to be able to use it as a light router and a laser cutter/engraver.
I think the design mainly finished:
I left out a few things from the design, like drag chain, screws, spacers, timing belts.
During the design process I already printed some of the parts:
As you can see, there are some assembled parts also on the picture, like the Y axis drive (round white thing in the center) and Z axis carriage (the green thing).