You Draw It, CNC Cuts It

[Jamie] aka [vector76] hit us with a line-tracing plugin for OctoPrint that cuts out whatever 2D shape you draw on a piece of wood. The plugin lets you skip the modeling step entirely, going straight from a CNC-mounted webcam that reads your scribbles and gives you a Gcode toolpath in return. The code is on GitHub and there’s a demo video embedded below.

Under the hood, OpenCV is doing a lot of the image processing, including line detection, and the iterative “find the line” and “move the toolhead” steps really show off what computer vision can do. It starts off with a fiducial arrow for scale and orientation, then it mores the webcam around the scene. The user can enter the usual milling parameters: speeds, feeds, depth of cut, tool offset, milling direction, etc. And then it gets to work.

Right now, it’s limited to paths with non-crossing lines, and probably with good contrast and a nice dark line — all the usual CV restrictions. But mounting a webcam to a CNC toolhead and using it for various pathing problems really opens up tons of possibilities: visual homing, workpiece edge finding, copying parts, custom fitting odd shapes, and more. This project is clearly an invitation to keep on hacking, an appetizer. Once you see the girl pirate robot that [Jamie]’s daughter made, you’ll get the idea.

We’ve seen a similar OpenCV approach used for center-finding bore holes, but while we’ve seen a few webcams used with laser cutters, the CNC mill applications seem largely untapped. Let us know in the comments if you’ve got some other good examples.

Continue reading “You Draw It, CNC Cuts It”

Old School Mechanical Pong Still Amazes

[Tom], of the YouTube channel ThingsTomLike, found a very sweet little mechanical Pong clone at a thrift store. It came in broken, but in only fifteen minutes of your time, [Tom] manages a complete teardown and repair. (Video, embedded below.)

The game works by balancing a lightbulb on the end of a pivot arm that projects a “ball” onto a screen, while players move their paddles up and down to hit the spring that surrounds the light assembly. The ball arm gets periodically kicked by a DC motor and cam assembly, which makes it careen wildly back and forth across the screen.

It’s a marvel of simple, no-IC engineering. Ironically, it might have been cheaper than making it out of silicon at the time, but viewed from today’s economy, just the human labor in adjusting that counterweight so that the “ball” floats would blow the budget.

Why a screen and lightbulb? Because it’s emulating Pong, a video game, the new kid on the block. But even 45 years later, we think it has got a charm all of its own that the cold digital logic of Pong lacks, even if the gameplay suffers.

Continue reading “Old School Mechanical Pong Still Amazes”

Tune Your Dish Antenna Like A Pro

It’s a problem we all have at one time or another: your five-meter radio astronomy dish gets out of calibration and you don’t have a ridiculously expensive microwave holography rig on hand to diagnose it. OK, maybe this isn’t your problem, but when [Joe Martin]’s parabolic antenna got out of whack, he set out to diagnose and repair it, and then wrote up how he did it. You can download the PDF from his radio astronomy articles collection.

At the heart of the measurement rig is a laser rangefinder connected to a Porcupine Labs interface that passes the data on to a Pi 4. This is placed on the end of a two-degree-of-freedom servo gimbal that scans over the surface of the dish, measuring its shape. After measuring and math, [Joe] found out that it’s a little bit long here and short there, he attached two cables with turnbuckles to the front of the dish and pulled it back into shape — the sort of thing that you should probably only do if you’ve got a measurement rig already set up.

The Fluke rangefinder and Porcupine labs interface combo is pretty sweet, but it comes with a fairly hefty price tag. (Nothing compared to a professional dish measurement rig, we presume.) We’ve seen a few attempt at hacking into el-cheapo laser rangefinders, but other than [iliasam]’s heroic effort where he ended up writing his own firmware, it doesn’t seem like there are any successes. A shame, because applications like [Joe]’s prove that there’s a need for one. Let us know if there’s anything we missed?

Thanks [Ethan] for the tip!

Impedance Mismatch

