So in the sort of tutorial I wrote about ORC-KIT I mentioned that it was possible to use other boards instead of Adafruit’s friendly motor shield, and in fact, there was space in the board for a couple of very cheap and widely available L9110S Dual H-Bridges, which should give you more control over the build, and “free” some precious Arduino pins that you can use for extra sensors and actuators. You can actually change the Arduino for something else, but that’s beyond the scope of this post.
H-Bridges are simple circuits that allow you to control the flow of current through a “load” with 2 control signals (A and B). When the load is a motor, you can make it spin forward, reverse or stop completely by changing the digital values on A and B. H-Bridges normally have an ENABLE line as well, which you can toggle yourself or leave permanently “ON”. Controlling the speed of the motors is easier if you can turn each bridge on and off quickly using PWM pulses applied to the enable lines, but that’s not always possible. The L9110S boards don’t have an enable pin, for instance, so we will need to manipulate only the 2 basic control signals to drive our motors if we use this controller.
Each of these Dual H-Bridge modules can drive 2 motors and has a 6 pin header for the 4 control signals plus power.
You may remember the small soldering fume extractor I designed a while ago. It has worked really well since I built it, and it’s made my soldering work a much more pleasant experience.
However, during the time I’ve been using it, I’ve discovered a small aspect that could definitely be improved. Because of the way it works, when the fan start working it “sucks” the carbon filter a bit towards the blades. As the distance between the filter and the fan blades is no more than 2mm and the filter itself is not rigid, the carbon surface “bends” and touches the spinning fan, which causes the blades to pull and cut fibers from the filter. You can actually hear this happening when you turn the unit on with a reasonably new filter.
This stops after some uses, as the filter becomes thinner and less dense from all the fibers it has lost. This doesn’t prevent the extractor from working, but it certainly reduces both the efficiency and the lifespan of the filter.
To solve this I designed a small plastic “grill” that would hold the carbon filter in place, separating it from the fan.
Carbon filter holder for my soldering fume extractor.
Earlier this year I embarked on the journey of designing a simple but expandable robot that any electronics enthusiast could build. I knew several nice kits from brands like Lego, Makeblock, OWI Robotics, etc, but I considered them to be normally either too expensive or too simple and limited. There are also many generic unbranded kits on eBay which suspiciously have all pretty much the same design but vary mostly in their debatable choices for hardware and layout.
I wanted to do something flexible but not too expensive nor flashy, much like the unbranded kits, but with better design practices in mind, and engineered to be heavily customizable.
Fully assembled Vanilla ORC-KIT with some extras.
Continuing from my previous post on randomness, I’d like to talk about non-uniform distributions, which certainly don’t get all the love they deserve. When people talk or think about randomness in games, they commonly think about fair distributions. And I know we spent a lot of time in Part 1 actually trying to achieve perfect uniformity because it brings “fairness” to games, but in reality, there are cases where you don’t want your random events to be ruled by a “fair” distribution at all.
Reality Check #4: Sometimes uniformity is bad
Fun fact: For a lot of “random” events in nature, every possible outcome rarely has the same chance of occurring, so perhaps trying to achieve that uniformity in games could be a mistake to begin with.
Let’s take rabbits for instance.
If you observe the population of rabbits of a given area, you’ll notice that they’ll have a”typical average size”. Let’s call that size X. You’ll find that most rabbits in the area will be around that size. There will be a rare few that are either considerably smaller than X or considerable bigger (outliers), but for the most of it, rabbits will be “just around” X in size. Same goes for any other quantifiable trait that depends on enough factors to be considered random.
They will most-likely follow what is called a Normal (or Gaussian) distribution, which is said to appear in nature all the time. The function that defines this distribution is also called the Gaussian Bell, due to the shape of the curve.
DISCLAIMER: This is a rather long post on the topic of random numbers, so …uh, sorry for that.
I want to talk about a couple of interesting things related to randomness and its many nuisances especially when applied to games. But before we get to that I guess I’ll introduce the basic notions for those of you who are not familiar with this whole thing. You can skip the first two sections if you know what a PRNG is, and how it works.
What is Random
Random is commonly defined as “unpredictable“. In general, when we are unable to find a pattern that would allow us to anticipate the outcome or occurrence of an event, we call it “unpredictable” and there’s a chance we will consider the event “random”.
You’ll also hear of “true randomness”, and things like natural atmospheric noise, lightning bolts, or particles falling from the space being used as sources and examples of it. But while we can’t currently predict when and where lightning will hit, events in the universe like electric discharges in clouds are most likely just a massively complicated function of a number of different factors, and not really something that happens with no rhyme or reason. It’s quite possible that if we were able to simulate each particle and sub-particle inside a group of storm clouds and their relevant vicinity, lightning would be trivial to anticipate with accuracy. This makes its “unpredictability” debatable, I guess.
Having said that, let’s not forget that “predictable” and “unpredictable” are relative to an “observer”. What we consider true random events could totally have a logic behind, but what matters is that from our -and our system’s- point of view, they are impossible to predict, and if the machine (or person) is unable to anticipate the occurrence of an event, the definition applies, regardless of the event’s “actual” predictability.
Not long ago I purchased a few 320×240 touchscreen displays from ebay that looked pretty decent and were also fairly cheap. They conform to the Arduino shield form-factor, so they snap directly onto any standard Arduino board, making them really easy to test and use. They also have an integrated microSD slot (connected to the same bus used by the display controller) which is a nice touch and widens the number of possible applications for these modules.
As seen on literally every eBay listing that sells them.
Of course the displays didn’t come with any code, and the most reasonable thing you’ll find online to make them work is Adafruit’s TFT-LCD Library, which includes support for a number of different controllers, and is fully compatible with their very own and versatile GFX framework.
I used to have a small desk clock that I purchased for a trip. It was cheap but it had some really nice features that I quite liked. It had large digits that I could see from my bed each morning, and it was also able to measure and display the current room temperature, which I always thought was incredibly cool for a clock.
The problem is, that it required a lot of batteries to work; 4XAAA for the fancy LCD backlight and soothing RGB glowing action, and 2xLR66 (button cells) for keeping the thing ticking and actually displaying time and temperature on its LCD screen. It worked reasonably well, but it was running through the batteries way too fast, in my opinion.
I didn’t really care about the AAA batteries dying in a month, because I could always use rechargeable batteries there, but the small LR66 batteries were killing me. Replacing them each 5-6 months or less wasn’t really a pleasure, especially since it meant setting time, date and alarms all over again, every time.
So I adventured in the journey of building my own clock. My main objective was to keep the number of batteries low, while also having the nice features of my previous clock, like the big numbers and the temperature readings.
SPOILERS: This is what I ended up making. No, it’s not a bomb.
So in a previous post I’ve discussed how to communicate with a custom HID device using libhid and a Raspberry Pi running linux.
This post is a sort of sequel. I’ll talk about some of the issues and nuances I found when working on a more complex (but related) project; In this case a Composite USB Device that I had to implement on a PIC 18F4550 microcontroller.
I wanted to add a temperature sensor to a project I’m working on, and while I already had selected the perfect IC for the job, I decided to test a couple of other options I had, to see how they fare in comparison. I was originally going to compare only 3 sensors; the popular LM35, the not-so-popular LM335 and the kinda obscure TMP75, but as I started writing this post I remembered I got a Dallas DS18B20 as part of kit of sensors, so I added it to the mix to balance the digital-to-analog ratio of this comparison.
The original 3 sensors I was going to test.
If you have any experience with a soldering iron, or soldering electronic components in general, I’m sure it will come as no surprise for you that the “fumes” produced by the process are not exactly good for your health. They can be quite harmful in fact (** depends a bit on the chemical composition of the solder you use). Even if they weren’t, they are -at the very least– annoying as hell. They always find their way to your eyes and throat in the most unpleasant ways.
I discovered some time ago that a device specifically designed to cope with this issue existed, and it’s been in the market for a quite a long time. This unbelievable product of heaven-sent technology and engineering is unsurprisingly called Soldering Fume Extractor (I bet you didn’t see that coming) which is nothing but a pompous name for a small desktop fan with an active carbon filter.