top | item 39336139

I designed a cube that balances itself on a corner

2460 points| dutchkiwifruit | 2 years ago |willempennings.nl | reply

377 comments

order
[+] cmehdy|2 years ago|reply
> Like any experienced controls engineer, I spent a few days flipping the signs of various signals before I got them right.

As somebody with a M.Sc. in controls & signal processing (who ended up doing way more boring things), I always figured that I was doing that because I wasn't experienced enough. Turns out I also had the sign wrong on that one all along!

[+] ryandrake|2 years ago|reply
A lot of engineering is ensuring you're making an even number of sign errors.
[+] AnarchismIsCool|2 years ago|reply
There are satellites in orbit right now that have their reaction wheels harnessed backwards and have a x *= -1.0; //DO NOT TOUCH in the codebase.

Everyone does it, though usually you do the test before you duct tape it to the top of a few thousand kg of explosives and push the red button :)

[+] xtagon|2 years ago|reply
See also the phenomenon of it always taking 3 tries to plug in USB the correct way
[+] MadnessASAP|2 years ago|reply
As somebody who has practically no post-secondary and just likes to tinker in the garage. I thought it might be nice to get an education of some sorts so I could stop wasting time doing stuff like flipping signs till it works.
[+] bchasknga|2 years ago|reply
You are not alone. I've come to terms with the reality that every controller I've designed and implemented will always need a good amount of unit test coverage to ensure proper behavior (like signs and directions)...
[+] dfee|2 years ago|reply
Is there a term for this systematic approach? I do it too, in software, and hone in on the right behavior using unit tests - especially to account for idiosyncratic off by one errors.

Basically: get the structure right and then re-align the implementation to meet the expected behavior.

[+] Matumio|2 years ago|reply
When studying electrical engineering (during all the advanced control theory math and stuff) we were told that this is the official way to do it. If your PID controller doesn't work at first, second or third attempt, you don't run for your math books, you tweak it and try again until it works.
[+] noiv|2 years ago|reply
Interesting. Whenever I meet something with a boolean behaviour I already decide upfront it will be easier and less time consuming to test accordingly instead of building a mental model. However I have no problem to model tree searching or a-star stuff. It just seems I never developed neurons with just two outcomes.
[+] pavelstoev|2 years ago|reply
This is precisely how I passed the lab portion of my Control Systems course in undergrad engineering.
[+] ilayn|2 years ago|reply
Multimeter and basic input output testing is your underappreciated friend.
[+] LorenPechtel|2 years ago|reply
I spent many days trying to troubleshoot some HP/GL2 plotter code in the distant past. I eventually concluded that the real problem was with the implementation--I was working with code that was written by others and went a little crazy with coordinate transforms. Oops--worked as expected on one non-HP plotter. Drew the image inverted on a HP plotter. The HP implementation appeared to break if you flipped the world too many times. That was a *long* time ago, my memory is fuzzy by now.

(And in later days I saw a firmware update for a laser printer cause it to spew gibberish when fed embedded HP/GL2 code. This was in the era where there were still DOS programs running under Windows and somebody didn't check that it still worked right.)

[+] corethree|2 years ago|reply
Is there a way to model this theoretically? Or is it always trial and error?

I mean I realize you have to test the thing for "bugs" just wondering if a theory to perfectly model it is even possible.

[+] crazygringo|2 years ago|reply
Wow, watching that video is wild. It's the closest I've ever found myself to thinking, well that's just magic. The way it responds to being pushed around, it's almost like experiencing magnetism for the first time, only now it's as if it's a whole new force. It almost seems like it's alive, actively maintaining its equilibrium and resisting changes from its environment. Throw a literal tomato on it and it just adapts, not unlike the way our bodies do to changing loads.

I can't wait until smaller mass-produced versions are sold on Amazon for $50, however many years from now that is! I would just love to play with something like this.

[+] fisian|2 years ago|reply
I really agree that some control engineering applications can feel like magic.

When I learned programming, I thought "Wow, I can tell a computer anything I want, as long as I take the time to program it."

I have a similar feeling about control theory, just that it feels like you're "programming" the laws of physic, modifying how reality works.

[+] dutchkiwifruit|2 years ago|reply
Your comment makes me smile. Thank you! :)
[+] ijhuygft776|2 years ago|reply
> I can't wait until smaller mass-produced versions are sold on Amazon for $50, however many years from now that is!

This is old as fuck btw..... checkout youtube for 10year+ examples...

[+] beoberha|2 years ago|reply
I very much enjoy my career as a software engineer, but man there’s a side of me that wishes I had studied something where I could even begin to build something like this. Super super cool!
[+] cuu508|2 years ago|reply
You can learn all of this on your own! Like most of us learned programming ;-)

Probably don't start with a self-balancing cube as the first project though. Get an Arduino or ESP board, make some leds blink and go from there.

[+] devsda|2 years ago|reply
As a fellow developer I feel the same but then when I realize that the cost of building something cool like this as a hobby is very high(for me at-least), I feel like we are lucky enough to have picked a field where the cost of experimenting is close to zero.

As a middle ground, I've settled on home automation & hobby electronic projects with some micro controllers like esp32, rpi pico etc. It's worth a try for anybody itching to build something tangible.

PS: the total BOM cost for this cube project was around 2500 Euros.

