12/18/2018 at 00:32 •
There are many monochrome OLED display modules available for really reasonable prices out there. They can be really useful for a small and simple display in a project. However, many libraries available for driving them are rather big and slow. In this article I want to show how easy it is to drive those displays directly, without a dedicated library, and how this can improve speed and save memory.
As an example I will be using a Wemos D1 Mini (now Lolin D1 Mini) board with an OLED shield. To focus on the data we need to send, and not on details of environments and libraries, I will be using MicroPython for all of the code. I hope that once understood, the examples can easily be translated for any other board, display and language.Read more
11/04/2018 at 21:40 •
You can make a pretty neat low-resolution display out of LEDs arranged in rows and columns — you can even buy ready matrices that save you a lot of work with it. You "only" need one GPIO pin per every row and every column (you can save a lot of them by charlieplexing). The way you display things is that you enable one row (or column) at a time, and enable the columns (or rows) for that set of pixels, and then you disable it and switch to the next row (or column). If you do that quick enough, the LEDs won't even have time to stop shining, and you will have a pretty reasonable image displayed. But there are several problems with this.Read more
11/01/2018 at 14:18 •
Would you like to be more creative? More eloquent in conversations? More intelligent in decision making? Better at problem solving? More attentive? Able to read those difficult books? Focus deeply on the project at hand? There is a simple solution for all this: embrace boredom.
It takes some effort and training, but I can assure you that it certainly is worth it. Whenever you are waiting, whenever you don't have anything urgent to do, whenever you don't particularly feel like doing something, just be bored. Forget about taking out your phone and mindlessly scrolling through the social network stream, frantically checking your messages, or playing silly games designed to get you addicted to them. Just stay there and think about whatever comes to your mind: that conversation you had last week with a friend about morality, that book you are reading, that project you were planning to start, what you will tell the person you are waiting for when they arrive, what you will do next, etc. — it doesn't really matter what you think about, just let your mind wander.
The effect of this? You will have more motivation to actually work on that project, you will understand the book better, you will have interesting things to say in the next conversation, you will enjoy your time with that person more, and so on. Because your mind will have done some of the work up front and will be prepared. Because you will also think about things that you wouldn't notice otherwise. Because you will be more rested and ready to pay more attention to the here and now.
Obviously, this is not a silver bullet. It doesn't work when you are tired, depressed, stressed and burned out: you have to make sure you take care of your sleep deprivation, depression and anxiety first — don't be afraid to talk to a doctor about them, they are often very easily cured. But once you have that under control, make sure to leave yourself as much time as possible for doing absolutely nothing. Literally staring at a wall. It will make everything else you do much better.
05/28/2018 at 19:02 •
Objects have feelings. They are not the feelings of those objects, of course, they are our own feelings that we associate with the objects. Generally speaking, nice objects evoke positive feelings, and ugly or scary objects — negative. Of course it's more complicated than that, there is a million shades and kinds of feelings we have, and they also depend on the context and evolve over time. But every object we notice gets automatically assigned an emotional value — the objects that don't cannot be noticed.
It is the goal of art to play on those values. Artists create objects that produce in us especially strong and elaborate feelings. The stronger the value, the easier the object is to notice, and art will often pop out, attract your attention. Objects with low value disappear, blend with the background, become less than invisible — they become irrelevant. It's the objects with value that we want to see, interact with, or own. The emotional value gives objects their meanings.
Note, however that the meaning doesn't have to come from the object's appearance (although it usually does on initial discovery): it can come from a story that we have heard about it, its importance to other people, cultural connotations, market value, or... usefulness.
That's where the distinction between tools, toys and treasures comes in. Toys are shiny, engaging, immediately valuable objects that are desirable for their ability to entertain us. They may be child's toys, or they may be books, movies, paintings, fireworks shows, computer games, news items, gossips, board games, or sport accessories. Treasures are not engaging by themselves, but take their value from cultural references, market value or the status that they are a sign of: money, famous works of art, precious metals and gems, sport cars, fashionable clothes, jewelry. Tools, finally, are neither engaging nor expensive, and have very little value of their own — they are often overlooked when scanning the interiors — but their value comes from what they enable you to do: actual tools, appliances, vehicles, prosthetics, communication devices, measuring utensils, uniforms, badges, permits, protective gear, medical supplies, or documentation and manuals.
Of course the world is not black and white, and in practice every object is a bit of everything. Almost everything in our capitalistic world has a price today, so it's a bit of a treasure. Toys can helps us learn or make us fit, so they are useful. Expensive things are often also nice and make us happier, and the status they signify can be useful. And finally tools can give us a lot of pleasure when used for hobby. But often the principal purpose of an item will fall in one of those categories (then again, there are things like musical instruments, which are all three equally).
Why am I writing this? It's because I think it is very important, when designing something, to always remember in which category it primarily falls, and design it accordingly. A tool should not cry for our attention, should not require us to focus on it, it should not be something we interact with — rather it should disappear and become a seamless extension of our bodies. An art piece on the other hand should try to get all the attention it can, using one strategy or another. Treasure needs no design at all, of course.
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