There are a few classic physics problems that it can really help to have a mental map of. One is, of course, wave propagation. From big-wave surfing, through loudspeaker positioning, to quantum mechanics, having an intuition for the basic dynamics of constructive and destructive interference is key. Total energy of a system, and how it splits and trades between kinetic and potential, is another.

We were talking about using a bike generator to recharge batteries on the Podcast last night, and we stumbled on a classic impedance mismatch situation. A pedaling person can put out 100 W, and a cell phone battery wants around 5 W to charge. You could pedal extremely lightly for nearly three hours, but I’d bet you’d rather hammer the bike for 10 minutes and get on with your life. The phone wants to be charged lightly — it’s high impedance — and you want to put out all your power at once — you’re a low impedance source.

The same phenomenon explains why you have to downshift your internal combustion automobile as you slow down. In high gear, it presents too high an impedance, and the motor can only turn so slowly before stalling. This is also why all vibrating string acoustic instruments have bridges that press down on big flat flexible surfaces, and why horns are horn shaped. Air is easy to vibrate, but to be audible you want to move a lot of it, so you spread out the power. Lifting a heavy rock with human muscle power is another classic impedance mismatch.

If these are fundamentally all the same problem, then they should all have similar solutions. The gear on the bike or the car, the bridge on a cello, the flared horn on the trumpet, and the lever under the boulder all serve to convert a large force over a short distance or time or area into a lower force over more distance, time, or area.

Pop quiz! What are the common impedance converters in the world of volts and amps? The two that come to my mind are the genafsbezre and the obbfg/ohpx pbairegre (rot13!). What am I missing?

Our Favorite Things: Binary Search

You might not think that it would be possible to have a favorite optimization algorithm, but I do. And if you’re well-versed in the mathematical art of hill climbing, you might be surprised that my choice doesn’t even involve taking any derivatives. That’s not to say that I don’t love Newton’s method, because I do, but it’s just not as widely applicable as the good old binary search. And this is definitely a tool you should have in your toolbox, too.

Those of you out there who slept through calculus class probably already have drooping eyelids, so I’ll give you a real-world binary search example. Suppose you’re cropping an image for publication on Hackaday. To find the best width for the particular image, you start off with a crop that’s too thin and one that’s too wide. Start with an initial guess that’s halfway between the edges. If this first guess is too wide, you split the difference again between the current guess and the thinnest width. Updated to this new guess, you split the differences again.

But let’s make this even more concrete: an image that’s 1200 pixels wide. It can’t get wider than 1200 or thinner than 0. So our first guess is 600. That’s too thin, so we guess 900 — halfway between 600 and the upper limit of 1200. That ends up too wide, so we next guess 750, halfway between 600 and 900. A couple more iterations get us to 675, then 638, and then finally 619. In this case, we got down to the pixel level pretty darn fast, and we’re done. In general, you can stop when you’re happy, or have reached any precision goal.

[Ed note: I messed up the math when writing this, which is silly. But also brought out the point that I usually round the 50% mark when doing the math in my head, and as long as you’re close, it’s good enough.]

What’s fantastic about binary search is how little it demands of you. Unlike fancier optimization methods, you don’t need any derivatives. Heck, you don’t even really need to evaluate the function any more precisely than “too little, too much”, and that’s really helpful for the kind of Goldilocks-y photograph cropping example above, but it’s also extremely useful in the digital world as well. Comparators make exactly these kinds of decisions in the analog voltage world, and you’ve probably noticed the word “binary” in binary search. But binary search isn’t just useful inside silicon. Continue reading “Our Favorite Things: Binary Search”

Make It Compatible

I’m probably as guilty as anyone of reinventing the wheel for a subpart of a project. Heck, sometimes I just feel like working on a wheel design. But if that’s the path you choose, you have to think about whether or not it’s important that others can replicate your project. The nice thing about a bog-standard wheel is that everyone has got one.

