Speak To The Machine

If you own a 3D printer, CNC router, or basically anything else that makes coordinated movements with a bunch of stepper motors, chances are good that it speaks G-code. Do you?

If you were a CNC machinist back in the 1980’s, chances are very good that you’d be fluent in the language, and maybe even a couple different machines’ specialized dialects. But higher level abstractions pretty quickly took over the CAM landscape, and knowing how to navigate GUIs and do CAD became more relevant than knowing how to move the machine around by typing.

a Reprap Darwin
Reprap Darwin: it was horrible, but it was awesome.

Strangely enough, I learned G-code in 2010, as the RepRap Darwin that my hackerspace needed some human wranglers. If you want to print out a 3D design today, you have a wealth of convenient slicers that’ll turn abstract geometry into G-code, but back in the day, all we had was a mess of Python scripts. Given the state of things, it was worth learning a little G-code, because even if you just wanted to print something out, it was far from plug-and-play.

For instance, it was far easier to just edit the M104 value than to change the temperature and re-slice the whole thing, which could take an appreciable amount of time back then. Honestly, we were all working on the printers as much as we were printing. Knowing how to whip up some quick bed-levelling test scripts and/or demo objects in G-code was just plain handy. And of course the people writing or tweaking the slicers had to know how to talk directly to the machine.

Even today, I think it’s useful to be able to speak to the machine in its native language. Case in point: the el-quicko pen-plotter I whipped together two weekends ago was actually to play around with Logo, the turtle language, with my son. It didn’t take me more than an hour or so to whip up a trivial Logo-alike (in Python) for the CNC: pen-up, pen-down, forward, turn, repeat, and subroutine definitions. Translating this all to machine moves was actually super simple, and we had a great time live-drawing with the machine.

So if you want to code for your machine, you’ll need to speak its language. A slicer is great for the one thing it does – turning an STL into G-code, but if you want to do anything a little more bespoke, you should learn G-code. And if you’ve got a 3D printer kicking around, certainly if it runs Marlin or similar firmware, you’ve got the ideal platform for exploration.

Does anyone else still play with G-code?

Motorized Camera Mount Was Once A 3D Printer

If you plan on building your own motorized camera mount, a 3D printer can definitely be of help. But in this case, [dslrdiy] didn’t use it for printing out parts — finding himself with little use for an old printer built from scrap back in the day, he decided to repurpose it and turn it into a remote controlled DSLR camera mount that’s capable of panning, tilting, and sliding.

The main goal was to not only salvage the stepper motors and controller board, in this case an Arduino Mega 2560 with RAMPS board, but also to keep the original firmware itself in use. For this to work, [dslrdiy] redesigned the mechanical parts that would allow him to perform the different camera movements using regular G-Code instructions operating the X, Y, and Z axes to pan, tilt, and slide respectively.

The G-Code instructions themselves are sent via UART by an accompanying control box housing an ESP32. This allows the camera mount to operated by either via joystick and buttons, or via serial Bluetooth connection, for example from a phone. The ESP32 system also allows to set predefined positions to move to, along with speed and other motor tweaks. You can see it all demonstrated in the video after the break.

While there’s simpler solutions for camera mounts out there, this is certainly an interesting approach. It also shows just how far desktop 3D printers have come if we already find the older generations repurposed like this. For more of [dslrdiy]’s work with 3D printers and cameras, check out his customizable lens caps.

Continue reading “Motorized Camera Mount Was Once A 3D Printer”

Collaborative Effort Gets Laser Galvos Talking G-Code

Everyone should know by now that we love to follow up on projects when they make progress. It’s great to be able to celebrate accomplishments and see how a project has changed over time. But it’s especially great to highlight a project that not only progresses, but also gives back a little to the community.

That’s what we’re seeing with [Les Wright]’s continuing work with a second-hand laser engraver. It was only a few weeks ago that we featured his initial experiments with the eBay find, a powerful CO2 laser originally used for industrial marking applications. It originally looked like [Les] was going to have to settle for a nice teardown and harvesting a few parts, but the eleven-year-old tube and the marking head’s galvanometers actually turned out to be working just fine.

The current work, which is also featured in the video below, mainly concerns those galvos, specifically getting them working with G-code to turn the unit into a bit of an ad hoc laser engraver. Luckily, he stumbled upon the OPAL Open Galvo project on GitHub, which can turn G-code into the XY2-100 protocol used by his laser. While [Les] has nothing but praise for the software side of OPAL, he saw a hardware hole he could fill, and contributed his design for a PCB that hosts the Teensy the code runs on as well as the buffer and line driver needed to run the galvos and laser. The video shows the whole thing in use with simple designs on wood and acrylic, as well as interesting results on glass.

Of course, these were only tests — we’re sure [Les] would address the obvious safety concerns in a more complete engraver. But for now, we’ll just applaud the collaboration shown here and wait for more updates.

Continue reading “Collaborative Effort Gets Laser Galvos Talking G-Code”

Wooden You Like To Hear A CNC-Cut Phonograph Record?

Say what you will about [Thomas Edison], but it’s hard to deny the genius of his self-proclaimed personal favorite invention: the phonograph. Capturing sound as physical patterns on a malleable medium was truly revolutionary, and the basic technology that served as the primary medium of recorded sound for more than a century and built several major industries is still alive and kicking today.

