A quick brush over the part with some sand paper and it quickly transforms from obviously plastic to metallic.

Learn Resin Casting Techniques: Cold Casting

Sometimes we need the look, feel, and weight of a metal part in a project, but not the metal itself. Maybe you’re going for that retro look. Maybe you’re restoring an old radio and you have one brass piece but not another. It’s possible to get a very metal like part without all of the expense and heat required in casting or the long hours in the metal fabrication shop.

Before investing in the materials for cold casting, it’s best to have practical expectations. A cold cast part will not take a high polish very well, but for brushed and satin it can be nearly indistinguishable from a cast part. The cold cast part will have a metal weight to it, but it clinks like ceramic. It will feel cool and transfers heat fairly well, but I don’t have numbers for you. Parts made with brass, copper, and iron dust will patina accordingly. If you want them to hold a bright shine they will need to be treated with shellac or an equivalent coating afterward; luckily the thermoset resins are usually pretty inert so any coating used on metal for the same purpose will do.

It is best to think of the material as behaving more or less like a glass filled nylon such as the kind used for the casing of a power tool. It will be stiff. It will flex a relatively short distance before crazing and then cracking at the stress points. It will be significantly stronger than a 3D printed part, weaker than a pure resin part, and depending on the metal; weaker than the metal it is meant to imitate.

Continue reading “Learn Resin Casting Techniques: Cold Casting”

Gawking Hex Files

Last time I talked about how to use AWK (or, more probably the GNU AWK known as GAWK) to process text files. You might be thinking: why did I care? Hardware hackers don’t need text files, right? Maybe they do. I want to talk about a few common cases where AWK can process things that are more up the hardware hacker’s alley.

The Simple: Data Logs

If you look around, a lot of data loggers and test instruments do produce text files. If you have a text file from your scope or a program like SIGROK, it is simple to slice and dice it with AWK. Your machines might not always put out nicely formatted text files. That’s what AWK is for.

AWK makes the default assumption that fields break on whitespace and end with line feeds. However, you can change those assumptions in lots of ways. You can set FS and RS to change the field separator and record separator, respectively. Usually, you’ll set this in the BEGIN action although you can also change it on the command line.

For example, suppose your test file uses semicolons between fields. No problem. Just set FS to “;” and you are ready to go. Setting FS to a newline will treat the entire line as a single field. Instead of delimited fields, you might also run into fixed-width fields. For a file like that, you can set FIELDWIDTHS.

If the records aren’t delimited, but a fixed length, things are a bit trickier. Some people use the Linux utility dd to break the file apart into lines by the number of bytes in each record. You can also set RS to a limited number of any character and then use the RT variable (see below) to find out what those characters were. There are other options and even ways to read multiple lines. The GAWK manual is your friend if you have these cases.

BEGIN { RS=".{10}"   # records are 10 characters
      }

   {
   $0=RT
   }

   {
   print $0  # do what you want here
   }

Once you have records and fields sorted, it is easy to do things like average values, detect values that are out of limit, and just about anything else you can think of.

Spreadsheet Data Logs

Some tools output spreadsheets. AWK isn’t great at handling spreadsheets directly. However, a spreadsheet can be saved as a CSV file and then AWK can chew those up easily. It is also an easy format to produce from an AWK file that you can then read into a spreadsheet. You can then easily produce nice graphs, if you don’t want to use GNUPlot.

Simplistically, setting FS to a comma will do the job. If all you have is numbers, this is probably enough. If you have strings, though, some programs put quotes around strings (that may contain commas or spaces). Some only put quotes around strings that have commas in them.

To work around this problem cleanly, AWK offers an alternate way to define fields. Normally, FS tells you what characters separate a field. However, you can set FPAT to define what a field looks like. In the case of CSV file, a field is any character other than a comma or a double quote and then anything up to the next double quote.

The manual has a good example:

