Open Exosuit Project Helps Physically Challenged Put One Foot in Front of Another

Humans make walking look simple, but of course that’s an illusion easily shattered by even small injuries. Losing the ability to walk has an enormous impact on every part of your day, so rehabilitative advances are nothing short of life-changing. The Open Exosuit for Differently Abled project is working feverishly on their Hackaday Prize entry to provide a few different layers of help in getting people back on their feet.

We’ve seen a number of exosuit projects in the past, and all of them struggle in a few common places. It’s difficult to incorporate intuitive user control into these builds, and quite important that they stay out of the way of the user’s own balance. This one approaches those issues with the use of a walker that both provides a means of steadying one’s self, and facilitates sending commands to the exosuit. Using the OLED screen and buttons incorporated on the walker, the user can select and control the walking, sitting, and standing modes.

The exoskeleton is meant to provide assistance to people with weakness or lack of control. They still walk and balance for themselves, but the hope is that these devices will be an aid at times when human caregivers are not available and the alternative would be unsteady mobility or complete loss of mobility. Working with the assistive device has the benefit of continuing to make progress in strengthening on the march to recovery.

The team is hard at work on the design, and with less than two weeks left before the entry deadline of the 2020 Hackaday Prize, we’re excited to see where the final push will bring this project!

source https://hackaday.com/2020/08/18/open-exosuit-project-helps-physically-challenged-put-one-foot-in-front-of-another/

Linux-Fu: One at a Time, Please! Critical Sections in Bash Scripts

You normally think of a critical section — that is, a piece of a program that excludes other programs from using a resource — as a pretty advanced technique. You certainly don’t often think of them as part of shell scripting but it turns out they are surprisingly useful for certain scripts. Most often, a critical section is protecting some system resource like a shared memory location, but there are cases where a shell script needs similar protection. Luckily, it is really easy to add critical sections to shell scripts, and I’ll show you how.

Sometimes Scripts Need to Be Selfish

One very common case is where you want a script to run exactly one time. If the same script runs again while the original is active, you want to exit after possibly printing a message. Another common case is when you are updating some file and you need undisturbed access while making the change.

That was actually the case that got me thinking about this. I have a script — may be the subject of a future Linux-Fu — that provides dynamic DNS by altering a configuration file for the DNS server. If two copies of the script run at the same time, it is important that only one of them does modifications. The second copy can run after the first is totally complete.

Atomic Files

The problem is one of atomicity. You could, for example, create a temporary file with an obscure name and make sure that the file doesn’t exist. But what if someone else checks at the same time? You both note the file isn’t there and then you both create the file thinking you are running alone. No good.

It turns out files are a possible answer, but the locking of a file using flock is the right way to do it. There are two general options here: call flock to execute a command for you and it will acquire the lock and release it when the command completes, or you can use flock in your own script to protect a block of code.

The Easy Case

The idea behind flock is that it will put a lock on a file. The file can be open for reading or writing — it doesn’t really matter. You can get a shared lock or — the default — ask for an exclusive lock. You can only get an exclusive lock if there are no other locks on the file.

What file do you use? It depends. For a script, sometimes it is worth using the script file itself as the lock. That certainly makes it unambiguous although if someone copies the script to a new name, lookout. Another answer is to use a temporary file. Most systems will have /var/lock directory for just this purpose.

Consider a case where you have a script that works with a file. One option to the script deletes the file, but you don’t want to do that if another instance of the file is using it at the time. You might do something like this:

flock "$0"  rm "$SHAREDFILE"

This gets an exclusive lock. Other parts of the script might look like this:

flock -s "$0" awk -f script.awk "$SHAREDFILE"

The -s means the lock is shared, so anyone else asking for a shared lock will get it, but the exclusive lock for the rm will block until the file — which in this case is the shell script itself — is unlocked.

Unblocking

Of course, sometimes you don’t want to wait forever. You can use the -n option to tell flock to not block. Or use -w to wait for a specified number of seconds (which does not have to be an integer). By default, if the lock doesn’t work, flock will return a 1, but you can change that by using -E to select a different code since the command you run may also return a 1 for some reason.

