Linux Fu: Watch That Filesystem

The UNIX Way™ is to cobble together different, single-purpose programs to get the effect you want, for instance in a Bash script that you run by typing its name into the command line. But sometimes you want the system to react to changes in the system without your intervention. For example, you might like to watch a directory and kick off some program automatically when a file appears from a completed FTP transaction, without having to sit there and refresh the directory yourself.

The simple but ugly way to do this just scans the directory periodically. Here’s a really dumb shell script:

#!/bin/bash
while true
 do
   for I in `ls`
    do cat $I; rm $I
   done
 sleep 10
done

Just for an example, I dump the file to the console and remove it, but in real life, you’d do something more interesting. This is really not a good script because it executes all the time and it just isn’t a very elegant solution. (If you think I should use for I in *, try doing that in an empty directory and you’ll see why I use the ls command instead.)

Continue reading “Linux Fu: Watch That Filesystem”

Bike Helmet Plays Music via Tiny Motors for Bone Conduction

[Matlek] had an interesting problem. On one hand, a 40 minute bike commute without music is a dull event but in France it is illegal for any driver to wear headphones. What to do? Wanting neither to break the law nor accept the risk of blocking out surrounding sounds by wearing headphones anyway, and unwilling to create noise pollution for others with a speaker system, [Matlek] decided to improvise a custom attachment for a bike helmet that plays audio via bone conduction. We’ll admit that our first thought was a worrisome idea of sandwiching metal surface transducers between a helmet and one’s skull (and being one crash away from the helmet embedding said transducers…) but happily [Matlek]’s creation is nothing of the sort.

A 3D printed rack and pinon provides adjustability and stable contact with the “sweet spot” behind each ear.

The bone conduction is cleverly achieved by driving small DC motors with an audio signal through a TPA2012 based audio amplifier, which is powered by a single 18650 cell. By using motors in place of speakers, and using a 3D printed enclosure to hold the motors up to a sweet spot just behind the ears, it’s possible to play music that only the wearer can hear and does not block environmental sounds.

[Matlek] didn’t just throw this together, either. This design was the result of researching bone conduction audio, gathering a variety of different components to use as transducers, testing which performed best, and testing different locations on the body. Just behind the ear was the sweet spot, with the bony area having good accessibility to a helmet-mounted solution. Amusingly, due to the contact between the motors and the rest of the hardware, the helmet itself acts as a large (but weak) speaker and faint music is audible from close range. [Matlek] plans to isolate the motors from the rest of the assembly to prevent this.

Another good way to get audio to transmit via bone conduction? Send it through the teeth. While maybe not the best option for a bike rider, biting down on this metal rod sends audio straight to your inner ear.

DIY Scrap Guitar Really Shreds

[Keith Decent] recently got himself involved in a plywood challenge, and decided to make a single-pickup electric guitar. Since he is a prolific hoarder of scrap wood, the result is a lovely stack of laminates from many sources, including reclaimed cabinet doors. Really though, the wood is just the beginning—nearly every piece of this texture-rich axe started life as something else.

He’s made a cigar box guitar before, but never a bona fide solid-body electric. As you might guess, he learned quite a bit in the process. [Keith] opted for a neck-through design instead of bolting one on and using a truss rod. The face pieces are cut from his old bench top, which has a unique topology thanks to several years of paint, glue, and other character-building ingredients.

We love the geometric inlay [Keith] made for the pick guard, and the fact that he used an offcut from the process as a floating bridge. He also made his own pickup from bolts, an old folding rule, and reclaimed magnet wire from discarded wall wart transformers. Once he routed out the body and installed the electronics, [Keith] cut up an old painting he’d done on plywood to use as the back panel. Our only complaint about this beautiful guitar is that he didn’t design the back piece to be dinosaur side out. Shred past the break to give her a listen.

[Keith] wound his pickup with a little help from a drill, but a DIY pickup winder might have caused him less grief.

Continue reading “DIY Scrap Guitar Really Shreds”

USB Reverse Engineering: A Universal Guide

Every hacker knows what it is to venture down a rabbit hole. Whether it lasts an afternoon, a month, or decades, finding a new niche topic and exploring where it leads is a familiar experience for Hackaday readers.

[Glenn ‘devalias’ Grant] is a self-proclaimed regular rabbit hole diver and is conscious that, between forays into specific topics, short-term knowledge and state of mind can be lost. This time, whilst exploring reverse engineering USB devices, [Glenn] captured the best resources, information and tools – for his future self as well as others.

