Reading Bingo Balls with Microcontrollers

Every once in a while a project comes along with that magical power to consume your time and attention for many months. When you finally complete it, you feel sorry that you don’t have to do anything more.

What is so special about this Bingo ball reader? It may seem like an ordinary OCR project at first glance; a camera captures the image and OCR software recognizes the number. Simple as that. And it works without problems, like every simple gadget should.

But then again, maybe it’s not that simple. Numbers are scattered all over the ball, so they have to be located first, and the best candidate for reading must be selected. Then, numbers are painted onto a sphere rather than a flat surface, sometimes making them deformed to the point where their shape has to be recovered first. Also, the angle of reading is not fixed but somewhere on a 360° scale. And then we have the glare problem to boot, as Bingo balls are so shiny that every light source reflects as a saturated bright spot.

So, is that all of it? Well, almost. The task is supposed to be performed by an embedded microcontroller, with limited speed and memory, yet the recognition process for one ball has to be fast — 500 ms at worst. But that’s just one part of the process. The project includes the pipelined mechanism which accepts the ball, transports it to be scanned by the OCR and then shot by the public broadcast camera before it gets dumped. And finally, if the reading was not reliable enough, the ball has to be subtly rotated so that the numbers would be repositioned for another reading attempt.

Despite these challenges I did manage to build this system. It’s fast and reliable, and I discovered some very interesting tricks along the way. Take a look at the quick demo video below to get a feel for the speed, and what the system “sees”. Then join me after the break to dive into the details of this interesting embedded build.

Continue reading “Reading Bingo Balls with Microcontrollers”

Design and Hacking Drilldown: SuperCon Badge

One can imagine a political or business conference without an interactive badge — but not a hacker conference. Does this make the case for hackers being a special breed of people, always having something creative to show for their work? Yes, I think it does.

Following the Hackaday Belgrade conference in April of this year, we met at the Supplyframe offices to discuss the badge for the Hackaday SuperConference that will happen in Pasadena on 5+6th of November. The Belgrade conference badge (which was fully documented if you’re curious) was surprisingly popular, and I was asked to design the new one as well.

I was prepared to come up with something completely new, but [Mike Szczys] suggested keeping with the same basic concept for the project: “No reason to change anything, we have a badge that works”. To which I responded: “Well, the next one will also work”. But then I realized that “works” does not stand for “being functional”. The key is that it was embraced by visitors who played with it, coded on it, and solved a crypto challenge with it.

The World Doesn’t Have Enough LEDs

led-modules-versus-smdFast forward six months — here are the modifications made to the basic concept. First, the existing LED matrix, which was composed of two compact 8×8 blocks, was replaced by 128 discrete SMD LEDs. It was a much needed change to help scale down the dimensions and clunkiness, but also to avoid another painful experience of trying to purchase and have the matrix displays shipped, which seriously threatened the production of the previous badge.

It’s a long story which I discussed in my Belgrade talk — it turned out we did not manage to get enough common anode (CA) displays from all distributors in the whole world. We had a plan B, which also fizzled, leaving us with the plan C which actually included two “C”s: Common Cathode. We cleaned up all the supplies at five distributors, and managed to get 122 CA red, 340 CC red and 78 CA green displays (enough for only 270 badges) — the entire world supply. After that, you couldn’t get any 38 mm Kingbright’s display for months! The only problem was that there were two different versions of PCBs, one for CA and the other for CC displays, but luckily only one version of software, as it could autodetect the display type.

accelerometer-on-the-boardMotion and Expansion

So, what else was new in the concept? In the Belgrade version, the badge supported an accelerometer module and included an unpopulated footprint in case you decided to install it, but now the badge has the MEMS chip LIS3 as an integral part. There are nine pads (with five I/O ports, driven directly from the MCU) to which you can add a 9-pin expansion connector. There will be a number of these connectors at the Design Lab, so that anyone can expand their badge for their convenience, on the spot.

The Visual Design

The biggest change was in the visual design. What we came up with ended up being a fair bit smaller, lighter, with a more convenient shape, and less than half the thickness of the previous one. After we had scrapped quite a few ideas during the development process (including stylized skull, frog, etc), we were left with a couple of options which you can see on the image below. The wireframe drawing on the left hand side is the Belgrade badge, shown here for a size comparison. At this point the locale and date of the conference weren’t yet definitive, which is why you see San Francisco written on the images.