Critical Section Blocks

Sometimes you don’t want to run a single command. You want to lock up an entire portion of a script. You can do that, too. The flock command can take a numeric file descriptor. The file can be open for reading or writing, but it must exist. If you use the script file, that’s a sure bet that it exists, of course.

You can use all the same options for blocking and time outs and you have to open up a file descriptor using bash constructs. There are several ways to do that — and I’ve made a repo of examples which I’ll reference below — but I usually just use a redirect in a subshell. You can also use exec to get the same effect.

Have a look at this script. It is a bit contrived, but it prepares a log file and then calls itself twice to create two different entries in that log file. There’s no critical section protecting the log, so you’ll see after the script completes how the output from both subprocesses mix together.

You can use the easy method by just having flock lock the script file before calling the subprocesses. That’s the approach in cs.sh that you can see here. However, in a script like this it is usually more effective to use the block with a numeric file handle. Here’s the same example using that style of flock. The subprocesses look like this:

( flock 99 
echo Here is a log entry from A along with a directory of /etc >>"$LOGFILE"
ls /etc >>"$LOGFILE"
echo That is all from A >>"$LOGFILE" ) 99<"$LOCKFILE"
exit 0

Of course, this is a silly example. It would be just as easy in this case to run process A, wait for it to complete, and then run process B. But that’s not always the case and in a complex script, you may have work that both processes can execute in parallel, only waiting for specific critical sections. In that case, running the processes in series would be less efficient.

Singleton

A very common use case for the critical section block is to stop a script from running more that one instance at any given time.

#!/bin/bash
LOCKFILE="$0"
( if flock -n 99
then
  echo Running task
  sleep 20
  echo Done
  exit 0
else
  echo You can only run one copy of this script at a time!
  exit 1
fi ) 99<$LOCKFILE"

This pattern is useful if you have a program that you plan to run periodically using something like cron. You might run it every minute, but — on occasion — the program might take more than a minute to complete. A flock barrier can prevent a large number of copies from running all at once.

In all of these cases, the file closing automatically releases the lock, so you don’t have to explicitly let go of the lock. If you ever do need to release it early, the -u option is your friend.

A Few Notes

Turns out flock isn’t part of the POSIX standard, but it is pretty common. Before Linux kernel 2.6. 12, flock didn’t work correctly over NFS, either. If you use /var/lock or /tmp, those are very unlikely to be NFS mounted, anyway. If, for some reason, you are on a system without flock, mkdir is not assured to be atomic, but it usually is, so that could be another option since it also returns a status if it created a directory or not.

This locking technique is one of those things you won’t need every day. But when you do need it, it is invaluable.

The opposite of running things one at a time is running them in parallel. You normally don’t need to unlock a lock file, since flock takes care of that when the file closes, but if you want to be super defensive, maybe consider cleaning up anything that needs cleaning using a trap.

source https://hackaday.com/2020/08/18/linux-fu-one-at-a-time-please-critical-sections-in-bash-scripts/

New Contest: Circuit Sculpture Challenge

We’re bringing back one of our most popular contests, the Hackaday Circuit Sculpture Challenge! Make your functional circuits go beyond utility by turning them into art!

Solar-powered circuit sculpture by [Mohit Bhoite] which was featured last year.

Wire and circuit boards are a fantastic media for creating beautiful projects, and for this one we want both the copper and the boards (or lack of) to be part of the beauty. Your sculpture could be crisp and angular bends in brass rod, a rat’s nest of enamel wire, PCBs with organic shapes, or something completely wild. Your only constraint is that there needs to be some type of working circuit involved.

Three entries will be chosen as top winners in the Most Functional, Most Beautiful, and Best Video categories and be awarded $200 in components from Digi-Key who are sponsoring this contest and also putting together a calendar with images of the top twelve sculptures.

The Wonderlandscape by [Michael Aichlmayr] takes the “sculpture” part of Circuit Sculpture to new levels.