The case study I have in mind is a wall-plotter project that appeared on Hackaday this week. It’s a really sweet design, and in many ways would be an ideal starter project. I actually need a wall plotter (for reasons) and like a number of the choices made. For instance, having nearly everything, including the lightweight geared steppers on the gondola makes it easy to install and uninstall — you just pin up the timing belt from which it hangs and you’re done. Extra weight on the gondola helps with stability anyway. It’s open source and based on the Arduino libraries, so it should be easy enough to port to whatever microcontroller I have on hand.

But the image-generation toolchain is awkward, involving cutting and pasting into a spreadsheet, which generates a text file in a custom plotting micro-language. Presumably the designer doesn’t know about Gcode, which is essentially the lingua franca of moving machines, or just didn’t feel like implementing it. Where in Gcode, movement commands are like “G1 X100 Y50”, this device expects “draw_line(0,0,100,50)”. They’re essentially equivalent, but incompatible.

I totally understand that the author must have had a good time thinking up the movement commands and writing the spreadsheet that translates SVG files into them. I’ve been there and done that! But if the wall plotter spoke Gcode instead of its own dialect, it would slot instantly into any number of graphics processing workflows, which would make me, the potential user, happier.

When you are looking at reinventing the wheel, think about your audience. If you’re the only person likely to see the project, go ahead and scratch whatever itch you’ve got. You’ll learn more that way. But if you want to share the project with as many people as possible, adhering to the most widely used standards is a good choice for your users, even if it is less fun than dreaming up your own movement language.

Announcing: The 2022 Hackaday.io Sci-Fi Contest

Ladies and Gentlemen, Sentient robots, Travellers from the distant future, or Aliens from the outer rim, it’s time to enter the 2022 Hackaday.io Sci-Fi Contest!

We last ran the Sci-Fi contest in the far, far past — before the Voigt-Kampff machine was detecting replicants on the gritty streets of 2019’s LA. Back then, we had some out-of-this-world entries. It’s time for the sequel.

Thanks to Digi-Key, the contest’s sponsor, your best blaster, your coolest costume, or your most righteous robot could win you one of three $150 shopping sprees in their parts warehouse. Create a Hackaday.io project, enter it in the contest, and you’re set. You might as well do that right now, but the contest closes on April 25th.

Sci-Fi is all about the looks, so if it’s purely decorative, be sure to blind us with science (fiction). If your project actually functions, so much the better! Of course we’d like to know how it works and how you made it, so documentation of the project is the other big scoring category. Whatever it is, it’s got to be sci-fi, and it’s got to have some electronics in it.

If you’re looking for inspiration, you could do a lot worse than to check out [Jerome Kelty]’s Animatronic Stargate Helmet, that not coincidentally took the grand prize last time around. It’s an artistic and engineering masterpiece all rolled into one, and the description of how it’s made is just as extensive. [Jochen Alt]’s “Paul” robot isn’t out of any particular sci-fi franchise that we know, but of rolling on one ball and reciting robot poetry, it absolutely should be.

Honorable Mentions

In addition to the overall prizes, we’ll be recognizing the best projects in the following honorable mention categories:

  • Star Star: Whether you’re “beam me up” or “use the force”, fans of either of the “Star” franchises are eligible for this honorable mention.
  • ExoSuit: This category recognizes sci-fi creations that you can wear. Costumes and armor fit in here.
  • Stolen off the Set: If your blaster looks exactly like Han Solo’s, you’re a winner here.  This is the category for your best prop replica.
  • Living in the Future: If your sci-fi device was purely fantasy when imagined, but now it’s realizable, you’re living in the future. A working tricorder or a functioning robot companion would fit in fine here.
  • The Most Important Device: Has no function, but it certainly looks like it does. Just blinking lights that blink back and forth, yet the government spent millions of dollars on it.

You don’t have to tell us where your project fits in. We’ve got you covered.

Engage!

Get started now by creating a project page on Hackaday.io. In the left sidebar of your project page, use the “Submit Project To” button to enter in the 2022 Sci-Fi Contest.

You have from now until April 25, 2022 to get it finished. Of course, if your time machine actually works, you can finish it whenever. Check out the Hackaday.io contest page for all the fine print.