Design number 4 prevailed, so the PCB layout could begin. I don’t like autorouted PCBs, so I was in for quite a rough time trying to solve the routing manually having only 2 layers on the board at my disposal.

Routing a Compact LED Matrix

The LED matrix is so dense that there was virtually no room on the LED layer, so most of the tracks on the component layer had to be routed as if it was a single layer PCB. To make matters worse, the LED layer is routed as a matrix, with a bunch of horizontal and vertical tracks, otherwise a good reason to use a 4-layer PCB. To stay inside the budget, everything had to be placed on 2 layers, and that’s why the final result seems so confusing at the populated area between batteries:

Continue reading “Design and Hacking Drilldown: SuperCon Badge”

Clearly the Best Way to Organize SMD Parts

Have some plexiglas (acrylic) leftovers lying around? Well, they could be put to good use in making this SMD organizer. It comes in handy if you deal with a lot of SMD components in your work. No longer will you waste your time trying to find a 15K 1206 resistor, or that BAS85 diode… or any other component you can think of soldering on the PCB. The basic idea is fairly straightforword, which helped keep this short.

2SMD resistors are packed in thick paper tapes that don’t bend easily, and thus need larger containers than other components, which are packed mainly in flexible PE tapes. The first version of this organizer was built with a 96mm diameter space for resistors and 63mm diameter for other components, but it seems that there is no need for such large compartments. If I were to make it again, I would probably scale everything down to about 80% of it’s current size.

The best way to join all plexiglass parts is to use four M4 threaded rods. There is also a 1.5mm steel rod which holds SMD tape ends in place and helps to un-stick the transparent tape which covers the components. At the top of the organizer there is a notch for paper, used for components labels. Most SMD components are packed in 8mm wide tapes, making the optimal compartment width 10mm. It is not easy to cut the 10mm thick acrylic and get a neat edge – instead, you could use more layers of thin sheets to make the spacers. Using 5mm acrylic you can combine more layers for any width of tape, which contains wider components, like SMD integrated circuits. The only thing that you have to be careful about, is to keep the distance between the thin steel rod and acrylic, which is marked as “2-4mm” on the drawing. It is good if this space is just a few tenths of a millimeter wider than the thickness of SMD tapes.

smd_orthoThe CorelDraw file that can be used for laser cutting the acrylic parts, is available for download. If you scale the profiles, don’t forget to readjust the hole diameters and some other dimensions which have to remain intact. If you have 5mm acrylic pieces, you should probably use two layers of acrylic for every tape (red parts on the drawing). The barrier layers would be made of thin acrylic — for instance 2mm (the blue parts). Edge layers (green) are once again 5mm thick, and there are also the end pieces (yellow), glued to the previous borders and used to “round up” the whole construction and to protect your hands from the threaded rods and nuts.

While you’re building this for your bench, make a vacuum picking tool for SMDs out of a dispensing syringe with a thick needle. It’s a common trick for hackers to use an aquarium air pump, just turn the compressor unit by 180°, so that it creates vacuum instead of blowing the air outside. This process is described by R&TPreppers in the video below.

Continue reading “Clearly the Best Way to Organize SMD Parts”

Critical and Creative Thinking in a Hacker’s Work

Imagine yourself in a labyrinth, vast – endless for all you know. You wander the corridors, stumbling upon a closed door. You could invest some effort into unlocking it to find out what’s inside. Pretty soon you realize there are many more doors in the maze and you wish you had some sort of tool to help you see what’s behind them, and whether they are worth the effort.

If the labyrinth is a metaphor for your life or your work, then you should know that there is such a tool, and its name is Critical Thinking. It can save you a lot of time and money, sometimes your health and even your life. It can help you optimize or debug your projects, and even boost your creativity.

Why Should We Think Critically?

Even though many equate it with criticism, critical thinking is not a negative process. It keeps you open to new ideas, and at the same time it acts as a firewall against harmful ideological, political, or marketing delusions and scams, and especially against your own self-delusions. It suggests how to think, not what to think.

You can find a lot of definitions of critical thinking on the internet, and most of them are worth reading. I like the definition which [Richard Paul] gave in an informal presentation: “Critical thinking is thinking about your thinking, while you’re thinking, in order to make your thinking better”.