Tell us the story of your creation, including a deep dive into how you built the sculpture and what trial and error you went through to pull it off. Many circuit sculptures in the past have included jig-building to get the wire bends just right, so we have a fourth prize of $100 in Tindie credit for the Best Jig build.

Get your project started now on Hackaday.io and use that “Submit Project To:” button in the left sidebar of your project page to enter it in the Circuit Sculpture Challenge. You have until November 10th to submit your entry.

source https://hackaday.com/2020/08/18/new-contest-circuit-sculpture-challenge/

Get Your SQL Statements Right the First Time With SQL Lint

What’s your average success rate of getting a SQL statement right on the first try? In best case, you botched a simple statement without side effects and just have to try again with correct syntax or remove that typo from a table name, but things can easily go wrong fast here. But don’t worry, the days of fixing it on the fly can be over, thanks to [Joe Reynolds] who wrote a linter for SQL.

A linter parses code to tell you where you screwed up. While checking SQL syntax itself is somewhat straightforward, [Joe]’s sql-lint tool will also check the semantics of it by looking up the actual database and performing sanity checks on it. Currently supporting PostgreSQL and MySQL, it can be either run on a single SQL file or a directory of files, or take input directly from the command line. Even better, it also integrates within your editor of choice — assuming it supports external plugins — and the documentation shows how to do that specifically for Vim.

If you can look past the fact that it’s written in TypeScript and consequentially results in a rather large executable (~40 MB), it might serve as an interesting starting point for the language itself, or adds a new perspective on writing this type of analyzer. And if databases aren’t your terrain, how about shell scripts?

sql-lint in action
Example use of sql-lint

source https://hackaday.com/2020/08/18/get-your-sql-statements-right-the-first-time-with-sql-lint/

E3D Teaches Additive Machines How to Subtract

We might’ve thought that extrusion based 3D printers have hit their peak in performance capabilities. With the remaining process variables being tricky to model and control, there’s only so much we can expect on dimensional accuracy from extruded plastic processes. But what if we mixed machines, adding a second machining process to give the resulting part a machined quality finish? That’s exactly what the folks at E3D have been cooking up over the last few years: a toolchanging workflow that mixes milling and 3D printing into the same process to produce buttery smooth part finishes with tighter dimensional accuracy over merely 3D printing alone.

Dubbed ASMBL (Additive/Subtractive Machining By Layer), the process is actually the merging of two complimentary processes combined into one workflow to produce a single part. Here, vanilla 3D printing does the work of producing the part’s overall shape. But at the end of every layer, an endmill enters the workspace and trims down the imperfections of the perimeter with a light finishing pass while local suction pulls away the debris. This concept of mixing og coarse and fine manufacturing processes to produce parts quickly is a re-imagining of a tried-and-true industrial process called near-net-shape manufacturing. However, unlike the industrial process, which happens across separate machines on a large manufacturing facility, E3D’s ASMBL takes place in a single machine that can change tools automatically. The result is that you can kick off a process and then wander back a few hours (and a few hundred tool changes) later to a finished part with machined tolerances.

What are the benefits of such an odd complimentary concoction, you might ask? Well, for one, truly sharp outer corners, something that’s been evading 3D printer enthusiasts for years, are now possible. Layer lines on vertical surfaces all but disappear, and the dimensional tolerances of holes increases as the accuracy of the process is more tightly controlled (or cleaned up!) yielding parts that are more dimensionally accurate… in theory.

But there are certainly more avenues to explore with this mixed process setup, and that’s where you come in. ASMBL is still early in development, but E3D has taken generous steps to let you build on top of their work by posting their Fusion 360 CAM plugin, the bill-of-materials and model files for their milling tool, and even the STEP files for their toolchanging motion system online. Pushing for a future where 3d printers produce the finer details might just be a matter of participating.

It’s exciting to see the community of 3D printer designers continue to rethink the capabilities of its own infrastructure when folks start pushing the bounds beyond pushing plastic. From homebrew headchanging solutions that open opportunity by lowering the price point, to optical calibration software that makes machines smarter, to breakaway Sharpie-assisted support material, there’s no shortage of new ideas to play with in an ecosystem of mixed tools and processes.

