• Electricity is Almost, but not Quite, Unlike Vodka

    3 days ago 2 comments

    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).

  • SG-90 Hobby Servo

    03/11/2017 at 00:58 0 comments

    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.

  • Flywheel and Ratchet

    05/07/2016 at 00:38 0 comments

    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.