What Could Go Wrong: Asynchronous Serial Edition

It’s the easiest thing in the world — simple, straightforward serial data. It’s the fallback communication protocol for nearly every embedded system out there, and so it’s one that you really want to work when the chips are down. And yet! When you need it most, you may discover that even asynchronous serial can cost you a few hours of debugging time and add a few gray hairs to your scalp.

In this article, I’m going to cover most (all?) of the things that can go wrong with asynchronous serial protocols, and how to diagnose and debug this most useful of data transfer methods. The goal is to make you aware enough of what can go wrong that when it does, you’ll troubleshoot it systematically in a few minutes instead of wasting a few hours.

Continue reading “What Could Go Wrong: Asynchronous Serial Edition”

Gawking Text Files

Some tools in a toolbox are versatile. You can use a screwdriver as a pry bar to open a paint can, for example. I’ve even hammered a tack in with a screwdriver handle even though you probably shouldn’t. But a chainsaw isn’t that versatile. It only cuts. But man does it cut!

aukAWK is a chainsaw for processing text files line-by-line (and the GNU version is known as GAWK). That’s a pretty common case. It is even more common if you produce a text file from a spreadsheet or work with other kinds of text files. AWK has some serious limitations, but so do chainsaws. They are still super useful. Although AWK sounds like a penguin-like bird (see right), that’s an auk. Sounds the same, but spelled differently. AWK is actually an acronym of the original author’s names.

If you know C and you grok regular expressions, then you can learn AWK in about 5 minutes. If you only know C, go read up on regular expressions and come back. Five minutes later you will know AWK. If you are running Linux, you probably already have GAWK installed and can run it using the alias awk. If you are running Windows, you might consider installing Cygwin, although there are pure Windows versions available. If you just want to play in a browser, try webawk.

Continue reading “Gawking Text Files”

Capacitors Made Easy The Hackaday Way

If you build electronic circuits on a regular basis the chances are you will have used capacitors many times. They are a standard component along with the resistor whose values are lifted off the shelf without a second thought. We use them for power supply smoothing and decoupling, DC blocking, timing circuits, and many more applications.

Different capacitor applications. By Elcap (Own work) [CC0], via Wikimedia Commons
Different capacitor applications. By Elcap (Own work) [CC0], via Wikimedia Commons
A capacitor though is not simply a blob with two wires emerging from it and a couple of parameters: working voltage and capacitance. There is a huge array of capacitor technologies and materials with different properties. And while almost any capacitor with the right value can do the job in most cases, you’ll find that knowing more about these different devices can help you make something that doesn’t just do the job, but does the best possible job. If you’ve ever had to chase a thermal stability problem or seek out the source of those extra dBs of noise for example you will appreciate this.

Continue reading “Capacitors Made Easy The Hackaday Way”

Hacker’s Toolbox: The Handheld Screw Driver

The handheld screw driver is a wonderful tool. We’re often tempted to reach for its beefier replacement, the power drill/driver. But the manually operated screw driver has an extremely direct feedback mechanism; the only person to blame when the screw strips or is over-torqued is you. This is a near-perfect tool and when you pull the right screwdriver from the stone you will truly be the ruler of the fastener universe.

A Bit of Screw Driver History:

The kind of fun you can have with really cheap bits.
The kind of fun you can have with really cheap bits.

In order to buy a good set of screw drivers, it is important to understand the pros and cons of the geometry behind it. With a bit of understanding, it’s possible to look at a screw driver and tell if it was built to turn screws or if it was built to sell cheap.

Screw heads were initially all slotted. This isn’t 100 percent historically accurate, but when it comes to understanding why the set at the big box store contains the drivers it does, it helps. (There were a lot of square headed screws back in the day, we still use them, but not as much.)

Believe it or not the "Robertson" screw came out before the phillips. Robertson just hated money and didn't want to license his patents. So it's only now that they're in common use again.
Believe it or not the “Robertson” screw came out before the Phillips. Robertson just hated money and didn’t want to license his patents. So it’s only now that they’re in common use again.

Flat head screws could be made with a slitting saw, hack saw, or file. The flat-head screw, at the time, was the cheapest to make and had pretty good torque transfer capabilities. It also needed hand alignment, a careful operator, and would almost certainly strip out and destroy itself when used with a power tool.

These shortcomings along with the arrival of the industrial age brought along many inventions from necessity, the most popular being the Phillips screw head. There were a lot of simultaneous invention going on, and it’s not clear who the first to invent was, or who stole what from who. However, the Philips screw let people on assembly lines turn a screw by hand or with a power tool and succeed most of the time. It had some huge downsides, for example, it would cam out really easily. This was not an original design intent, but the Phillips company said, “to hell with it!” and marketed it as a feature to prevent over-torquing anyway.

The traditional flathead and the Phillips won over pretty much everyone everywhere. Globally, there were some variations on the concept. For example, the Japanese use JST standard or Posidriv screws instead of Philips. These do not cam out and let the user destroy a screw if they desire. Which might show a cultural difference in thinking. That aside, it means that most of the screws intended for a user to turn with a screw driver are going to be flat-headed or Philips regardless of how awful flat headed screws or Philips screws are.

Continue reading “Hacker’s Toolbox: The Handheld Screw Driver”

Linux: Assembly Required