His guide is impressively comprehensive, and covers all the necessary areas in hardware and software. After formally defining a USB system, [Glenn] refers us to [LinuxVoice], for a nifty tutorial on writing a linux USB driver for an RC car, in Python. Moving on to hardware, a number of open-source and commercial options are discussed, including GoodFET, FaceDancer, and Daisho – an FPGA based monitoring tool for analysing USB 3.0, HDMI and Gigabit Ethernet. If you only need to sniff low speed USB, here’s a beautifully small packet snooper from last year’s Hackaday prize.

This is a guide which is well-informed, clearly structured, and includes TL;DR sections in the perfect places. It gives due credit to LibUSB and PyUSB, and even includes resources for USB over IP.

If you’re worried about USB hacks like BadUSB, perhaps you should checkout GoodUSB – a hardware firewall for USB devices.

Header image: Ed g2s (CC-SA 3.0).

 

Don’t Flake on Your Fish—Feed them Automatically

We get it. You love your fish, but they can’t bark or gently nip at your shin flesh to let you know they’re hungry. (And they always kind of look hungry, don’t they?) One day bleeds into the next, and you find yourself wondering if you’ve fed them yet today. Or are you thinking of yesterday? Fish deserve better than that. Why not build them a smart fish feeder?

Domovoy is a completely open-source automatic fish feeder that lets you feed them on a schedule, over Bluetooth, or manually. This simple yet elegant design uses a small stepper motor to drive a 3D-printed auger to deliver the goods. Just open the lid, fill ‘er up with flakes, and program up to four feedings per day through the 3-button and LCD interface. You can even set the dosage, which is measured in complete revolutions of the auger.

It’s built around an ATMega328P, but you’ll have to spin your own board and put the feeder together using his excellent instructions. Hungry to see this feeder in action? Just swim past the break.

Can’t be bothered to feed your fish automatically? Train them to feed themselves.

Continue reading “Don’t Flake on Your Fish—Feed them Automatically”

Biasing That Transistor: The Emitter Follower

We were musing upon the relative paucity of education with respect to the fundamentals of electronic circuitry with discrete semiconductors, so we thought we’d do something about it. So far we’ve taken a look at the basics of transistor biasing through the common emitter amplifier, then introduced a less common configuration, the common base amplifier. There is a third transistor amplifier configuration, as you might expect for a device that has three terminals: the so-called Common Collector amplifier. You might also know this configuration as the Emitter Follower. It’s called a “follower” because it tracks the input voltage, offering increased current capability and significantly lower output impedance.

The emitter follower circuit
The emitter follower circuit

Just as the common emitter amplifier and common base amplifier each tied those respective transistor terminals to a fixed potential and used the other two terminals as amplifier input and output, so does the common collector circuit. The base forms the input and its bias circuit is identical to that of the common emitter amplifier, but the rest of the circuit differs in that the collector is tied to the positive rail, the emitter forms the output, and there is a load resistor to ground in the emitter circuit.

As with both of the other configurations, the bias is set such that the transistor is turned on and passing a constant current that keeps it in its region of an almost linear relationship between small base current changes and larger collector current changes. With variation of the incoming signal and thus the  base current there is a corresponding change in the collector current dictated by the transistor’s gain, and thus an output voltage is generated across the emitter resistor. Unlike the common emitter amplifier this voltage increases or decreases in step with the input voltage, so the emitter follower is not an inverting amplifier.

Continue reading “Biasing That Transistor: The Emitter Follower”

Plant Biology is a Gateway

Too many college students have been subject to teachers’ aids who think they are too clever to be stuck teaching mere underclassmen. For that reason, [The Thought Emporium] is important because he approaches learning with gusto and is always ready to learn something new himself and teach anyone who wants to learn. When he released a video about staining and observing plant samples, he avoided the biggest pitfalls often seen in college or high school labs. Instead of calling out the steps by rote, he walks us through them with useful camera angles and close-ups. Rather than just pointing at a bottle and saying, “the blue one,” he tells us what is inside and why it is essential. Instead of telling us precisely what we need to see to get a passing grade, he lets our minds wonder about what we might see and shows us examples that make the experiment seem exciting. The video can also be seen below the break.

The process of staining can be found in a biology textbook, and some people learn best by reading, but we haven’t read a manual that makes a rudimentary lab seem like the wardrobe to Narnia, so he gets credit for that. Admittedly, you have to handle a wicked sharp razor, and the chance of failure is never zero. In fact, he will tell you, the opportunities to fail are everywhere. The road to science isn’t freshly paved, it needs pavers.

If a biology lab isn’t in your personal budget, a hackerspace may have one or need one. If you are wondering where you’ve heard [The Thought Emporium]’s voice before, it is because he is fighting lactose intolerance like a hacker.

Continue reading “Plant Biology is a Gateway”