It is easy to dismiss bash — the typical Linux shell program — as just a command prompt that allows scripting. Bash, however, is a full-blown programming language. I wouldn’t presume to tell you that it is as fast as a compiled C program, but that’s not why it exists. While a lot of people use shell scripts as an analog to a batch file in MSDOS, it can do so much more than that. Contrary to what you might think after a casual glance, it is entirely possible to write scripts that are reliable and robust enough to use in many embedded systems on a Raspberry Pi or similar computer.
I say that because sometimes bash gets a bad reputation. For one thing, it emphasizes ease-of-use. So while it has features that can promote making a robust script, you have to know to turn those features on. Another issue is that a lot of the functionality you’ll use in writing a bash script doesn’t come from bash, it comes from Linux commands (or whatever environment you are using; I’m going to assume some Linux distribution). If those programs do bad things, that isn’t a problem specific to bash.
One other limiting issue to bash is that many people (and I’m one of them) tend to write scripts using constructs that are compatible with older shells. Often times bash can do things better or neater, but we still use the older ways. For example:
Delve into the mysterious world of tabletop roleplaying games. Warhammer Fantasy Roleplay, Shadowrun, Pathfinder, Ars Magica, Vampire, whatever gets your dice rollin’ — metaphorically in the case of a diceless system. This might very well be your daddy’s D&D. If you’re not a gamer, you’re certainly familiar with the concept. People sit around a table pretending to have an epic adventure, often adding a random element with the help of dice. A map is often displayed on the table, sized for figures that show the various heroes and villains.
As a person with access to a variety of CNC machines I find myself wanting to create things to make gameplay more fun. I want to build a scale castle and have a siege. I want to conduct a ship-to-ship battle with wooden ships built to scale. But I also think smaller. What is something I could make that would help us every day? Say, a box for dice. Not every project needs to be the dragon’s lair.
It turns out a lot of other folks have been thinking about the same thing.
One of the things that makes Linux and Unix-like systems both powerful and frustrating is that there are many ways to accomplish any particular goal. Take something simple like running a bunch of commands in sequence as an example. The obvious way is to write a shell script which offers a tremendous amount of flexibility. But what if you just want some set of commands to run? It sounds simple, but there are a lot of ways to issue a sequence of commands ranging from just typing them in, to scheduling them, to monitoring them the way a mainframe computer might monitor batch jobs.
Let’s jump in and take a look at a few ways you can execute sequences from bash (and many other Linux shells). This is cover the cron and at commands along with a batch processing system called task spooler. Like most things in Linux, this isn’t even close to a complete list, but it should give you some ideas on ways to control sequences of execution.
OpenSCAD is a great way to create objects for 3D printing (or other purposes), especially if you are already used to programming. For things like front panels, it is great because you can easily make modifications and — if you wrote your code correctly–everything will just adjust itself to new positions.
However, what if you have a general-purpose piece of code, and you want people to have the ability to customize it? For example, consider this code:
For reasons that will remain undisclosed until some time in the future, I recently had a need to panelize a few PCBs. Panelization is the art of taking PCB designs you already have, whether they’re KiCad board files, Eagle board files, or just Gerbers, and turning them into a single collection of PCBs that can be sent off to a fab house.
If you’re still wondering what this means, take a look at the last board you got from OSH Park, Seeed, Itead, or Dirty PCBs. Around the perimeter of your board, you’ll find some rough spots. These are ‘mouse bites’ and tabs, places where the boards are strung together to form a gigantic rectangular panel sent off to a manufacturer. You can check out this great interview with [Laen] from OSH Park to get an idea of how this works, but the basic process is to take a bunch of Gerbers, add tabs and mouse bites, solve the knapsack problem, and send the completed panel off to a board house.
Panelizing boards is something most of us won’t have to do often. Really, you only want a panel of boards when you’re manufacturing something. For small-scale production and prototypes, bare boards will do just fine. Simply by virtue of the fact that panelizing boards is far less common than throwing some Gerbers at OSH Park or Seeed, there aren’t many (good) tutorials, and even fewer (good) tools to do so. This is how you panelize boards quickly and easily using Open Source tools.
I created a prototype 3D printer filament alarm that worked, but the process also brought some new problems and issues to the surface that I hadn’t foreseen when I first started. Today I’m going to dive further into the prototyping process to gain some insight on designing for a well-specified problem. What I came up with is an easy to build pendant that passively hangs from the filament and alerts you if anything about that changes.
I began with a need to know when my 3D printer was out of filament, so that I could drop whatever I was doing and insert a new spool of filament right up against the end of the previous spool. By doing this within four minutes of the filament running out, printing very large jobs could continue uninterrupted. The device I designed was called Mister Screamer.
Google’s voice assistant has been around for a while now and when Amazon released its Alexa API and ported the PaaS Cloud code to the Raspberry Pi 2 it was just a matter of time before everyone else jumped on the fast train to maker kingdom. Google just did it in style.
Few know that the Google Assistant API for the Raspberry Pi 3 has been out there for some time now but when they decided to give away a free kit with the May 2017 issues of MagPi magazine, they made an impression on everyone. Unfortunately the world has more makers and hackers and the number of copies of the magazine are limited.
In this writeup, I layout the DIY version of the AIY kit for everyone else who wants to talk to a cardboard box. I take a closer look at the free kit, take it apart, put it together and replace it with DIY magic. To make things more convenient, I also designed an enclosure that you can 3D print to complete the kit. Lets get started.