Sometimes you might need to use assembly sometime to reach your project objectives. Previously I’ve focused more on embedding assembly within gcc or another compiler. But just like some people want to hunt with a bow, or make bread by hand, or do many other things that are no longer absolutely necessary, some people like writing in assembly language.

In the old days of DOS, it was fairly easy to write in assembly language. Good thing, because on the restricted resources available on those machines it might have been the only way to get things to fit. These days, under Windows or Linux or even on a Raspberry Pi, it is hard to get oriented on how to get an assembly language off the ground.

Continue reading “Linux: Assembly Required”

Review: Monoprice MP Select Mini 3D Printer

2016 is the year of the consumer 3D printer. Yes, the hype over 3D printing has died down since 2012. There were too many 3D printers at Maker Faire three years ago. Nevertheless, sales of 3D printers have never been stronger, the industry is growing, and the low-end machines are getting very, very good.

Printers are also getting cheap. At CES last January, Monoprice, the same company you buy Ethernet and HDMI cables from, introduced a line of 3D printers that would be released this year. While the $300 resin-based printer has been canned, Monoprice has released their MP Select Mini 3D printer for $200. This printer appeared on Monoprice late last month.

My curiosity was worth more than $200, so Hackaday readers get a review of the MP Select Mini 3D printer. The bottom line? There are some problems with this printer, but nothing that wouldn’t be found in printers that cost three times as much. This is a game-changing machine, and proof 2016 is the year of the entry-level consumer 3D printer.

Continue reading “Review: Monoprice MP Select Mini 3D Printer”

3D Internal Structure For Better 3D Printed Objects

Makerbot is in the gutter, 3D Systems and Stratasys stock is only a shadow of their 2014 glory, but this is the best year 3D printing has ever had. Machines are now good and cheap, there’s a variety of various thermoplastic filaments, and printing useful objects – instead of just plastic trinkets – is becoming commonplace.

Gradient-Grid
The standard rectilinear infill from Slic3r

There’s one area of 3D printing that hasn’t seen as much progress, and it’s the software stack. Slicing, the process of turning a 3D object into a Gcode file for a printer has been basically the same for the last few years. Dual extrusion is still a mess, and automated bed leveling is still in its infancy.

One aspect of slicing that has been severely overlooked is infill. Obviously, you don’t want to print plastic trinkets completely solid – only the outside surface matters, and a part with 100% infill is just a waste of plastic. Different slicers have come up with different ways of filling the inside of a print, usually with a grid of squares, triangles, or hexagons.

While the most popular methods of filling in a 3D printed objects do the job of adding a little bit of strength to a print and supporting the top layers of a print, it’s not an ideal solution. The desired strength of the finished part is never taken into account, print artifacts are sometimes visible through the side of a print, and the spacing of the infill grid is completely arbitrary. You can only set a percentage of infill, and telling a slicer to make an internal support grid with 10mm spacing is impossible.

Type A Machines just changed all of this. With the release of their public beta of Cura Type A, the infill for a 3D printed part is also 3D. The dimensions of the infill are predictable, opening the door to stronger and better looking parts.

From the Type A press literature and white paper, this new type of ‘infill’ isn’t; it’s more properly referred to as ‘internal structure’, with proper dimensions between infill features. Instead of a grid of squares or triangles stacked one layer on top of each other, it’s a true structure, with the infill following the perimeter of the 3D printed object.

Generating 3D Infill

3D
Infill generated from Type A Machine’s Cura beta. Note the 3D structure of the infill.

Right now, infill is generated in a slicer by specifying a percentage. Zero percent infill means a hollow object, and 100% infill is a completely solid part. These two edge cases are easy, but anything else means the slicer must fill the part with filament in a grid of tessellating shapes, either rectangles, triangles, or hexagons. With current slicers, the dimensions of this internal structure are, for all practical purposes, random. Printing an object with 20% infill might mean a grid of squares with 5mm or 2mm spacing. Telling the slicer to infill a part with a grid of squares spaced 10mm apart is impossible.

Type A Machine’s latest Cura release changes all of this, allowing a designer to set a precise distance between rows and columns of infill. By defining infill in absolute dimensions, this allows for stronger parts using less infill.

Absolute dimensioning is only one feature of the Type A Machine’s latest release of Cura. Even more exciting is the development of 3D internal structure. Instead of stacking layers of squares, triangles, or hexagons on top of each other, Type A Machine’s Cura uses an infill of cubes turned on their side. While each individual layer of infill looks like a series of triangles and irregular hexagons, when assembled into a printed 3D object, this infill forms a true 3D structure.

The closest comparison to this sort of structure is the difference between graphite and diamond. Both of these materials are made out of the same element, carbon. The physical structure of graphite is just, 1-atom-thick layers of graphene, producing a relatively weak material. Diamond, on the other hand, has a true 3D structure and is one of the hardest materials known to man. While adding 3D structure to the infill of 3D printed objects won’t make the objects any stronger, it will drastically reduce delamination, and be much more resistant to stresses in all three dimensions.

While Type A Machines has done some great work here, it does mean there’s yet another version of Cura to deal with. Type A Machine’s Cura, in addition to the LulzBot edition and the original are now the defacto standard for turning 3D objects into printed parts. Having an open source solution is great, but forking the development this much surely can’t be ideal.