Visualize Regular Expressions With Marbles

If you are one of those people who visualize things physically better than in the abstract, then Regex Marble Run by [bottomless] might be for you. You enter a test expression and a string, and the site generates a virtual marble machine that lets you see the regular expression pick apart the string in a physical way.

Click this link, and you’ll see the regular expression “^[hH]ack.[dD][^0-9]*$” which, if you aren’t a regular expression user, might seem a bit cryptic. However, it is fairly simple if you take it bit-by-bit.

The caret character tells it to match the start of the string. So “^dog” will match “dog” and “dog food” but won’t match “food for a dog.” The following bit “[hH]” will match either “h” or “H”. Then there is “ack” which is just what you think it is. So a string starting with “hack” or “Hack” might match (depending on the rest of the expression.

The period means match any single character. Then there’s another “[]” but this time with “dD” to match any kind of D. The next “[]” character class is a range from 0-9, but since there is a caret, the match is negated. So “[^0-9]” means match anything except a digit from 0 to 9. The “*” means we can have zero or more of these. So “HackxD” matches, but so does “HackxDXYZabc” for now. Trick question: Does “HackxDXYZabc123” match? So far, yes, but it only matches to the lowercase “c” character.

The final character, “$” means end of string. So now “HackxDXYZabc123” does not match because we are still in the middle of the string. However, “HackxDXYZabc” will match since the previous “*” “ate” the rest of the string.

Head spinning? The site will let you see each letter of a test string as a marble that falls through the different parts of the regular expression. Balls that pass wind up in the left-hand box, while failures are in the right-hand box. Will it help you? We don’t know, but it is fun to watch.

Want a refresher on regular expressions? Or perhaps you want some practice?

Taking Cues From A Gramophone To Make A Better Marble Music Machine

[Martin] of [Wintergatan] is on a quest to create the ultimate human-powered, modern marble music machine. His fearless mechanical exploration and engineering work, combined with considerable musical talent, has been an ongoing delight as he continually refines his designs. We’d like to highlight this older video in which he demonstrates how to dynamically regulate the speed of a human-cranked music machine by taking inspiration from gramophones: he uses a flyball governor (or centrifugal governor).

The faster the shaft turns, the harder the disk brake is applied.

These devices are a type of mechanical feedback system that was invented back in the 17th century but really took off once applied to steam engines. Here’s how they work: weights are connected to a shaft with a hinged assembly. The faster the shaft spins, the more the weights move outward due to centrifugal force. This movement is used to trigger some regulatory action, creating a feedback loop. In a steam engine, the regulator adjusts a valve which keeps the engine within a certain speed range. In a gramophone it works a wee bit differently, and this is the system [Wintergatan] uses.

To help keep the speed of his music machine within a certain narrow range, instead of turning a valve the flyball governor moves a large disk brake. The faster the shaft spins, the harder the brake is applied. Watch it in action in the video (embedded below) which shows [Wintergatan]’s prototype, demonstrating how effective it is.

[Wintergatan]’s marble machine started out great and has only gotten better over the years, with [Martin] tirelessly documenting his improvements on everything. After all, when every note is the product of multiple physical processes that must synchronize flawlessly, it makes sense to spend time doing things like designing the best method of dropping balls.

One final note: if you are the type of person to find yourself interested and engaged by these sorts of systems and their relation to obtaining better results and tighter tolerances, we have a great book recommendation for you.

Continue reading “Taking Cues From A Gramophone To Make A Better Marble Music Machine” →

You’ve Got All Year To Print This Marble Machine Ornament For Your Christmas Tree

Most Christmas ornaments just hang there and look pretty. [Sean Hodgins] decided to whip up something altogether fancier and more mechanical. It’s a real working marble machine that hangs from the tree!

The build is simple enough, beginning with a translucent Christmas ornament shell readily available from most craft stores. Inside, a small motor spins a pinion, which turns a larger gear inside the body. As the larger gear spins, magnets embedded inside pick up steel balls from the base of the ornament and lift them up to the top. As they reach their zenith, they’re plucked off by a scoop, and then they roll down a spiral inside. As for power, [Sean] simply handled that with a couple of wires feeding the motor from a USB power bank. Just about any small battery pack would do fine.

The build is beautiful to watch and to listen to, with a gentle clacking as the balls circulate around. Files are on MakerWorld for the curious. We’ve featured some great Christmas decorations before, too. Video after the break.

Automated Pixel Art With Marbles

Marble machines are a fun and challenging reason to do engineering for the sake of engineering. [Engineezy] adds some color to the theme, building a machine to create 16×16 marble images automatically. (Video embedded below.)

The core problem was devising ways to sort, lift, place, and dump marbles in their correct positions without losing their marbles—figuratively and literally. Starting with color detection, [Engineezy] used an RGB color sensor and Euclidian math to determine each marble’s color. After trying several different mechanical sorting mechanisms, he settled on a solenoid and servo-actuated dump tube to drop the marble into the appropriate hopper.

After sorting, he faced challenges with designing a mechanism to transport marbles from the bottom hoppers to the top of the machine. While paddle wheels seemed promising at first, they tended to jam—a problem solved by innovating with Archimedes screws that move marbles up smoothly without clogs. The marbles are pushed into clear tubes on either side of the machine, providing a clear view of their parade to the top.

Perhaps most ingenious is his use of constant-force springs as a flexible funnel to guide the marbles to a moving slider that drops them into the correct column of the display. When a picture is complete, sliding doors open on the bottom of the columns, dumping the marbles into a chain lift which feeds them into the sorting section. Each of the mechanisms has a mirrored version of the other side, so the left and right halves of the display operate independently.

The final product is slow, satisfying and noisy kinetic testament to [Engineezy]’s perseverance through countless iterations and hiccups.

Marble machines can range from minimalist to ultra-complex musical monstrosities, but never fail to tickle our engineering minds. Continue reading “Automated Pixel Art With Marbles” →

Randomly Move Marionette With Steel Balls And Geneva Drives

The ball driven Geneva drives that move the marrionette. (Credit: Karakuri channel, YouTube)
The ball driven Geneva drives that move the marrionette. (Credit: Karakuri channel, YouTube)

Over the years we have seen many marble machines, but this one on the [Karakuri channel] (hit CC for subtitles) on YouTube is somewhat special, as it uses Geneva drives to turn the motion of the steel balls going around the circuit into random movement of a marionette. The Geneva drive type of gear mechanism normally converts a constant rotary motion into intermittent rotary motion by having a singular pin on the first wheel drive the second wheel. In the demonstrated mechanism, however, the pin is replaced by the steel balls, which are only intermittently and randomly present because of how each steel ball picks one of four paths, one towards each Geneva drive.

As a result of this, the motion of the marionette’s appendages – attached to the red wheel – is random. The only powered element of the (mostly 3D printed) system is the drive mechanism that carries the steel balls up again and keeps the primary wheels on the Geneva drives rotating. We have to give the creator pops for what is both an interesting art piece and a demonstration of how to creatively use this somewhat unusual gear mechanism to introduce randomness without a lot of complexity.

Thanks to [MrTrick] for the tip.

Continue reading “Randomly Move Marionette With Steel Balls And Geneva Drives” →

Dropping Marbles With Millisecond Accuracy

All eight version of the drop mechanism
The road to the perfect marble dropper

[Martin] of the band [Wintergatan] is on his third quest to build the ultimate musical marble machine, and that means dropping marbles with maximum reliability and precision timing. Working through several iterations, and returning to first principles, he engineered a marble gate that can drop marbles with a timing standard deviation of 0 ms.

[Wintergatan]’s first two machines, Marble Machine and Marble Machine X gained significant attention, but their complexity was their undoing. As it turns out, a Rube Goldberg machine that makes music has a lot of potential failure points, and both machines proved too temperamental for the live stage. The third version, Marble Machine XT (T for “touring”) needed to be re-engineered for simplicity and reliability to be practical on the road.

[Martin] broke the marble machine concept down to its key components, of which the marble drop gate is the most obvious. Using a pair of contact microphones to record the moment of release and impact, he can measure the timing with precision. The first design had a standard deviation of 3.91 ms, which is not nearly enough for us to detect by ear, but is not up to [Martin]’s standard for “tight music”. It used a clock-type escapement mechanism, where the wheel is the release gate. After reviewing his measurement software and compensating for drift between the software components of his setup, the measured standard deviation was reduced by 1 ms. Another breakthrough was to remove any guiding surfaces below the gate and let gravity do all the work. The 8th iteration proved to be the winner and used the escapement arm as the drop gate and wheel to hold back the queue of marbles.

Coming from an arts background, [Martin] had to learn a lot of engineering lessons the hard way. Looking at the videos on his YouTube channel, it seems like he is taking the lessons to heart, and we look forward to seeing the Marble Machine XT come to life.

Continue reading “Dropping Marbles With Millisecond Accuracy” →

3D Printed Marble Music Machine Looking Good Already

Inspired by the enormous marble music machines from the staggeringly talented [Wintergatan] and the marble run builds by [Daniel de Bruin], [Ivan Miranda] has been busy again building a largely 3D printed contraption to test his ideas around building his own marble music machine from scratch. (Video, embedded below.)

Leveraging his recent experiences with resin printing and his own giant 3D printer, he had no difficulty in producing everything he needed from his workshop, even if the design work apparently took ages.

The build shows how early in development this project is, as there are clearly quite a few issues to be dealt with, but progress looks encouraging so far. To be clear, plans are to ‘go big’ and this little eight-channel testbed is just to explore this issues around ball guiding, transport and ball release onto the first audio test device, a Korg Nano Pad 2.

Some significant teething problems were identified, such as when [Ivan] designed the ball lifter, he intended the balls to load from the rear, but then needed to switch it to load from the front. No big deal, simply reverse the motor direction to load balls on the opposite side of the mechanism. Sadly, that also meant the directly coupled note drum was now also rotating the wrong way to release the balls. Oops. A quick hack later and [Ivan] was back in business. Various parts needed shimming up with plates, but with 3D printers on the bench, knocking those out took little time or effort. This just shows how darn useful 3D printers can be, allowing you to iterate in a short time and feed your hacks back into the final version.

[Ivan] is clearly going to have a lot of ‘fun’ with this one, as [Wintergatan] will surely testify, these big musical marble machine builds are quite some undertaking. We shall definitely be tuning in later on to see where this one goes!

While we’re on the subject of the [Wintergatan] marble machines, here’s a mini homage to the latest Marble Machine X, and if you’re in the need for a 3D printed marble clock, then try this one for starters.

Continue reading “3D Printed Marble Music Machine Looking Good Already” →