With so much technological history behind it, what’s the aspiring inventor to do when the urge to spin your own phonograph records strikes? Easy — cut them from wood with a CNC router. At least that’s how [alnwlsn] rolled after the “one-percent inspiration” hit him while cutting a PCB with his router. Reasoning that the tracks on the copper were probably about as fine as the groove on a record, he came up with some math to describe a fine-pitch spiral groove and overlay data from a sound file, and turn the whole thing into G-code.

For a suitable medium, he turned to the MDF spoil board used to ship PCB stencils, which after about three hours of milling resulted in a rather hairy-looking 78-RPM record. Surprisingly, the record worked fairly well on a wind-up Victrola. The spring-powered motor was a little weak for the heavy wooden record and needed a manual assist, but you can more or less clearly hear the 40-second recording. Even more surprising was how much better the recording sounded when the steel needle was replaced with a chunk of toothpick. You can check out the whole thing in the video below, and you’ll find the G-code generation scripts over on GitHub.

Is all this talk about reproducing music using wiggly lines confusing you? Woah, there, whippersnapper — check out [Jenny]’s primer for the MP3 generation for the background you need.

Continue reading “Wooden You Like To Hear A CNC-Cut Phonograph Record?”

Resuming a print

Multiple Ways Of Recovering A Failed Print

It’s a special gut-dropping, grumbly moment that most who use 3d printers know all too well. When you check on your 13-hour print, only to see that it failed printing several hundred layers ago. [Stephan] from [CNC Kitchen] has a few clever tricks to resume failed prints.

It starts when you discover your print has failed and whether the part is still attached to the bed. If it has detached, the best you can do is whip out your calipers to get a reasonably accurate measurement of how much has been printed. Then slice off the already printed section, print the remainder, and glue the two parts together. If your part is attached to your print bed and you haven’t shifted the plate (if it is removable), start by removing any blemishes on the top layer. That will make it smooth and predictable as it’s starting a new print, just on top of an existing one. Measuring the height that has been printed is tricky since you cannot remove it. Calipers of sufficient length can use their depth function, but you might also be able to do a visual inspection if the geometry is unique enough. After you load up your model in a G-Code viewer, go through it layer by layer until you find what matches what has already been printed.

The last (and perhaps most clever) is to use the printer as a makeshift CMM (coordinate measuring machine). You manually step the printer until it touches the top of the part, then read the z-axis height via a screen or M114 command. A quick edit to the raw G-Code gives you a new file that will resume precisely what it was doing before. If you can’t rehome because the head can’t clear the part, [Stephan] walks you through setting the home on your printer manually.

If all the doesn’t work, and the print is still unrecoverable, perhaps you can look into recycling the plastic into new filament.

Wire ECM built from an Ender 3

Simple Mods Turn 3D Printer Into Electrochemical Metal Cutter

We’re not aware of any authoritative metrics on such things, but it’s safe to say that the Ender 3 is among the most hackable commercial 3D printers. There’s just something about the machine that lends itself to hacks, most of which are obviously aimed at making it better at 3D printing. Some, though, are aimed in a totally different direction.

As proof of that, check out this Ender 3 modified for electrochemical machining. ECM is a machining process that uses electrolysis to remove metal from a workpiece. It’s somewhat related to electric discharge machining, but isn’t anywhere near as energetic. [Cooper Zurad] has been exploring ECM with his Ender, which he lightly modified by replacing the extruder with a hypodermic needle electrode. The electrode is connected to a small pump that circulates electrolyte from a bath on the build platform, while a power supply connects to the needle and the workpiece. As the tool traces over the workpiece, material is electrolytically removed.

The video below is a refinement of the basic ECM process, which [Cooper] dubs “wire ECM.” The tool is modified so that electrolyte flows down the outside of the needle, which allows it to enter the workpiece from the edge. Initial results are encouraging; the machine was able to cut through 6 mm thick stainless steel neatly and quickly. There does appear to be a bit of “flare” to the cut near the bottom of thicker stock, which we’d imagine might be mitigated with a faster electrolyte flow rate.

If you want to build your own Ender ECM, [Cooper] has graciously made the plans available for download, which is great since we’d love to see wire ECM take off. We’ve covered ECM before, but more for simpler etching jobs. Being able to silently and cleanly cut steel on the desktop would be a game-changer.

Continue reading “Simple Mods Turn 3D Printer Into Electrochemical Metal Cutter”

Automatic Coil Winder Gets It Done With Simple Hardware And Software

We’ve grown to expect seeing mechatronics project incorporate a standard complement of components, things like stepper motors, Arduinos, lead screws, timing belts and pulleys, and aluminum extrusions. So when a project comes along that breaks that mold, even just a little, we sit up and take notice.

Departing somewhat from this hardware hacking lingua franca is [tuenhidiy]’s automatic coil winder, which instead of aluminum extrusions and 3D-printed connectors uses simple PVC pipe and fittings as a frame. Cheap, readily available, and easily worked, the PVC does a fine job here, and likely would on any project where forces are low and precision isn’t critical. The PVC frame holds two drive motors, one to wind the wire onto a form and one to drive a lead screw that moves the form back and forth. An Arduino with a CNC shield takes care of driving the motors, and the G-code needed to do so is generated by a simple spreadsheet that takes into account the number turns desired, the number of layers, the dimensions of the spool, and the diameters of the wire. The video below shows the machine going through its paces, with pretty neat and tidy results.

Being such a tedious task, this is far from the first coil winder we’ve seen. Some adhere to the standard design language, some take off in another direction entirely, but they’re all instructive and fun to watch in action.

Continue reading “Automatic Coil Winder Gets It Done With Simple Hardware And Software”