04/09/2018 at 22:04 •
Those are the slides from my talk for the Dublin 2018 Hackaday Unconference. Since the slides themselves contain only graphics to be explained in the talk itself, I'm also adding explanations below them. Unfortunately I have no idea what I actually said during the talk (I hope I didn't offend anyone or anything like that) — all I remember is red mist and then I woke up in the plane — so the comments are more what I *wanted* to say and less what I actually said.Read more
03/24/2017 at 13:01 •
Or what are voltage and current exactly?
I have seen this explained with water, but that doesn't make any sense. Water doesn't have any volts!
Let's start with a simple case. You have a battery, and you have a light-bulb that you connect to it.
That is like a bottle of vodka and a drunkard. The voltage stored in the battery is like the strength of the booze in the bottle -- it's given by the chemistry of the particular kind of battery. The current, on the other hand, is given by how fast the drunkard drinks it. He can sip it slowly, and thus get only a little bit druk, while the bottle lasts long, or he can guzzle it straight from the bottle, which is the equivalent of making a short. Of course, the more he drinks, the hotter he gets. To get to the same level of inebriation with a lower voltage, you need to drink more of it, so if you want to do it in the same time, you need higher current. The slowness of drinking is the resistance.
The bottle has its own resistance too. The bottleneck is the bottle neck. You can only pour so fast from it. However, if you connect two or more bottles in parallel, you can get much more current from them. (Connecting bottles in series gives you higher voltage, which is where this metaphor breaks, but bear with me.)
Of course, if you have several drinkers in parallel, you will need higher current. (Again, the metaphor breaks when you connect them them in series, but let's not dwell on that.)
Now, what happens when the drunkard tries to drink faster than what the bottle can manage? In fact, a bottle is more like a capacitor than like a battery. It holds a certain amount of electricity at a certain voltage, and lets you draw all of it from it. (But not quite, to make it exactly like a capacitor, you have to top it up with water after every pouring, so that voltage drops.) A battery is more like a distillery. It produces as much vodka as needed (at a certain voltage), but when you try and demand more than it can produce, it will start topping it up with water, and thus you get a voltage drop. If you do it too much, the distillery will break.
Now, if you connect two distilleries in parallel, they will double the voltage of the resulting booze. If you connect them in parallel, you can draw more current.
That's pretty much it. The important thing to remember is that the voltage is determined by the distillery, but the current is determined by the drinkers (and limited by the distillery by voltage drops).
03/11/2017 at 00:58 •
SG90 is one of the cheapest and most common hobby servos available. That is probably because it's also the most commonly cloned hobby servo. If you bought one of these very cheap. there is a very good chance that it wasn't actually produced by Tower Pro, but it was manufactured in one of the hundreds small factories in China based on designs that have been passed from person to person.
As you can expect, the parameters of this servo, including its quality, but also exact dimensions, speed, torque, accuracy, dead band, maximum and minimum voltage, size of the shaft, etc. – will vary wildly depending where it is sourced from, and even when. It is common, for example, for the servo horn from a servo from one batch to not fit the shaft on a servo from a different batch. That means that any designs using those servos have to either have large tolerances, or be adjusted for the particular batch of servos.
Those servo typically come in a plastic bag, with a smaller plastic bag inside containing additional elements: a horn screw, two mounting screws, and three servo horns: a single arm, a double arm and an asymmetrical cross. The holes in the horns are spaced 2mm apart.
The brown, red and yellow wires are typically a little over 15cm long, and end with a standard JR female plug with 2.54mm pitch. That plug is a little thicker than 2.54mm near the top, so when a lot of them are put together, there have to be some additional space between them.
They have shape of the typical 9g microservos: 23mm long, 12.2mm wide and 29mm high. They have two "ears" with mounting holes, but the sizes of the ears and the holes vary greatly. They are held together with 4 long screws. When those are removed, they will break into three parts – the bottom with the wires and electronics, the middle with the motor and the pot, and the top with the gearbox and the shaft.
The gearbox is composed of four nylon double gears, mounted on two shafts – the potentiometer's and an auxiliary shaft. There is a fifth small gear on the motor's shaft. The last gear is connected with the main shaft, which has a piece of plastic preventing the servo from rotating all the way. There is no bearing – the plastic case of the servo holds the top of the shaft, and the brass bushing of the potentiometer holds the bottom. The gears can be very delicate, and it's quite easy to strip their teeth by trying to force the servo's movement by hand.
The electronics used in this servo vary, but are usually analog.The servo expects a PWM signal at around 50Hz, with the pulse width between around 400 and 2400µs, with 1500µs being the middle position. The maximum and minimum pulse widths vary between individual servos, even in the same batch. The exact amount of motion corresponding to a particular change in the pulse width also varies. The total range is usually a little over 180°.
The torque and speed of this servo also vary from batch to batch, but are somewhere around 1.8kg×cm and 0.12s/60° at 4.8V. This is affected both by the power voltage and by the frequency of the control signal – the higher the frequency and voltage, the stronger and faster the servo. However, this also affects its lifetime.
It is possible to modify this servo for continuous rotation, by cutting the limiters on the shaft, drilling the shaft to make it move freely on the potentiometer, and gluing the potentiometer in its center position.
It is also possible to add a wire to the center of the potentiometer to read the servo's position, and to one end of the motor's leads to read the servo's force – both signals will be between 0 and the power voltage.
05/07/2016 at 00:38 •
When you have a lot of different projects and not enough motivation, energy and time to work on all of them all the time, it's very important to organize them in such a way, that you can work on them in small increments. There are two patterns that help with that, the Flywheel and the Ratchet.
A flywheel accumulates energy. You can make it spin, and leave for some time, and it will keep on spinning, at least until friction makes it stop. You can store energy in a flywheel, when you have it, and then use it later, when you need it. You could also call it a battery, I suppose.
I always try to organize my projects so that they have a kind of psychological flywheel in them. When I have a lot of motivation and energy, I can "store" it in them, and later draw upon it when it gets low. How do I store the energy? There are many ways. I might link to some inspiring materials, I might write down the ideas, I might create a "done list" (it's like a "todo list", only the other way around, more motivating), I might post some questions online, I might order some cool parts, design a PCB, write a proof of concept program, etc. There are all sorts of small activities I can do while I'm motivated. The point is to always make them leave some kind of trace, so that they can motivate me later on. This may be serendipitous, like finding an old picture or prototype, this can be on-demand, like going through my "done list" or reference links, or it may be timed, like receiving the ordered parts. The point is to always store away energy when I have it.
A ratchet is a mechanism that makes sure that you only move forward, and not backwards. If you use psychological ratchets, you can work on your projects in small increments, and still have them all progressing. The ratchet will prevent them from dissolving over time.
Again, there are many ways to introduce a ratchet. Using version control repositories for your code is one such example. Saving snippets of articles you write, even if they don't make much sense yet. Saving sketches. Keeping photos of the things you are disassembling or assembling. Using bolts instead of glue, and plugs and sockets instead of soldering everything. Having room for keeping all the prototypes. Having enough stock parts to not cannibalize old projects. Putting labels on the PCBs, so that you can figure out what goes where even after you forgot. Commenting your code.
Both of those mechanism also work very well with collaboration. In fact, they let you collaborate "asynchronously", without even having to actively cooperate with your collaborators. They can pick up your flywheels and your ratchets years after you created them, and develop them further independently. All you have to do is to make them public, though that is not always possible with physical things.
04/03/2016 at 11:21 •
Ever wondered why I build those super-expensive 4-legged robots with 12 servos, three servo per leg, when all you need to have a "walking" quadruped robot is two servos and a piece of wire bent just the right way, and three servos for a hexapod? My answer is simple: those robots are not really walking. They are crawling. What's the difference?
When you are walking, you make steps -- your feet move, relative to the ground, only when they are in the air. Once you put a foot on the ground, it stays pretty much in the same spot. You don't drag your feet.
When you are crawling, most of your body stays in contact with the ground, and you use your arms and legs to push it forward. It's similar to rowing. You never completely raise from the ground, some parts are always touching it, you just drag them.
But what is the practical difference? First of all, crawling usually requires much more energy. How much exactly depends on the kind of surface you are crawling on -- which is another down side. You can walk as well on a puffy carpet as on a smooth floor, but crawling on the carpet is much harder. Then, crawling doesn't require much balancing. Since most of your contact surface stays the same, there are no complex movements you need to do to shift your center of gravity to keep from falling down. For all you care, you are already down. And finally, most importantly to me, crawling is not nearly as interesting.
What about those single-motor mechanisms that use intricate systems of levers or gears to move their many legs in a walking fashion? In theory they lift their feet for movement, and they don't drag them on the floor much, so that counts as walking. However, in practice, this walking doesn't give them any advantage over normal wheeled locomotion. In fact, if you look carefully, they simply move on wheels, just the wheels touch the floor through the system of levers, instead of directly. This of course looks cool and all that, but it doesn't let you move more efficiently over uneven terrain, climb stairs, etc. -- so most advantages of walking are gone. They still make nice toys, though.
02/07/2016 at 10:28 •
Whenever someone attempts to build a humanoid robot (an android), whether it's Boston Dynamics or a hacker in a garage, they usually have one or several justifications for it. I'm going to list the common justifications here and explain why I think they don't make sense, except for one of them.
Perfection. Humans are the pinnacle of evolution and our bodies are the most perfectly matched to operate in this environment. Bullshit. Our bodies were optimized for many tasks that robots simply don't do, such as growing, giving birth, running very long distances, resting, mating, raising young, etc. They were also optimized around constraints that are simply not there for the robots, such as limited material strength, high cost of precise sensors, limitations of energy distribution, need for regeneration, inherited overall structure of mammals, etc.
If you reconsider the needs of the environment and the possibilities the technique gives you, you will come up with a construction that is smaller, lighter, faster, has much more reach and more flexibility, has eyes and other sensors practically everywhere, and doesn't look anything like a human.
Teleoperation. This is what many giant robot movies claim -- you build a robot, and make it repeat all the moves of a human pilot, only with greater force and often in larger scale. There are two reasons why this doesn't work. First, if you really make the robot considerably larger, you are going to have completely different dynamics. Even if you make the robot's actuators super-strong and fast, so that you can compensate for the dynamics in software (you can basically simulate any dynamics, as long as you have enough torque), this is going to be very inefficient and awkward.
Second, there is no reason for that robot to still have human proportions. The pilot would need to learn to operate the robot anyways, there is no getting around that, and our brains are very flexible -- we could easily operate a body that has completely different proportions -- much better suited for the task at hand. For instance, a chimpanzee can run much faster than a human.
Man-made environments. If it's going to be used in environments made for humans, and use human tools, it has to look like a human. Again, not true. Technology can do much better. It doesn't have to have the same size, strength and reach as humans do -- it just needs to be smaller, have greater reach and be stronger. It doesn't need to be humanoid. In fact, if you have a dog, you can already see that it can operate in human environments just fine, even though it's much smaller and less agile. Something like RoboSimian is going to operate in human environments much better than humans. As soon as it has good enough control, that is.
Blend in. It will be easier to interact with and get used to it if it looks like a human. That's actually exactly the opposite. You see, we appeared on this planet together with several other species of hominids, and we have evolved to exterminate them with extreme prejudice. Whenever we see something that looks like a human, but not quite, we find it extremely creepy and disgusting. This is called "uncanny valley" and it's a big problem. The easiest way to avoid it is to not make robots look like humans.
It's cool. This is the only reason I can accept. Yes, it's insanely difficult, it requires a lot of research and it's expensive. All the more impressive! It totally makes sense to make humanoids for entertainment purposes, to put them in shopping windows, TV shows, live performances and what not.
And that's pretty much it.
12/25/2015 at 01:30 •
I think this is the most important thing that I learned in all my years making things.
You see, things break. Sometimes they wear off or become obsolete, and sometimes they arrive already broken. And from time to time you make a mistake and release the blue smoke from them. But it's not just that. Often you just want to remove a part to see how things work without it, or temporarily switch it for another part. Or scrap an old project and recover parts from it.
Whatever the reason is, it's all much easier when you can simply unplug and/or unbolt it. Therefore:
- Use nuts and bolts, screws or other reusable fasteners. Avoid gluing things together as much as possible, unless it's some weak glue like adhesive tape or hot glue, which you can easily remove. Even then, bolts are much better.
You can use nylon or acrylic bolts if you care about the weight.
- Use plugs, preferably on both ends of the wires. Avoid soldering wires directly to the boards, or soldering boards together.
- If possible, make parts individually removable. Avoid situations where you have to remove one thing to get access to another thing.
- Use off-the-shelf parts as much as possible, and avoid customization. Any modifications you make will need to be repeated when you are replacing the part, and may make the part unusable in other projects.
- Design in modular way, so that you can disconnect and test subsystems individually.
- Try to follow existing standards and established practices when designing your plugs and mount points. Try to use as few different kinds of plugs and fasteners as possible, so that you can later swap elements. Also follow this across different projects.
- However, don't use standard connectors in non-standard ways. Do not use an audio jack to provide power, or an USB plug for I²C. If you absolutely have to, make sure that connecting something there by mistake won't result in a catastrophe.
- Try to anticipate alternate uses. Use footprints that can accommodate several versions of the component, place headers so that you can use either straight or angled ones, include additional mounting holes, etc.
This will not only let you fix your projects when they break, it will also allow you to diagnose the problems in the first place, and will make your projects easier to reproduce by other people or yourself.
- Use nuts and bolts, screws or other reusable fasteners. Avoid gluing things together as much as possible, unless it's some weak glue like adhesive tape or hot glue, which you can easily remove. Even then, bolts are much better.
12/03/2015 at 12:41 •
So I just received the Pi Zero, and I had some fun playing with it already. I wanted to share some of my comments about the technical aspects of the new board.
- small size
- mounting holes
- backwards-compatible gpio header
- unpopulated header
- all components are one one side of the board, the other side is flat and clean
- all sockets are on one edge (plus SD card slot on another edge, but that's just two edges)
- all LEDs are together on the edge
- video out and reset on separate unpopulated header
- lots of test points and unpopulated socket footprint on the underside
- 700Mhz by default, with an option to overclock to 1000Mhz
- SD card images compatible with other Pis
- the two USB ports are too close together, making it hard to fit two plugs
- the USB ports are not exposed as pin headers or any other kind of socket that could be used by a "USB hub shield"
- no version with unpopulated usb and hdmi
- no audio circuit, although one can hack one
- the additional GPIO pins that are freed by having less hardware on the board are not exposed
- I would prefer it to be a little bit more short and square -- but I understand that then the standard GPIO header wouldn't fit.
- micro-USB and micro-HDMI requiring additional adapters -- that's not such a big deal for me, but it's an inconvenience
- no on-board bluetooth or wifi — that would be useful for me personally
10/13/2015 at 16:15 •
We don't really see too many walking robots around us, but everyone knows how they should look like. After all, we've seen a lot of them in the movies, comic books, and computer games. There is a slight problem with that. You see, those robots were conceived by artists, not engineers, and their only goal is to evoke a certain set of associations, such as swiftness or clumsiness, slowness or speed, friendliness or danger, sturdiness or fragility, cuteness or awesomeness, fantasy or realism, etc. Most of them couldn't be built with today's technology, and some of them with any technology, assuming today's understanding of physics is not completely wrong. Even if they could be built, they would be hopelessly impractical and inefficient.
There is nothing wrong with that, of course. Those robots do the job they were created for. They are an element of plot. Only rarely the designer is so incompetent, as to completely destroy the experience, as in the Interstellar movie. Unless, just like me, you want to build a walking robot, and you unconsciously try to make it look like those fantasy robots, because that's the only robot you've seen.
I want to list here the most common differences between those "artistic" robots and the robots that would actually make sense in the Real World™.
The Design Process
I think the most common approach to designing a cool robot for a comic, movie or game is to just take an existing animal, paint it in a metallic color and add some gears, radiators or antennas here and there. Or take a human actor, make some parts of her body transparent with computer special effects, and add blinking lights. This doesn't work on several levels.
First of all, if you didn't pick a crab or insect, your animal has most likely an internal skeleton, and your robot has a metal shell, which pretty much amounts to exoskeleton. The two approaches have radically different strong points and require radically different mechanical design. Unless, of course, your robo-animal has both internal skeleton and external armor, which is just wastefully stupid.
Second, muscles have completely different characteristics than servomotors or hydraulics, which most likely move your robot. Not only the power density is completely different, but you also attach them in different places and they have best efficiency in different situations.
Lastly, the constructions that nature arrived at are not very optimal from the point of view of technology. Nature has completely different constraints -- the animal must be able to build itself in the womb, then grow, heal itself, find food and digest it, reproduce, etc. The animals also had to evolve from existing earlier animals, and at each step they had to survive -- so they couldn't suddenly just sprout an extra set of limbs, rearrange its organs, etc. The nature also works with tissues, which are limited in many ways. For instance, you can't have wheels or other rotating parts, but it's easy to have soft or flexible elements.
Second approach is to take an existing machine or vehicle, and, um, transform it into a robot, usually by making it sprout hands and legs (and a head). Of course the transformation is purely visual. This is an easy solution for artists, because the machine already looks mechanical, so they don't need to think about all those parts they are drawing and what sense they make. Different elements of the machine get transformed into parts of the robot based exclusively on their visual appearance. And so, anything round may become a joint, anything oblong can be part of a hand or leg, and anything that has two holes in it can be the head. Any notion of structural consistency, fitting the actuators in there or powering them is completely ignored. You basically get a junk sculpture.
Note that this mistake is often made in a smaller degree when designing parts of the robot. The artists will often look for photos of machinery, and incorporate patterns they saw in them...Read more
09/27/2015 at 10:58 •
In which we learn why it's much easier to build small robots than large ones.
The Cube Law
A lot of reasons for making your robots small comes from the cube law. This law gives you the relation between the size of an object and its volume (there is also the square law, that gives you the relation between the size and the area). It says that as your robot grows in size, its volume will grow proportionally to the third power of that size (also called cube, hence the law's name). Consider the following example:
(I'm assuming that in both cases the average density of the robot doesn't change, that is, that it's not almost empty in the second case. As we will see later, that's quite accurate, or even optimistic.)Read more