In a hacker’s work, critical thinking is very useful as a defense mechanism against self-delusion in problem solving, and dead ends in creative process. If you want to be a creative hacker, you have to think critically. It is even more severe in science, where the process called scientific skepticism (also spelled scepticism) involves systematic doubt – questioning every single step in scientific activity. It results in scientific method, which is not just doubt, but a set of methods for examining reality.

Here is an example in which critical thinking takes place and saves not only time and effort, but also leads to a creative result. When you start creating a concept for a new project, you get an idea and you probably like it from the beginning. That’s good, as it keeps you motivated, but the first idea is not necessarily the best one, and a process of trying out alternatives often leads to a better solution. If you know how to use critical thinking to attack your initial concept, it can help you get a better idea. To do so, you have to restart from the beginning many times, trying out a different approach each time. You will probably not have a perfect concept until you have made several modifications, some of which assume you forget everything up to that point and start fresh. It may seem like a waste of time, but it is quite the opposite – your initial concept is crucial for the final value of the project, and it is better to modify it in the early stage of the process.

Don’t despair even if you have to do it when you are already halfway through the project. In the early days of the computer era, data storage was not very safe and backing up data was slow and expensive. On several occasions I had lost all of my data and had to start from scratch. Yet every time, I was happy that it happened like that, as in redoing it I could add a new quality I hadn’t thought of before.

How to Think in a Creative Way

Critical thinking is a learned skill, that can be reinforced by habit. The same is valid for logical thinking, but we shall not discuss it here, as most hackers have already practiced logic over many years, and they surely know how to apply it in their activity. You can say that the logic is a necessary part of critical thinking.

brain_2It is hard to imagine debugging, servicing or any other form of problem solving without critical thinking, but if you are creating a project from scratch, you also have to think creatively. Creative thinking is different from critical thinking, but they share a strong bond. The creative process needs to have a critical check of ideas, and on the other hand, creative thinking can help you imagine all the possibilities when you need to pinpoint a problem.

Creative thinking is more motivating and generally brings more pleasure than critical thinking, and you can use it even when you are relaxed. While daydreaming, but still holding the problem in the back of your head, you may suddenly get a burst of creative energy and arrive at an “Aha” moment. Seems like a naive game, but it can be empowering.

If you hang around artists and designers, you can observe from how many different angles the creative process can be approached. Some of it can be applied to the hacker’s domain as well. You might, for example, start composing a new project that does not have a defined function; imagine the shape you like, define its dimensions, color, even draw it or make a 3D model. Then ask yourself – what would I like that shape to do? This inverse process can result in some pretty cool projects.

You will notice that many creative thinkers with have a small notebook on hand (not a computer, but an ordinary copybook) to write down ideas the moment they appear, so that they can be examined later. I knew a painter who held an exhibition which had no actual paintings, but a hundred of such palm-sized papers with rough sketches.

Who is a Good Critical Thinker?

Do you think that you can think critically? Let’s say someone wants to find a specific place in an unknown city. If you can give them a good, eloquent explanation, which helps them find it, you probably have the gift of critical thinking. This ability means that you can “observe” your own explanation through someone else’s mind, and the same “parallel processing” engine is used for critical thinking. If you can deliver that explanation in a witty and imaginitive way, then you are not only a good critical thinker, but also a good creative thinker.

It is much easier to recognize non-critical thinkers. They egoistically take their facts as the only relevant ones, seeing things in binary form: black or white, right or wrong, clever or dumb and so on – rather than recognizing all alternatives. They never doubt, especially when evaluating their own creations: “My idea is brilliant, because I’m a genius”.

This attitude is the worst possible basis for critical thinking; the bad news is that most likely none of us is a genius, but the good news is that even a real genius is hardly ever sure that their ideas are good. Being a genius does not mean having ideas without trying hard, but quite the opposite. So, if someone always admires their own creations and doesn’t ever doubt them, he is no genius – he simply doesn’t match the milieu.

There is one more parameter which can help us evaluate someone’s thinking qualities. If he believes that astrology, dowsing, and similar techniques are based on true facts, he is probably not very familiar with critical thinking. Not familiar enough to be a hacker that builds cool stuff anyway.

How to Become a Critical and Creative Thinker

