I designed a cube that balances itself on a corner
willempennings.nl
willempennings.nl
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!
I highly highly recommend the book by the way, to anyone on HN. Goes all the way from mechanical components to resistors, nixie tubes, CMOS sensors, processors etc. Excellent photography that reveals the internals, along with operation explanations and history for each component.
When I'm connecting an USB cable horizontally I always think "hol up". So I always remember to plug it with the hole up.
When I'm connecting it vertically I think "hold right". So I know that if I want to hold it right, I have to put the hole right.
Has worked for me so far.
EDIT: Though "left" and "right" are more vague compared to "up" and "down", so connecting vertically assumes a specific "mental point of view". I'm just using one that's intuitive for me, but it might not work for everyone.
You also cover a wide array of topics, from hardware and how it works to a lot of systems programming (e.g: real-time operating systems, kernels, device drivers) some computer science theory (mainly automata theory and concurrency like petri nets) to signal processing which includes audio to heavy yet extremely beautiful math topics such as control theory.
Even though the purpose for taking those classes was largely personal, it’s materially contributed to my career in a lot of indirect ways (I’m an IT consultant and Linux sysadmin) by giving me a unique perspective for how things function on a much lower level than my colleagues who just have CS educations. I can troubleshoot Wi-Fi and signal transmission issues using spectrum and vector network analysis which makes everyone look at me as if I were a witch. I am comfortable disassembling and repairing equipment like scanners and commercial printers, with lots of moving parts and mains electricity that other techs won’t touch.
All that said, I highly recommend attending an EE program, and even though you’ll feel like a big, wrinkled brain smart person—you will never stop turning it off and on again, bit-bashing, or sign flipping—all quite valid techniques for when the years of diligent study and experience loses out to fat fingers and poor eyesight.
I mean I realize you have to test the thing for "bugs" just wondering if a theory to perfectly model it is even possible.
The trick is to do these tests at a sufficiently low level, because that’s usually where these issues are, in my experience.
Final try at ground level:
https://www.spacesafetymagazine.com/space-disasters/rocket-f...
1: https://twitter.com/id_aa_carmack/status/419313776463077377
(But thanks for sharing what us without a Twitter account cannot see otherwise anymore…)
(because students would often make the mistake while holding their pencil during the exam of how to calculate the curl)
In the moment I felt quite clever, but the interviewer apparently did not appreciate that technique.
(Obviously there are nuances, but there is not enough space in this comment to elaborate)
Yes, an otherwise good company might have a bad interviewer, but if they don't have some feedback loop to catch it, chances are there are other things they also don't catch.
So I flunked his “test” and then immediately contacted the recruiter and said “no thanks” before he could muahahaha
I'll come in again.
>“Nobody expects the Spanish Inquisition! Our chief weapon is surprise... surprise and fear... fear and surprise... Our two weapons are fear and surprise... and ruthless efficiency.... Our three weapons are fear, and surprise, and ruthless efficiency... and an almost fanatical devotion to the Pope... Our four... no... Amongst our weapons... Amongst our weaponry... are such elements as fear, surprise... I'll come in again.”
2. Exactly-once delivery
1. Guaranteed order of messages
2. Exactly-once deliverywe call this "ML" now, and it pays extra
Oh. This is good. I'm using this!
That's perfectly valid, when one knows a specific step or result must be positive or negative.
Not that much different from dimensional analysis, which speedruns you to get/fix to proper formula (at the cost of skimming on dimensionless constants).
Similarly, interviewer was not impressed when they cut me short and started walking me through some step and I pointed to them that their result was obviously wrong as it was dimensionally inconsistent and if they didn't cut me out the formula must have been something like baz*foo/bar^2 or something and now we just have to figure out the constants.
So, an interviewer might appreciate that balancing of signs if told that it is the fastest way make it work (and pass your demo,) only to fix it later. Once proven that the hacked code gives the right solution maybe you could have offered to send them the correct code on the next day or keep working on it if they wished so.
Not wanting to give up points on an easy test, we gauged the distance the bot had to cover in the test, and quickly uploaded some new software. At the start of the test, our bot moved forward for 4 seconds, stopped, then turned around. Full points on that one!
Some times things just need to work and we can worry about them working _correctly_ later...
In other words, you pulled a Dieselgate, in LEGO form.
Were I to judge your implementation, not only would you sacrifice those points, I'd have disqualified you from the competition on ethical grounds.
There is never an excuse for smoke and mirrors. Never.
i = i - 2 // because I'm bad at this(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.)
Basically: get the structure right and then re-align the implementation to meet the expected behavior.
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 :)
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.
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.
This is old as fuck btw..... checkout youtube for 10year+ examples...
> In my case, the BOM was close to €2500, so be prepared for that.
EDIT: someone pointed out that there are actually some designs available on AliExpress, e.g. https://a.aliexpress.com/_EzMRNIv €250 for one axis (edge) and €500 for a 3-axis (single point).
Recently there was a post here about researchers training NN to fly a chepish very small drone. No messing with PID adjustment.
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.
Find a project online that tickles your fancy, and then recreate that. If your thing doesn't work, you know it is something you did incorrectly as the project has been built successfully by others. During the course of that project, you will pick up on so many little things.
As an example, I had a project with more buttons than pins. Just something as simple as adding a few resistors to each button allows multiple buttons to be connected to the same pin. You just have test the voltage to know which button. Sounds simple, but I learned it from someone else's build.
Nobody likes walking through tutorials for tutorials sake, but it's still useful and rewarding if you can build something functional as a tutorial.
One of the things I find paralyzing about electronics is the fact energy is involved. Software just outputs garbage to the terminal if I screw it up. Circuits though? Isn't it possible for components to be literally destroyed, fires started?
What you'll find though is that, as a result of everyone before you making the same kinds of mistakes, there exists protection circuitry for almost everything you would want to do. For example, Lithium-Ion batteries are quite unsafe if you treat them without the respect they deserve, but that's what e.g. the DW01-P IC is for, and many Li-Ion charging ICs feature NTC thermistor inputs (e.g. the LTC4053) to stop charging if the cell is outside of some safe temperature range.
If you're really worried, a CO2 extinguisher and a bucket of sand go a long way.
It's to make sure that the environment is set up right. Is the device getting flashed? Does it start up at all? If you make a change (blink at a different rate), do you see your change?
https://twitter.com/thepracticaldev/status/76048012124142796...
Then you can make something that can turn off or on "real things" and work from there.
If it can do 120v, it can usually to 12v, and that's the next step - directly controlling components.
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.
Somethings are purchased in packs of 10 even when needing 1 type of things happen too, so sometimes you have to divide the price by numbers used. Your comment also suggest you consider that nothing was necessary to repurchase or that the final BOM wasn't the 3rd iteration of which items were actually used in previous attempts. Pure R&D type hobby projects can be oh so much more expensive, but oh so much fun.
It's dumb that we have these super computers in our pockets with long range antennas and in order to talk to each other they have to go through central intermediaries and paid access.
I want ad-hoc geographically local connectivity without service providers.
Do some research on VHF/UHF amateur radio. That'll give you a primer on why this is hard. Think line of sight, repeaters, traffic management.
Our current infra, even if it is paid, is cheap and miraculous.
Edit: I had a ham license once (probably still do), built VHF transceiver, only had asshats to talk to on it (locality related not technical).
I'm interested in LTE Direct but no one has implemented that in a phone. LTE Direct has range of 1mi which is the range of most low-power systems.
Ham radio gets longer range with higher power and better antennas. But only to the horizon with most people. Ham radio still depends on repeaters on high points.
The internet is amazing and stupid.
Middle English (denoting a designer and constructor of fortifications and weapons; formerly also as ingineer ): in early use from Old French engigneor, from medieval Latin ingeniator, from ingeniare ‘contrive, devise’, from Latin ingenium (see engine); in later use from French ingénieur or Italian ingegnere, also based on Latin ingenium
Would be great if we had a less war-like derived word for our profession.
"Genius" shares the same root.
I thought humanity would grow out of senseless aggression in 2024, but here we are. And yes, I am basing this on a specific real-world example of a country invading another country right next to mine, and my specific thoughts and beliefs.
https://www.reddit.com/r/ErgoMechKeyboards/comments/hj0q8x/f...
[1] https://www.youtube.com/watch?v=AJQZFHJzwt4 [2] https://github.com/remrc/Self-Balancing-Cube
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
It seems such a thing is possible now.
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.
Very interesting video https://www.youtube.com/watch?v=kUYzuAJeg3M.
I love engineers who make art so much.
Eventually, the reaction wheels max out and the couch falls over, exploding like... well, an interpersonal relationship if you ask the artist; but lately, it's hard not to see politics.
It was recognized by Prix Ars Electronica, a very high honor for this genre of art.
Video: https://www.youtube.com/watch?v=uQRP-b68fnE Article: https://ars.electronica.art/aeblog/en/2014/07/02/auf-der-suc...
Also, when you have a question in development, remember: One test is worth a thousand opinions (especially re. your own opinions).
I felt pretty good over the past few weeks after finally starting to learn React on the side, and building something that some of my friends are going to use. Sure, it doesn't have the "whoa" factor, but it also didn't cost $2500 to build (not including the years [decades?]) spent learning.
It's actually the ultimate sign of luxury when you have time to study, AND resources to go to a good school, AND enough free time and money to spend on gadgets, AND you can afford to throw thousands on something useless, etc.
(All that said, the creation is cool and very nice work from Willem specifically)
It isn't someone much better at something. It's someone much better at something entirely different yet quite related.
It doesn't change what one can do that's true. Comparison with oneself is mentally healthier for sure. But humans compare themselves with who they can see, the internet gives us a view of what virtually everyone is capable of.
Would it be cheaper (and/or safer) to build a larger one, allowing for larger-but-slower flywheels? Could you make one out of a couple of scrap bicycles?
The stainless steel flywheels though..... No ideas.
Or maybe a pair of motors, moving two circles with weights on their rims around, to shift the center of gravity around until it's stable enough to park them on opposite sides?
No. The reaction wheels are generating torque to change the orientation of the cube, not just shifting its center of gravity.
I think that's a little different -- it's pumping liquid around to change attitude (i.e. to point the satellite in a different direction), not to affect its rotational velocity. To get a sustained rotation, you'd have to keep pumping the liquid around continuously, which isn't terribly practical.
Neat idea, though! I wonder if it's being used anywhere, or if reaction wheels won out.
My wheels are oversized when you just consider the balancing application, but I want to add jump-up functionality later, and the wheels need significant inertia (and also need to run at significant speeds) to accomplish that.
Fun project!
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.
Ion drives or selectively colored surfaces don't have enough impulse to do the job, those are the only non-mechanical reaction devices that I know of, but maybe there are others that could work?
> I wonder if it’s even possible to build a non mechanical cube that could balance on its point
I don't think a hot air balloon fits the bill there, nor does submerging it in a convenient body of water.
Obviously there’s a mechanical force at play, but there’s a huge difference between “some springs make this work” and “these motors make it work”
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.
Also, even if most hobby motors do not specify Nm/A, they usually give KV, which is actually the same value but shown in a different form :).
There was a popular mechanics article a many years ago about a box that moved without any outward visible means of locomotion. Inside it were a slide with a little tin can and some metal balls, going one way up the slide was easy and nearly friction free, the other way it released and fell, then bumped into a stop at the bottom which was enough to cause the box to slide a bit. That was mighty impressive when I was a kid, this is like an SF version of that.
It would be cool to combine these techs. Maybe have a floating floor that the cube then balances on or something to that effect.
Roll the dice.
The brushless type looks interesting, since you get the flywheel, the motor, an integrated driver, and encoder board all in one piece. A bit pricey still, and the encoder documentation is lacking, otherwise I might've ordered one or two already.
Would be really cool to make a satelite model that hangs from the ceiling by hanging it at its center of mass on a ball joint, so it can rotate in all directions, then using these to orient it in specific ways, solar panels for charging, radio comms to give it commands, sonic humidifier as the rocket engine, etc. Maybe one day lol.
Could also magnetically levitate to "get up" if there was a coil underneath it.
https://pdf.sciencedirectassets.com/313346/1-s2.0-S240589632...
Also, there are other papers on using single-axis pivotal (flip 180 degree) to bleed off wheel speed without braking.
Making a public sculpture size version seems really cool on the one hand. On the other hand, it seems incredibly dangerous if it could crush someone to death if the power or electronics failed...
Or would wireless power be the way to go, the same way we charge our phones these days? Could you fit a large enough coil close enough in the tip?
Absolutely not. Gyroscopic systems have been used to keep ships floating (and moving) for many years. I also wonder if it could be used in buildings for earthquake mitigation...
Also super impressed by the build quality and the welds you made for this hobby project.
How does one quieten fan sounds?
"CMGs are also far more power efficient. For a few hundred watts and about 100 kg of mass, large CMGs have produced thousands of newton meters of torque. A reaction wheel of similar capability would require megawatts of power."
More info: https://en.wikipedia.org/wiki/Control_moment_gyroscope
I would suggest v2 have photovoltaic panels on all sides so it could run indefinitely on a sunlit windowsill...
https://eu.mouser.com/ProductDetail/TDK-InvenSense/ICM-20948...
Spacecraft (which most roboticists would call robots) typically orient themselves using a combination of reaction wheels, magnetic torquers and thrusters. The reaction wheels spin rotate the aircraft by “taking” angular momentum into their own rotation. They don’t require a local magnetic field or the expenditure of fuel, so are a nice choice.
Tons of different implementations out there for balancing. Maybe the most common one is the one we humans use, which requires zero wheels :)
Sensors, brain, muscle movement.
And beyond the muscle mechanics, do we understand what the brain is doing? For example, I find it fascinating that I cannot balance myself on one foot if I close my eyes. So obviously we use some visual cues to balance.
Skill issue. I'm good at balance sports and can say that balancing on one foot with closed eyes is hard but doable. Just train it :)
What are the limits of electronic breaking of those motors?
People would love to see this in a museum.
Now make it walk using two vertices (close to each other) as the two feet ;)
You can tell the designer likely has some proper engineering experience not just by the nice designs of each part and how well the thing works, but also by the use of Torx screws!
``` “What were you in, up there? Mason says you’re training.” “Kind of like a washing machine, inertial propulsion. Big-ass fly-wheels inside.” “Washing machine?” “About three hundred pounds. Big red cube. I’d just learned to balance it on one corner, then rotate, when they made me come back.” “What’s it for?” “Fuck if I know. Wouldn’t want to meet one in a dark alley.” ```
No animal can compete with the accuracy, reaction speed, etc. Racing Drones will be able to fly better than 99% of human operators. Cars will be able to drive better than 99% of human operators. And consistently.
Google already gives direction better. Trading bots trade better. They are preferred by people and corporations, respectively.
I wouldn't be surprised if computers can brute-force better scientific theories just by being fed motions of stars or other data. Like deducing Kepler's laws in 2 minutes and then going much much further, into laws that use 19283-dimensional vectors and are 99.9% of the time predictive.
Monte Carlo Tree Search has done very well with chess, with AlphaZero beating all human-designed programs like Rybka, and playing much more elegant chess too.
Where we need AI models is training on human-produced data (art, text on the internet, etc.) And there, it can be trained to maximize various metrics, including human satisfaction, or actual investment into an enterprise, and soon -- laughing at jokes, or agreeing to go out with someone romantically, etc. Just pick the stuff that works the best, and show it to humans as a superstimulus.
In addition, the models are developing "understanding" of the latent space, the way a student in a classroom would develop this from listening to the professors explain stuff (rather than do experiments themselves). The latent space, thanks to humans, models the real world quite well, from a human perspective, and the computers can become polyglots and polymaths... ALL of them. Just download some compressed model weights onto a small computer, and it becomes more knowledgeable about topics than any human. And just like other software, the weights can be improved.
But the next level is Swarms. Swarms of bots in online accounts at online platforms and communities will be able to optimize "reputation" points that they accumulate from existing humans in the communities (social capital). By doing this 24/7, and mimicking timing of humans etc. they can eventually (in aggregate) command far more reputation than any set of humans. They can also coordinate over long periods of time, as sleeper accounts, and eventually undertake any reputational attacks, including and up to having a person's own friends turn on them, ruining a famous person's reputation, having them convicted of a crime, or even foment a war etc.
Whether or not humans are behind these directives at that point will be irrelevant. It's a bit like giving everyone atomic bombs or the ability to create novel viruses, except online. Someone's bound to misuse it. And because the swarms are so destructive and able to blend in, the internet will become a Dark Forest and people will try to retreat into real-life communities, where they will try to eliminate bots by having people show up periodically at events, but never completely succeed (because these same people will run bots on their own accounts).
Already for years, corporations have been deploying algorithms to optimize people's addiction to TikTok, Instagram etc. with predictable effects of depression in teens, anger in adults arguing politics, etc. And that was before AI.
I wrote about this here in LA Weekly: https://www.laweekly.com/restoring-healthy-communities/
Self driving car in Las Vegas is relatively easy. How about tight curvy streets of Rome?
And what about medical machines or sex machines. I doubt they are better then human.
"Sure, the machines can do X really well, but what about Y"
Y is just X with more variables. The machines will be able to do better than 95% of humans in a couple years, and then eventually better than all humans. But doing better than 95% already means they will be preferred everywhere.
And the swarms is the key!
It can indeed, and is already used in the wild today!
https://en.wikipedia.org/wiki/Reaction_wheel#Examples_of_spa...
That said, it's not really "designing" if you're "building" something that already exists, is it?
It could just be a casual title, guy probably didn't even mean to title it that way but he probably didnt think about it too much. But to downvote because I point out something factually incorrect is just absurd.
Nonetheless, incredible work by the OP - "I built a cube that balances itself" is already extremely impressive