Have a look at ASMBL at 2:29 in their preview after the break.

source https://hackaday.com/2020/08/18/e3d-teaches-additive-machines-how-to-subtract/

Fitting Snake Into a QR Code

QR codes are usually associated with ASCII text like URLs or serial numbers, but did you know you can also encode binary data into them? To demonstrate this concept, [MattKC] embarked on a journey to create a QR code that holds an executable version of Snake. Video after the break.

As you might expect, the version 40 QR code he ended up using is much larger than the ones you normally see. Consisting of a 171 by 171 grid, it’s the largest version that can still be read by most software. This gave [MattKC] a whopping 2,953 bytes to work with. Not a lot of space, but still bigger than some classic video games of the past.

To start, he first wrote Snake to run in a web browser using HTML, CSS, and JavaScript, which was able to fit in the available space. Modern browsers do a lot of the lifting with built-in features, and [MattKC] wanted more of a challenge, so he decided to instead create a Windows executable file. His first attempts with compiled C code were too large, which led down the rabbit trail of x86 Assembly. Here he found that his knowledge of Assembly was too limited to create a small enough program without investing months into the project. He went back to C and managed to compress his executable using Crinkler, a compressing linker commonly used in the demoscene. This shrunk the file down to 1,478 bytes.

Zbar, a command-line barcode reader for Windows was used to test the final Snake QR code. [MattKC] discovered a bug in Zbarcam that prevented it from reading binary data via a webcam input, so through the power of open source, he submitted a bug fix which is now integrated into the official release.

All the files are available for anyone to play with on [MattKC]’s website. The video below goes into a lot of detail on the entire journey. Since this project proves software can be embedded in QR codes, it means that malware could also be hidden in a QR code, if there is an exploitable bug somewhere in a smartphone QR reader app.

QR codes are a interesting tool with a variety of uses. Take a deep dive into how they work, generate a 3D printable version, or build a QR jukebox, if you want to learn more.

source https://hackaday.com/2020/08/17/fitting-snake-into-a-qr-code/

Simple MP3 Player Hides Home Automation Brilliance

Like bubble wrap or the corkscrew, plenty of everyday objects have lost almost all ties to their original purpose. It could be that the original product had no market but was able to find one in an unexpected place, or simply that the original use case disappeared. We think that this MP3 player for children might arrive at a similar fate as a home automation controller thanks to a recent project by [Sebastian].

The MP3 player is known as a Jooki and works by using small figurines (and a few buttons) to control the device. Different figurines cause the MP3 player to change playlists, for example, but it turns out that the device is capable of communicating over MQTT. This means that [Sebastian] was able to use the MQTT messages from the Jooki to do all kinds of things beyond its intended use with openHAB, an open-source home automation system, such as dimming the lights and closing the blinds when he puts his son to bed.

This platform has considerable potential for hacking thanks to the lightweight communications system it uses under the hood. The Jooki is a little pricey, but if you happen to have one around, it’s an impressive tool that can go well beyond its original intended use.

source https://hackaday.com/2020/08/17/simple-mp3-player-hides-home-automation-brilliance/

Something’s Brewing Up In The Woods – And It Looks Stunning

Caffeine fuels the hacker, and there are plenty of options to get it into your system, from guzzling energy drinks to chewing instant coffee pellets. But let’s take a nice cup of coffee as input source, which itself can be prepared in many ways using all kinds of techniques. In its simplest form, you won’t need any fancy equipment or even electricity, just heat up some water over a fire and add your ground beans to it. This comes in handy if you’re camping out in the woods or find yourself in a post-apocalyptic world, and in case you still prefer a stylish coffee maker in such a situation — why let an apocalypse ruin having nice things? — you’re in luck, because [Andreas Herz] designed this nifty looking off-the-grid coffee maker.

