Logic gates are the bricks and mortar of digital electronics, implementing a logical operation on one or more binary inputs to produce a single output. These operations are what make all computations possible in every device you own, whether it is your cell phone, computer, gaming console etc. There are myriad ways of implementing logic gates; mechanically, electronically, virtually (think Minecraft), etc. Let’s take a look at what it takes to create some fun, out-of-the-ordinary gate implementations.
In the early years of the nineteenth century, steam engines were at work in a variety of practical uses. However, they were still imperfect in many ways. One particular problem were the boilers, that had a tendency to explode, causing injuries and fatalities. Reverend Dr. Robert Stirling, a Scottish clergyman, was concerned about the death toll from exploding boilers. Based on previous work by George Cayley (known for his pioneering work on aeronautics), Stirling filed his patent for a safer engine in 1816. That makes this year the bicentenary of this engine. The Stirling engine has the highest theoretical efficiency of any thermal engine. It is also a relatively simple machine. Unlike other types of engines, there are no valves, and that makes the mechanical design much simpler.
Hackaday reader [nats.fr] wrote in with some code from a project that resizes a video stream on the fly using an FPGA. Doing this right means undoing whatever gamma correction has been applied to the original stream, resizing, and then re-applying the gamma. Making life simpler, [nats.fr] settled on a gamma of two, which means taking a bunch of square roots, which isn’t fast on an FPGA.
[nats]’s algorithm is pretty neat: it uses a first-stage lookup to figure out in which broad range the value lies, and then one step of Hero’s algorithm to refine from there. (We think this is equivalent to saying he does a piecewise linear interpolation, but we’re not 100% sure.) Anyway, it works decently.
Of course, when you start looking into the abyss that is special function calculation, you risk falling in. Wikipedia lists more methods of calculating square roots than we have fingers. One of them, CORDIC, avoids even using multiplication by resorting to clever bitshifts and a lookup table. Our go-to in these type of situations, Chebyshev polynomial approximation, didn’t even make the cut. (Although we suspect it would be a contender in the gamma=1.8 or gamma=2.2 cases, especially if combined with range-reduction in a first stage like [nats.fr] does.)
So what’s the best/fastest approximation for sqrt(x) for 16-bit integers on an FPGA? [nats.fr] is using a Spartan 6, so you can use a multiplier, but division is probably best avoided. What about arbitrary, possibly fractional, roots?
San Francisco’s Millennium Tower is sinking. Since its completion in 2009, the 58-story, 645-foot tall residential building has settled 16 inches and tilted perhaps 2 inches to the northwest. Since the foundation issues came to light in August 2016, the vertiginous ultra-luxury highrise has become the subject of outrage, ridicule, and at least two pieces of pending litigation.
Nothing that we build is static. Our office towers, apartment complexes, and single family homes move in response to loads applied by the environment. Buildings sway in the wind, expand and contract in response to temperature changes, and shift with the land upon which they rest. In most scenarios, these deflections are so minuscule that the occupants never even notice. Millennium Tower happens to be a large enough project with a severe enough problem that the whole world can’t help but gawk.
In foundation design, not all terra is firma. While a one or two story wood-framed building can be built safely with a shallow foundation on crummy soil, a major skyscraper requires a foundation that can transfer extremely high loads into the earth. But the strata below our city streets can consist of anything from sand to clay to solid rock, and many cities, including San Francisco, have infilled former marshes and bays with soil in order to expand their coastlines and generate valuable real estate. Millennium Tower was built in South of Market, a neighborhood that mostly used to belong to San Francisco Bay.
When you’re living out of a vehicle, or even just traveling out of one, power quickly becomes a big concern. You need it for lights, to charge your various devices, to run your coffee maker and other appliances, and possibly even to store your food if you’ve got an electric refrigerator. You could do what many RV owners do: rely on campgrounds with electrical hookups plus a couple of car batteries to get you from one campground to the next. But, those campgrounds are pricey and often amount to glorified parking lots. Wouldn’t it be better if you had the freedom to camp anywhere, without having to worry about finding somewhere to plug in?
That’s exactly what we’re going to be covering in this article: off-grid power on the road. There are two major methods for doing this: with a portable gas generator, or with solar. Gas generators have long been the preferred method, as they provide a large amount of power reliably. However, they’re also fairly expensive, cumbersome, noisy, and obviously require that you bring along fuel. Luckily, major advances in solar technology over the past decade have made it very practical to use solar energy as your sole source of electricity on the road.
Wouldn’t it be great if there were just one standard for attaching to, programming, and debugging hardware? If you could just plug in and everything would just work? Dream on, dreamer! But of course we hobbyists aren’t the only people to suffer from multiple standards. Industry has the same problems, writ large. In response to the proliferation of smart devices — microcontrollers, sensors, and their friends — on any given PCB makes it difficult to test them all, much less their function as a system.
The Joint Test Action Group (JTAG) got together in the mid-80s to make automated testing of circuit boards a standardized process. A JTAG port can be found on almost any piece of consumer electronics with enough brains to warrant it, and it’s also a tremendously useful entry point for debugging your own work and hacking into other’s. You’re going to need to use JTAG someday.
Implemented right, it’s a very cool system that lets you test any compliant IC on the board all from a single connector. It’s mostly used by hackers for its ability to run and halt individual processors, and put them in debugging modes, inspecting their memory states, etc. Essentially every microcontroller responds to JTAG commands, and it’s an incredibly widespread and powerful standard. A victory for rationality and standardization!
The connector pinout was, of course, left up to the manufacturer. The horror!
Five Signals
In principle, JTAG uses five signal lines. They form a chain starting at the debugger, where one device’s output is the next device’s input, until the result is returned back to the debugger.
At this point, the internet is crawling with butt-kicking homebrew 3D printers made with extruded profiles, but it’s easy to underestimate the difficulty in getting there. Sure, most vendors sell a suite of interlocking connectors, but how well do these structural framing systems actually fare when put to the task of handling a build with sub-millimeter tolerances?
I’ve been playing around with these parts for about two years. What I’ve found is that, yes, precise and accurate results are possible. Nevertheless, those results came to me after I failed and–dry, rinse, repeat–failed again! Only after I understood the limits of both the materials and assembly processes was I able to deliver square, dimensionally accurate gantries that could carry a laser beam around a half-square-meter workbed. That said, I wrote a quick guide to taming these beasts. Who are they? What flavors do they come in? How do we achieve those precision results? Dear reader, read on.