So, how do you think we should evaluate new ideas? However appealing they might seem, they should be treated as 50/50, good/bad ab initio. Some people will tell you that’s being optimistic, as 9 out of 10 initially bright ideas turn out to be worthless. It would be prudent to expose your idea to scrutiny. Consult with someone or publish it online and read the comments, but remember to always take public commentary with a grain of salt.

Critical thinking is an unnatural act. We evolved to survive in a cruel world, not to play around with our hacks. To make things worse, we evolved in a herd, which means that we intuitively respect the authority of the leader. But we also have to be creative, so we have to respect ourselves first. Finding the right dose of self-respect is a crucial thing in creative work. Too little self-respect could destroy our motivation and creativity, and too much will interfere with our ability to estimate the value of our ideas, and can easily result in investing time, money and effort in worthless projects.

Noone is born a critical thinker, but almost anyone can become one. Think about what [Edward de Bono] said:

“The need to be right all the time is the biggest bar to new ideas. It is better to have enough ideas for some of them to be wrong than to be always right by having no ideas”.

Conference Badges are the Newest Form of Hardware Art

About four decades ago, many European truck drivers started placing electronic LED badges in their windshields. Most of them were simple; nothing more than an animated heart pierced by an arrow. It became a common distraction in the highway night panorama of that time, at least until it became illegal. Most motorists became accustomed to seeing them, and the idea of the truck drivers making a statement with electronics always stuck with me. Now I have the chance to help people make a similar statement. Conference badges are not just a way to identify those who have registered, but a fashion statement and a mark of pride for conference organizers. They’ve become an art form, and engineers always want to stretch the limits of what is possible.

Every September, we have BalCCon, an international hacker’s conference at Novi Sad, Serbia. I was asked to design a badge for the 2016 event, and this is the first (well, the second) release. It is based on the PIC18LF24K50 and consists of a circle of LEDs which randomly displays pre-defined patterns. Every badge has its own infrared transceiver (LED-receiver pair), so the fun begins when two or more badges spot each other: they go from Adagio to full on Rondo, losing their default, dull visual pattern for a more dynamic, attention grabbing one, but most importantly – they synchronize. This means that, in a group of people, all badges will play the same pattern in unison. Every badge can spread the pattern code, so the whole group, however large, soon becomes synchronized. But if one of them “gets lost” somehow, it will try to learn it back from a neighbor or it might even launch into its own, randomly generated one. Sometimes it manages to spread it further and you get to witness a battle for light show domination.

This isn’t merely a story of designing badges, but of design choices that come in on budget while achieving a look that will delight those who end up wearing the hardware.

Continue reading “Conference Badges are the Newest Form of Hardware Art”

Beating the Casino: There is No Free Lunch

When you are a hardware guy and you live in a time of crisis, sooner or later you find yourself working for some casino equipment company. You become an insider and learn a lot about their tricks. I’ve been in touch with that business for about 30 years. I made a lot of projects for gambling machines which are currently in use, and I had a lot of contact with casino people, both owners and gamblers.

Now I’m sure you expect of me to tell you about the tricks they use to make you spend your money. And I will: there are no technical tricks. This isn’t because they are honest people, but because they don’t need it. Mathematics and Psychology do all the work.

Does the risk of gambling pay off? Mathematically speaking, no – but it’s up to you to decide for yourself. One thing is for certain – whether you decide to gamble or not, it’s good to know how those casino machines work. Know thy enemy.

Continue reading “Beating the Casino: There is No Free Lunch”

Hacking the Digital and Social System

When you live in a totalitarian, controlled and “happy” society, and you want to be a hacker, you have to hack the social system first. Being just an engineer doesn’t cut it, you have to be a hypocrite, dissident and a smuggler at the same time. That’s the motto of my personal story, which starts in Yugoslavia, and ends in Serbia. No, I didn’t move, I’m still in Belgrade, only the political borders have changed.

Half a century ago, when I was in elementary school, I discovered the magical world of HAM radio. I became a member of two amateur radio clubs, passed all exams and got my licence and callsign, which was YU1OPC. I was delighted, but after five years, the party was over. What happened? Well, one day the police paid a visit to all registered owners of CB Band equipment and simply took that equipment away. No one knows why they did it, but it was probably off the books, as we never got any written confirmation, and no one ever saw their equipment again.

Continue reading “Hacking the Digital and Social System”