The design somewhat resembles a certain high-end precision coffee maker that even fictional billionaires approve of, which [Andreas] created in Fusion 360 and is available online. The device base is made from brass, wood, and silicone he cast from a 3D printed mold, while the glass and ceramic parts — i.e. the water tank and coffee pot — are simply store bought. [Andreas] opted for fuel gel as heat source, which burns under a copper coil that acts as heat exchanger and starts the actual brewing process. It took him a few attempts to get it right, and in the end, a coat of black exhaust paint did the trick to get the temperatures high enough.

This may not be the fastest coffee maker, as you will see in the video after the break, but choosing a different fuel source might fix that — [Andreas] just went the safe(r) way by using fuel gel here. But hey, why rush things when you’re camping or having a cozy time in a cabin anyway. Now all you need is the right blend, maybe even your own, made with a camp stove coffee roaster. Of course, in case of an actual apocalypse, you may not have easy access to a CNC router or 3D printer, but then there’s always the option to build an espresso machine from salvaged motorcycle parts.

source https://hackaday.com/2020/08/17/somethings-brewing-up-in-the-woods-and-it-looks-stunning/

Vizy the AI Camera Aims to Ease Machine Vision

Cameras are getting smarter and more capable than ever, able to run embedded machine vision algorithms and pull off tricks far beyond what something like a serial camera and microcontroller board would be capable of, and the upcoming Vizy aims to be even smarter and easier to use yet. Vizy is the work of Charmed Labs, and this isn’t their first foray into accessible machine vision. Charmed Labs are the same folks behind the Pixy and Pixy 2 cameras. Vizy’s main goal is to make object detection and classification easy, with thoughtful hardware features and a browser-based interface.

Vizy can identify common birds with “Birdfeeder”, one of the several built-in applications that uses local processing only.

The usual way to do machine vision is to get a USB camera and run something like OpenCV on a desktop machine to handle the processing. But Vizy leverages a Raspberry Pi 4 to provide a tightly-integrated unit in a small package with a variety of ready-to-run applications. For example, the “Birdfeeder” application comes ready to take snapshots of and identify common species of bird, while also identifying party-crashers like squirrels.

The demonstration video on their page shows off using the built-in high-current I/O header to control a sprinkler, repelling non-bird intruders with a splash of water while uploading pictures and video clips. The hardware design also looks well thought out; not only is there a safe shutdown and low-power mode for the Raspberry Pi-based hardware, but the lens can be swapped and the camera unit itself even contains an electrically-switched IR filter.

Vizy has a Kickstarter campaign planned, but like many others, Charmed Labs is still adjusting to the changes the COVID-19 pandemic has brought. You can sign up to be notified when Vizy launches; we know we’ll be keen for a closer look once it does. Easier machine vision is always a good thing, because it helps free people to focus on clever ideas like machine vision-based tool alignment.

source https://hackaday.com/2020/08/17/vizy-the-ai-camera-aims-to-ease-machine-vision/

South Africa’s COVID-19 lockdown extended until the end of April

On the 9th of April 2020, President Cyril Ramaphosa announced the extension of the COVID-19 lockdown in South Africa. Instead of a 21-day lockdown from 27 March to 16 April 2020, the lockdown will now be extended until the end of April 2020.

Watch the announcement video below

There’s no getting away from acknowledging that the economy is in a dire state and looking toward the future might seem difficult at the moment. We get it, we’re there as well. But all hope is not lost. One guarantee we have is that the current situation won’t last forever. Another definite guarantee is that Junk Mail will be there to support your business through unlimited FREE advertising for all your products and services! That’s right, no marketing cost! It’s as simple as visiting Junk Mail and placing your FREE advert!

We understand your current struggle to help your business survive more than you know, so let us help you.

If you need any help placing a free advert or have any questions, please contact us.

Cellerator Wants to Be Your Automated Desktop Biotech Lab

Cellerator really had us at “make designer beers”, but of course this multi-purpose biotech lab has a lot more to offer. It seeks to lower the cost and complexity barriers for automating useful scientific equipment, and wants to pave the way for more innovation in material science based.

