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
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.)
"Actuator" is a fancy name for whatever makes your robot move: servo, motor, artificial muscle, memory metal, hydraulics, pneumatics, etc. As the size and weight of your robot grows, so has to the strength of the actuators it uses.
For instance, consider a servo. Its strength (in this case called torque) is usually expressed in kilograms (of force) times centimeters, or newton meters. If a servo has 1kg×cm of torque, it means it can lift 1kg of weight on a 1cm long lever. Since the levers scale linearly, it means it could also lift 0.5kg on 2cm long lever, or 2kg on 0.5cm long lever, etc. You can see already that if you make the robot's legs twice as long, you will need twice as much torque. But that's assuming that the weight remains the same. From the cube law you know, that the weight is going to grow fast, so in reality larger robots will need a lot more torque.
But there is another thing. The smaller the servos, the lighter and cheaper they are. Sure, the torque also gets smaller, but not nearly as fast. Consider those two example servos:
As you can see, the smaller servo can raise itself on a lever half a meter long! The larger one, almost 10 times heavier and over 20 times stronger, can only do 125cm. And it will be similar with any other parameter: price, speed, amount of current needed, etc. At some point the parameters will be so bad, that you will have to switch to hydraulics.
It's not just the actuators that need to be stronger. They are connected to the structural elements, that have to bear all that force too. And thanks to the cube law, it doesn't suffice for them to be just longer and thicker -- they actually have to be made from stronger and lighter materials.
Stronger materials are harder to machine and generally work with. You can no longer get away with hot-gluing parts together: you will need nuts and bolts, and possibly also special mechanical design. And you will need specialized tools.
And when you finally get your robot together, it will be very fragile. Why do you think all those large robots in laboratories always operate with a safety line hanging from the ceiling over them? That's because if they fall down, they will smash into pieces. The materials they use are strong enough to hold them together, but not strong enough to survive a fall.
On the other hand, my smallest robots survived repeated falls from my desk to the floor without even a scratch. If you make a robot the size of a cockroach, you can drop it from the roof of a building. It will simply not gain enough speed falling through the air to damage it on impacting the floor.
So you finished your large robot, and now you are programming it. For a start, you just make the limbs move straight to their destinations and stopping once they get there. Your robot falls, the limbs break off, the servos strip gears and there are huge spikes of current drawn from the battery. What happens?
Well, you cannot just move a heavy object with high speed and then have it stop instantly. Inertia will make it keep on moving, and the servomechanisms will need to do a lot of extra work (and endure great forces of stress) to stop it and move it back where it belongs. That also applies when moving the whole body of the robot while walking -- your effective Zero Movement Point no longer coincides with the center of mass of your robot. You have to start taking the speed and acceleration into consideration in your motion planning, and thus all your movement equations become second degree differential equations without a closed-form solution. Yay!
On the other hand, if you keep the robot small, all its elements light and the servos have abundance of power, you can pretty much ignore inertia and get away with writing much simpler code that only takes into account the current positions of the limbs.
So you think you have the budget, you have the materials and tools, you have the programming expertise and strong servos to handle the inertia, what could possibly happen.
Just watch this video by Trossen Robotics:
Strong servos, larger batteries, high currents, long reach of the limbs, high movement speeds -- it all means trouble. You will need safety measures. Force stop buttons, one on the robot itself (hardware, brutally cutting the power), and one remote (so that you don't have to chase your robot through a hole in made in the wall). Suspensions mechanisms. Safety gear for you to wear. Fire extinguisher capable of containing a LiPo battery fire. Circuit breakers. Someone to check periodically if you are trapped under your robot's weight...
It's all extra work, extra cost and extra risk. Why take it, if you can instead have a robot the size of a hamster that behaves funny when something goes wrong, and tickles instead of crushing your bones?
I left the most important reason for the end. Small robots are convenient.
You can work with them directly on your desktop, connect them to your computer, adjust easily with just a screwdriver. You can store them in your drawer. You can recharge them from your phone charger. You can take them with you to conferences and workshops. You can fly with them in your carry-on baggage (as long as they don't have anything that looks like a clock on them). When something goes wrong or breaks, you can simply pick them up and fix.
Not so easy with larger robots. You will need to test them on the floor, in a garage or even outside. You will need a complete suite of tools to work on them, and a dedicated storage space to keep them. Special battery charger. Taking them anywhere involves careful packaging or even loading onto a car. For flight, you have to remove anything that is sensitive to low temperature and pressure, as it's going to go in the check-in baggage. Also be prepared to have to re-fasten all the screws on it that came loose due to vibrations. When something goes wrong or breaks, you have to call the mason to fix your house...
Make your robots as small, as practically possible.