BEGIN {
  FPAT = "([^,]+)|(\"[^\"]+\")"
  }

  {
  print "NF = ", NF
  for (i = 1; i <= NF; i++) {
  printf("$%d = <%s>\n", i, $i)
  }

This isn’t perfect. For example, escaped quotes don’t work right. Quoted text with new lines in it don’t either. The manual has some changes that remove quotes and handle empty fields, but the example above works for most common cases. Often the easiest approach is to change the delimiter in the source program to something unique, instead of a comma.

Hex Files

Another text file common in hardware circles is a hex file. That is a text file that represents the hex contents of a programmable memory (perhaps embedded in a microcontroller). There are two common formats: Intel hex files and Motorola S records. AWK can handle both, but we’ll focus on the Intel variant.

Old versions of AWK didn’t work well with hex input, so you’d have to resort to building arrays to convert hex digits to numbers. You still see that sometimes in old code or code that strives to be compatible. However, GNU AWK has the strtonum function that explicitly converts a string to a number and understands the 0x prefix. So a highly compatible two digit hex function looks like this (not including the code to initialize the hexdigit array):

function hex2dec(x) {
  return (hexdigit[substr(x,1,1)]*16)+hexdigit[substr(x,2,1)]
}

If you don’t mind requiring GAWK, it can look like this:

function hex2dec(x) {
  return strtonum("0x" x);
}

In fact, the last function is a little better (and misnamed) because it can handle any hex number regardless of length (up to whatever limit is in GAWK).

Hex output is simple since you have printf and the X format specifier is available. Below is an AWK script that chews through a hex file and provides a count of the entire file, plus shows a breakdown of the segments (that is, non-contiguous memory regions).

BEGIN { ct=0;
  adxpt=""
}


function hex4dec(y) {
  return strtonum("0x" y)
}


function hex2dec(x) {
  return strtonum("0x" x);
}

/:[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]00/ {

  ad = hex4dec(substr($0, 4, 4))
  if (ad != adxpt) {
  block[++n] = ad
  adxpt = ad;
    }
  l = hex2dec(substr($0, 2, 2))
  blockct[n] = blockct[n] + l
  adxpt = adxpt + l
  ct = ct + l
  }

END { printf("Count=%d (0x%04x) bytes\t%d (0x%04x) words\n\n", ct, ct, ct/2, ct/2)
  for (i = 1 ; i <= n ; i++) {
  printf("%04x: %d (0x%x) bytes\t", block[i], blockct[i], blockct[i])
  printf("%d (0x%x) words\n", blockct[i]/2, blockct[i]/2)
  }

}

This shows a few AWK features: the BEGIN action, user-defined functions, the use of named character classes (:xdigit: is a hex digit) and arrays (block and blockct use numeric indices even though they don’t have to). In the END action, the summary uses printf statements for both decimal and hex output.

Once you can parse a file like this, there are many things you could do with the resulting data. Here’s an example of some similar code that does a sanity check on hex files.

Binary Files

Text files are fine, but real hardware uses binary files that people (and AWK) can’t easily read, right? Well, maybe people, but AWK can read binary files in a few ways. You can use getline in the BEGIN part of the script and control how things are read directly. You can also use the RS/RT trick mentioned above to read a specific number of bytes. There are a few other AWK-only methods you can read about if you are interested.

However, the easiest way to deal with binary files in AWK is to convert them to text files using something like the od utility. This is a program available with Linux (or Cygwin, and probably other Windows toolkits) that converts a binary file to different readable formats. You probably want hex bytes, so that’s the -t x2 option (or use x4 for 16-bit words). However, the output is made for humans, not machines, so when a long run of the same output occurs, od omits them replacing all the missing lines with a single asterisk. For AWK use, you want to use the -v option to turn that behavior off. There are other options to change the output radix of the address, swap bytes, and more.

Here are a few lines from a random binary file:

0000000 d8ff e0ff 1000 464a 4649 0100 0001 0100
0000020 0100 0000 dbff 4300 5900 433d 434e 5938
0000040 484e 644e 595e 8569 90de 7a85 857a c2ff
0000060 a1cd ffde ffff ffff ffff ffff ffff ffff
0000100 ffff ffff ffff ffff ffff ffff ffff ffff
0000120 ffff ffff ffff ffff ffff 00db 0143 645e
0000140 8564 8575 90ff ff90 ffff ffff ffff ffff
0000160 ffff ffff ffff ffff ffff ffff ffff ffff
0000200 ffff ffff ffff ffff ffff ffff ffff ffff
0000220 ffff ffff ffff ffff ffff ffff ffff c0ff
0000240 1100 0108 02e0 0380 2201 0200 0111 1103
0000260 ff01 00c4 001f 0100 0105 0101 0101 0001
0000300 0000 0000 0000 0100 0302 0504 0706 0908
0000320 0b0a c4ff b500 0010 0102 0303 0402 0503
0000340 0405 0004 0100 017d 0302 0400 0511 2112
0000360 4131 1306 6151 2207 1471 8132 a191 2308

This is dead simple to parse with AWK. The address will be $1 and each field will be $2, $3, etc. You can just convert the file yourself, use a pipe in the shell, or–if you want a clean solution–have AWK run od as a subprocess. Since the input is text, all of AWK’s regular expression features still work, which is useful.

Writing binary files is easy, too, since printf can output nearly anything. An alternative is to use xxd instead of od. It can convert binary files to text, but also can do the reverse.

Full Languages

There’s an old saying that if all you have is a hammer, everything looks like a nail. I doubt that AWK is the best tool to build full languages, but it can be a component of some quick and dirty hacks. For example, the universal cross assembler uses AWK to transform assembly language files into an internal format the C preprocessor can handle

Since AWK can call out to external programs easily, it would be possible to write things that, for example, processed a text file of commands and used them to drive a robot arm. The regular expression matching makes text processing easy and external programs could actually handle the hardware interface.

awk-wolfensteinThink that’s far fetched? We’ve covered stranger AWK use cases, including a Wolfenstien-like game that uses 600 lines of AWK script (as seen to the right).

So, sure it is software, but it is a tool that has that Swiss Army knife quality that makes it a useful tool for software and hardware hackers alike. Of course, other tools like Perl, Python, and even C or C++ can do more. But often with a price in complexity and learning curve. AWK isn’t for every job, but when it works, it works well.

Fail Of The Week: How Not To Build Your Own Motorcycle

There’s a saying among writers that goes something like “Everyone has a novel in them, but in most cases that’s where it should stay”. Its source is the subject of some dispute, but it remains sage advice that wannabe authors should remember on dark and stormy nights.

It is possible that a similar saying could be constructed among hackers and makers: that every one of us has at least one motor vehicle within, held back only by the lack of available time, budget, and workshop space. And like the writers, within is probably where most of them should stay.

[TheFrostyman] might have had cause to heed such advice. For blessed with a workshop, a hundred dollars, and the free time of a 15-year-old, he’s built his first motorcycle. It’s a machine of which he seems inordinately proud, a hardtail with a stance somewhere closer to a café racer and powered by what looks like a clone of the ubiquitous Honda 50 engine.

Unfortunately for him, though the machine looks about as cool a ride as any 15-year-old could hope to own it could also serve as a textbook example of how not to build a safe motorcycle. In fact, we’d go further than that, it’s a deathtrap that we hope he takes a second look at and never ever rides. It’s worth running through some of its deficiencies not for a laugh at his expense but to gain some understanding of motorcycle design.

Continue reading “Fail Of The Week: How Not To Build Your Own Motorcycle”

Challenge Accepted: Automation

Today marks the beginning of the Automation Challenge round for the 2016 Hackaday Prize. We want to see what you can create that automates life. It’s a terrifically fun jumping off point for a project, and done just right, it can score you some amazing prizes.

Technology can make life better and automation is one place that is about to see huge expansion. This is a chance to put your mark on the future by envisioning, prototyping, and explaining your ideas. The animated image at the top of this post is a perfect example of how fun automation builds can be. It’s the part of the Sunday Morning Breakfast Machine which steeps the tea. We covered this Rube-Goldberg like device a few weeks ago. About 1,000 hours went into building a completely automated breakfast machine.

Building something whimsical is fine for entering this round — a lot of discovery happens when having fun with interesting ideas. But there is plenty of room for serious builds as well. Technological development has always included iterating on automation; asking and answering the question of how can we do more with less effort.

AutomationFor instance, you can boil coffee in a pot but then you have to use some filtering technique to sequester the grounds. You can use a French press but that this hasn’t saved you much effort. So someone invented the percolator but you still must watch that you don’t burn your brew. From there we have espresso machines and drip brewers that both regulate how much water is used and at what temperature (in addition to keeping the grounds separate). And now we’re seeing single-unit machines like Nespresso and Keurig which make everything a one-step process, if you’re happy with the pods they sell you. I like to refill my own pods, which lets me choose my own grind. I’d love to see someone automate this entire process of cleaning, grinding, filling and presenting a reusable pod. That would make a great entry and help move more people away from disposable plastic/metal.

All I see when I look around me are ways that life should be more automated, and I bet you have the same proclivity. Now you have a reason to take on the challenge. Automate something and enter it in the Hackaday Prize. Twenty of those entries will be awarded $1,000 and move on to vie for the grand prize of $150,000 and a residency at the Supplyframe Design Lab in Pasadena, plus four other huge top prizes.

The HackadayPrize2016 is Sponsored by:

3D Printering: Makerbot’s Class Action Suit Dismissed

This time last year, Stratasys, parent company of Makerbot, was implicated in a class action suit. Investors claimed Stratasys violated securities laws, and overstated both the performance of the 5th generation of Makerbot printers and the performance of the company itself. Court docs received by Adafruit have revealed this case has been dismissed with prejudice. Makerbot won this one.

The case presented by Stratasys investors relied on two obvious facts. First, the price of Stratasys shares fell far beyond expectations. Second, the extruder for the 5th generation of Makerbot printers – the ‘Smart Extruder’ – was terrible. No one can reasonably dispute these claims; shares of SYSS fell from $120 in September of 2014 to $30 in September of 2015. With many returns to handle, Makerbot quickly redesigned the Smart Extruder.

Both of these indisputable facts are in stark contrast to statements made by Stratasys and Makerbot at the time. In a press release for the 4th quarter 2013 financial results, Stratasys’ expected sales to grow at least 25% over 2013 and stated it was experiencing “strong sales” of its desktop 3D printer. Concerning the Smart Extruder, Makerbot stated this new feature of the 5th generation Makerbots would make them easy to use, and “define the new standard for quality and reliability.”

The facts of this case are not in dispute – Stratasys did not see the growth they expected in late 2013. The Smart Extruder certainly did not make printers more reliable. These facts, however, are not sufficient to violate securities law.  In a wonderful legal turn of phrase, the judge deciding this case called the statements about the quality of the 5th generation Makerbots consisted of, “non-actionable puffery,” and a ‘statement so vague and such obvious hyperbole than no reasonable investor would rely on them.’

Statements made by Stratasys on their financial performance were also found not to be sufficient to violate securities laws. Stratasys did make several statements about negative performance in late 2014 and 2015, and positive statements made earlier did not have an intent to deceive investors.

This is good news for Makerbot. The claims brought by investors in this case had little merit. The case cannot be appealed, and Stratasys is no longer facing a class action suit. Does this news actually matter? Not really; Makerbot is a dead man walking, and 2016 sales will be at levels not seen since 2010 or 2011.

The consumer 3D printing industry is booming, despite the Makerbot bellwether though.

Hacklet 115 – More Quick Tool Hacks

Some of the best hacks are the tools people make to help them complete a project. I last looked at quick tool hacks back in Hacklet 53. Hackers have been busy since then, and new projects have inspired new tools. This week on the Hacklet, I’m taking  a look at some of the best new quick tool hacks on Hackaday.io.

pickupWe start with [rawe] and aquarium pump vacuum pickup tool. Tweezers work great for resistors and caps, but once you start trying to place chips and other large parts, things quickly become frustrating. Commercial machines use high dollar vacuum pickup devices to hold parts. [rawe] built his own version using a cheap Chinese hand pickup tool and an aquarium pump. With some pumps, switching from air to vacuum is easy. Not with [rawe’s] pump. He had to break out the rotary tool and epoxy to make things work. The end result was worth it, a vacuum pickup tool for less than 10 Euro.

 

via1

Next we have [David Spinden] with ViaConnect Circuit Board Test Tool, his entry in the 2016 Hackaday Prize. [David] wanted a spring loaded pin which could be used in .100 holes in printed circuit boards. He ended up using pins from one connector, shell from another, and packaging the whole thing up into a new tool. ViaConnect essentially makes any PCB as easy to use as a solderless breadboard. No headers required. This is great both for testing new designs and for the education sector.

Allen tool holderNext up is our favorite quick tool hacker, [Alex Rich] with Improved Allen Wrench / Hex Key Holder. If [Alex] looks familiar, that’s because he’s the creator of the Stickvise. This time he’s come up with a new way to store and organize your Allen wrenches. Inspired by a similar device seen on a YouTube video from [Tom Lipton], [Alex] opened up his CAD software and started designing. The original used a steel spring to keep the wrenches in place. [Alex] switched the spring to a rubber o-ring. The o-ring securely holds the wrenches, but allows them to be easily pulled out for use. Of course the design is open source, so building your own is only a couple of hours of printing away!

 

 

solderdoodFinally we have [Solarcycle] with Cordless Foam Cutting Tool – USB Rechargeable. Soldering irons make a lot of heat in a small area to melt metal. Foam cutters make heat in a larger area to cut Styrofoam. [Solarcycle] saw the relation and converted a Solderdoodle Pro cordless soldering iron into a banjo style hot wire foam cutter. A barrel connector converts the soldering iron tip output to two stiff wires. The stiff wires carry current to a 3 cm length of Kanthal iron-chromium-aluminium (FeCrAl) heating element wire. If you don’t have any Kanthal around, ask your local vape enthusiast – they have tons of it. The result is the perfect hand-held tool for carving and sculpting in foam. Just make sure to have lots of ventilation.

If you want to see more of these hacks, check out our newly updated quick tool hacks list! See a project I might have missed? Don’t be shy, just drop me a message on Hackaday.io. That’s it for this week’s Hacklet, As always, see you next week. Same hack time, same hack channel, bringing you the best of Hackaday.io!