The approach taken by Cellerator is to take existing lab tools and automate common research tasks using components familiar to anyone who’s used a 3D printer. A gantry system with end effectors designed for different tools like pipettes automate the processing of samples. A camera (with or without microscope) can be used for feedback via computer vision, or simply by logging snapshots.

A number of screenshots from the software show the depth of the plans for the system. They include widgets for telling the system where various fixtures such as the hot plate, centrifuge, and bioreactor are located. Sub menus for each tool set parameters for their operation, with a scheduling and instruction system for customizing each experiment as well as recording all of the data along the way.

source https://hackaday.com/2020/08/17/cellerator-wants-to-be-your-automated-desktop-biotech-lab/

Mercurial Light Box Has a Secret Switch

Hit up the lighting aisle of any big box hardware store these days and you’ll probably find a variety of Edison bulbs — modern bulbs meant to evoke the bare, complicated tungsten filament bulbs from the early days of electric candlelight. Edison bulbs use filament LEDs, which resemble skinny candles with wicks at both ends and give off a nice light, especially when diffused by acrylic.

This simple light box uses two filament LEDs that float inside on an internal circuit sculpture. [lonesoulsurfer] likes to use old cell phone batteries and USB charging boards in his builds, and that’s exactly what’s inside this box.

Our favorite part of the build elevates this simple light box into a curiosity for those not in the know. It’s controlled with a mercury tilt switch, so all you’d have to do in a power outage is locate the box and turn it upside down, provided it has a charge.

We love elemental switch design around here, like this light box that switches on with salt water.

source https://hackaday.com/2020/08/17/mercurial-light-box-has-a-secret-switch/

3D on the ZX Spectrum 48K

There are times when a project becomes such a big part of a maker’s life that they find themselves revisiting it even years later. [Thanassis] combined this phenomena with his love for the ZX Spectrum when he ported one of his old 3D rendering projects to the ZX Spectrum 48K. The video below shows the result, and they speak for themselves.

The roots of this project go back around three years, when [Thanassis] posted a similar project for the ATMega328 which employed fixed point math tricks for achieving the graphics. The code needed to be even tighter to run on the Spectrum, eventually getting boiled down to just a handful of calculations. This got the proof of concept working with the z88dk compiler, but it wasn’t quite fast enough.

In the end, hand assembly optimizations nearly doubled the performance to a blistering 10 frames per second. There’s also a version that kicks it all the way up to 40 FPS, but only if you give it a few minutes to do the calculations ahead of time. With a few teaks and the right display, this project could produce some very cool retro visuals.

source https://hackaday.com/2020/08/17/3d-on-the-zx-spectrum-48k/

GridSound – An Audio Workstation In Your Browser

If you’re into creating music, you’ll have a surprisingly large variety of open source options at your disposal, ranging from Audacity as rather simple audio editor to Ardour as a full-blown, studio-worthy DAW — and LMMS, Rosegarden, MusE etc. for anything in between. With [Thomas Tortorini]’s GridSound project, you’ll have one additional choice on your list now, except this one runs in your browser. So if you find yourself in a sudden moment of inspiration, all you’ll need is a browser and off you go.

From the feature set’s point of view, GridSound leans towards LMMS and offers a drum kit, piano roll, and synthesizer. It appears that you won’t be able to record real world instruments at this point, but it’s also a work in progress, so who knows what the future will bring. The code is available on GitHub and you can explore GridSound itself here — no login required, unless you want to save your work. Running in a browser, GridSound is naturally written in JavaScript and uses the Web Audio API to perform the actual audio tasks.

What’s impressive is that [Thomas] opted against any UI framework-of-the-week, but instead implemented everything from scratch in pure vanilla JavaScript. In fact, the entire code base seems to be self-contained without any third party dependencies, and that alone deserves some respect. Sure, JavaScript isn’t everybody’s cup of tea — “real developers use assembly” — so if you prefer something more physical, how about some cardboard music?

source https://hackaday.com/2020/08/17/gridsound-an-audio-workstation-in-your-browser/