[+] thimp|2 years ago|reply
It was always cool. Until you find the only jobs on the market were ones that involve making machines that kill people. That’s what happened to me. YMMV.
[+] noman-land|2 years ago|reply
https://www.adafruit.com/ is an amazing resource. The tutorials are excellent and the products and video presentations of them are really great. Basically every single product has accompanying videos. It's very easy to spend some $$$ there.
[+] shellfishgene|2 years ago|reply
You totally can. This video [1] someone linked below comes with a github repo [2], it seems pretty straight forward to build this with access to a 3d printer and some basic electronics/soldering skills. Probably a <100$ for parts project? You also need a soldering iron and learn how to use it, but nothing of this is too hard for anyone technically inclined, especially if you have a hackerspace nearby where you can get a bit of help.

[1] https://www.youtube.com/watch?v=AJQZFHJzwt4 [2] https://github.com/remrc/Self-Balancing-Cube

[+] s0rce|2 years ago|reply
A big portion of this is software and the rest you could certainly learn. Although I suspect if this was you day job you might not want to come home and build the same stuff...
[+] geor9e|2 years ago|reply
There is something a lot more healthy-feeling about tinkering in the shop using your hands, versus staring down a panel of colorful monospaced ascii. But the individual contributor MechE career plateaus in pay around $170k. There's no L7 or whatever pay scale. Seeing total compensation in the $300k+ range is unheard of. In software you find them all over. I'm sure there's rare exceptions but you get the gist.
[+] lh7777|2 years ago|reply
> I plan to add mechanical brakes to the reaction wheels...This enables jump-up manoeuvers which in turn enable the cube to get to its equilibrium position on its own.

Looking forward to this -- I always thought that was the coolest part of the Cubli project. Here's a video: https://youtu.be/n_6p-1J551Y?t=92

[+] __MatrixMan__|2 years ago|reply
It makes me wonder if there's a better shape than a cube for this. You'd want to be non-circular to walk up things, but you'd want a circular edge for rolling down them. I'm imagining something like two hoops forming a sphere: rotate 90 degrees to switch between roll mode and walk mode.
[+] tgsovlerkhgsel|2 years ago|reply
Knowing and seeing how it works takes away a lot of the magic, but imagine finding a completely featureless whirring metal cube... that then jumps up onto an edge, then onto a corner, and starts spinning. And is capable of doing this on any random surface.

I bet that would puzzle even most people who consider themselves familiar with physics and when the cube suddenly jumps back from a corner onto a face, clearly showing that the jumping isn't just some hidden mechanism that extends, make some seriously consider the possibility of magic.

[+] darzu|2 years ago|reply
Amazing. Now it just needs a nice wood enclosure and matching induction charging pedestal. Kickstarter please take my money!
[+] hirako2000|2 years ago|reply
On sundays I usually get hyped reaching new heights with code. Gratified by pushing perseverance and crearivity. then I come across posts like this one and feel totally powerless, having very short patience span, and too scared to even try such things.
[+] sema4hacker|2 years ago|reply
I'm actually more enamored with the cool look of the thing rather than the fact that it can balance.
[+] __MatrixMan__|2 years ago|reply
Call me reckless, but I'd totally pay to climb a bigger one, with holds along the edges. I just wanna feel how it responds to my movements.
[+] extraduder_ire|2 years ago|reply
Any thoughts about making it lay itself back down on a qi charger (or pogo pins) when its battery is getting low, or its reaction control wheels get saturated? I assume that would wait until after it has brakes to pick itself up.
[+] pradn|2 years ago|reply
This is exactly the sort of artifact you expect a wizard to have floating above their hand on a fantasy pulp's cover, circa 1955.
[+] syntaxing|2 years ago|reply
As a former MechE, those parts look like it cost a pretty penny but damn, the results are worth it. Naively, you should be able to plug figure 21 into simulink to get the tuned constants. Though to be honest, getting the system constants will probably take just as much time and for a one off piece that’s for fun, hand tuning is more than fine.
[+] anonymouskimmer|2 years ago|reply
I pictured one of three things:

1) A "cube" that isn't really a cube in that the corners aren't points.

2) A cube designed to balance on the corner of a wall.

3) A cube with varying densities such that it will balance on a corner.

I did not picture a mechanical device.

[+] Animats|2 years ago|reply
Nice.

That stainless steel work is very nice. I didn't know PCBway did CNC machining. eMachineShop has been around for two decades, but now more companies are offering online CNC, which may bring prices down.

He wants to add brakes, so he can spin up a wheel, apply the brake hard, and get enough of a change in angular momentum to bring the thing upright. I wonder if eddy current brakes would work for that. More elegant and quieter than friction brakes. Actually, just shorting the motor might work.

[+] sixhobbits|2 years ago|reply
Would love if HN had a section like 'show hn' specifically for long-form, lone-hacker, impressive stuff like this. Not sure exactly what the metrics would be that qualify an article to belong there but every few months I see something like this that has that 'wow' factor, and wish there was an easy way to collect all of them.
[+] rq1|2 years ago|reply
Probability courses would be funny with that thing.

Roll the dice.

[+] omoikane|2 years ago|reply
My first reaction when I see one of these is "where can I buy one?" And then I realize that it's not unlike having an open-face blender with those flywheels spinning at 6000 rpm. I am not sure I would feel comfortable with something like that near my hands.
[+] tamimio|2 years ago|reply
Not to downplay software engineering, but any project that mixes hardware and software together is always better and cooler in my opinion, great work!
[+] jedilance|2 years ago|reply
I was hoping for a DIY kit available until I saw BOM costs around 2.5k
[+] moffkalast|2 years ago|reply
Well this is such an old project idea that they are already being sold on aliexpress both in complete form for $500 and $50 per torque axis if you want to make one from scratch. Just search up cubli.