Bryan Cockfield – Hackaday https://hackaday.com Fresh hacks every day Tue, 05 Nov 2024 06:24:12 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 156670177 I Installed Gentoo So You Don’t Havtoo https://hackaday.com/2024/11/04/i-installed-gentoo-so-you-dont-havtoo/ https://hackaday.com/2024/11/04/i-installed-gentoo-so-you-dont-havtoo/#comments Mon, 04 Nov 2024 15:00:22 +0000 https://hackaday.com/?p=729862 A popular expression in the Linux forums nowadays is noting that someone “uses Arch btw”, signifying that they have the technical chops to install and use Arch Linux, a distribution …read more]]>

A popular expression in the Linux forums nowadays is noting that someone “uses Arch btw”, signifying that they have the technical chops to install and use Arch Linux, a distribution designed to be cutting edge but that also has a reputation of being for advanced users only. Whether this meme was originally posted seriously or was started as a joke at the expense of some of the more socially unaware Linux users is up for debate. Either way, while it is true that Arch can be harder to install and configure than something like Debian or Fedora, thanks to excellent documentation and modern (but optional) install tools it’s no longer that much harder to run than either of these popular distributions.

For my money, the true mark of a Linux power user is the ability to install and configure Gentoo Linux and use it as a daily driver or as a way to breathe life into aging hardware. Gentoo requires much more configuration than any mainline distribution outside of things like Linux From Scratch, and has been my own technical white whale for nearly two decades now. I was finally able to harpoon this beast recently and hope that my story inspires some to try Gentoo while, at the same time, saving others the hassle.

A Long Process, in More Ways Than One

My first experience with Gentoo was in college at Clemson University in the late ’00s. The computing department there offered an official dual-boot image for any university-supported laptop at the time thanks to major effort from the Clemson Linux User Group, although the image contained the much-more-user-friendly Ubuntu alongside Windows. CLUG was largely responsible for helping me realize that I had options outside of Windows, and eventually I moved completely away from it and began using my own Linux-only installation. Being involved in a Linux community for the first time had me excited to learn about Linux beyond the confines of Ubuntu, though, and I quickly became the type of person featured in this relevant XKCD. So I fired up an old Pentium 4 Dell desktop that I had and attempted my first Gentoo installation.

For the uninitiated, the main thing that separates Gentoo from most other distributions is that it is source-based, meaning that users generally must compile the source code for all the software they want to use on their own machines rather than installing pre-compiled binaries from a repository. So, for a Gentoo installation, everything from the bootloader to the kernel to the desktop to the browser needs to be compiled when it is installed. This can take an extraordinary amount of time especially for underpowered machines, although its ability to customize compile options means that the ability to optimize software for specific computers will allow users to claim that time back when the software is actually used. At least, that’s the theory.

It didn’t work out too well for me and my Dell, though, largely because Dell of the era would put bottom-basement, obscure hardware in their budget computers which can make for a frustrating Linux experience even among the more user-friendly distributions due to a general lack of open-source drivers. I still hold a grudge against Dell for this practice in much the same way that I still refuse to use Nvidia graphics cards, but before I learned this lesson I spent weeks one summer in college with this Frankensteined computer, waiting for kernels and desktop environments to compile for days only to find out that there was something critical missing that broke my installations. I did get to a working desktop environment at one point, but made a mistake with it along the way and decided, based on my Debian experiences, that re-installing the operating system was the way to go rather than actually fixing the mistake I had made. I never got back to a working desktop after that and eventually gave up.

This experience didn’t drive me away from Gentoo completely, though. It was always at the back of my mind during any new Linux install I performed, especially if I was doing so on underpowered hardware that could have benefited from Gentoo’s customization. I would try it occasionally again and again only to give up for similar reasons, but finally decided I had gained enough knowledge from my decades as a Debian user to give it a proper go. A lot has changed in the intervening years; in the days of yore an aspiring Gentoo user had to truly start at the ground up, even going as far as needing to compile a compiler. These days only Gentoo developers take these fundamental steps, providing end users with a “Stage 3” tarball which contains the core needed to install the rest of Gentoo.

Bringing Out The Best of Old Hardware

And I do have a piece of aging hardware that could potentially benefit from a Gentoo installation. My mid-2012 Macbook Pro (actually featured in this article) is still a fairly capable machine, especially since I only really need a computer these days for light Internet browsing and writing riveting Hackaday articles. Apple long ago dropped support for this machine in macOS meaning that it’s no longer a good idea to run its native operating system. In my opinion, though, these older, pre-butterfly Macs are still excellent Linux machines aside from minor issues like finding the correct WiFi drivers. (It also can’t run libreboot, but it’s worth noting that some Macs even older than mine can.) With all of that in mind I got to work compiling my first Linux kernel in years, hoping to save my old Macbook from an e-waste pile.

There’s a lot expected of a new Gentoo user even with modern amenities like the stage 3 tarball (and even then, you have to pick a stage file from a list of around 50 options), and although the handbooks provided are fairly comprehensive they can be confusing or misleading in places. (It’s certainly recommended to read the whole installation guide first and even perform a trial installation in a virtual machine before trying it on real hardware.) In addition to compiling most software from source (although some popular packages like Firefox, LibreOffice, and even the kernel itself are available as precompiled binaries now), Gentoo requires the user to configure what are called USE flags for each package which specify that package’s compile options. A global USE flag file is also maintained to do things like build GNOME, Bluetooth, even 32-bit support into every package, while specific package USE flags are maintained in other separate files. For example, when compiling GIMP, users can choose which image formats they want their installation of GIMP to support. There’s a second layer of complexity here too as certain dependencies for packages can be “masked” or forbidden from being installed by default, so the user will also need to understand why certain things are masked and manually unmask them if the risk is deemed acceptable.

One thing that Gentoo has pioneered in recent years is the use of what it calls distribution kernels. These are kernel configurations with sane defaults, meaning that that they’ll probably work for most users on most systems on the first try. From there, users can begin tweaking the kernel for their use case once they have a working installation, but they don’t have to do that leg work during the installation process anymore. Of course, in true Gentoo fashion, you can still go through the process of configuring the kernel manually during the install if you choose to.

Aside from compiling a kernel, Gentoo also requires the user to make other fundamental choices about their installation during the install process that most other major distributions don’t. Perhaps the biggest one is that the user has to choose an init system, the backbone of the operating system’s startup and service management systems. Generally most distributions decide for you, with most larger distributions like Debian, Fedora, and Arch going with systemd by default. Like anything in the Linux world, systemd is controversial for some, so there are alternatives with OpenRC being the one with the most acceptance in the Gentoo world. I started out with OpenRC in my installations but found a few pieces of software that I use regularly don’t play well with it, so I started my build over and now use systemd. The user also can select between a number of different bootloaders, and I chose the tried-and-true Grub seeing no compelling reason to change at the moment.

In addition, there’s no default desktop environment, so you’ll also need to choose between GNOME, KDE, XFCE, any other desktop environment, or among countless window managers. The choice to use X or Wayland is up to you as well. For what it’s worth, I can at least report that GNOME takes about three times as long to compile as the kernel itself does, so keep that in mind if you’re traveling this path after me.

It’s also possible you’ll need to install a number of drivers for hardware, some of which might be non-free and difficult to install in Gentoo while they might be included by default in distributions like Ubuntu. And, like everything else, they’ll need to be compiled and configured on your machine as well. For me specifically, Gentoo was missing the software to control the fans on my MacBook Pro, but this was pretty easy to install once I found it. There’s an additional headache here as well with the Broadcom Wi-Fi cards found in older Macs, which are notoriously difficult pieces of hardware to work with in the Linux world. I was eventually able to get Wi-Fi working on my MacBook Pro, but I also have an 11″ MacBook Air from the same era that has a marginally different wireless chipset that I still haven’t been able to get to work in Gentoo, giving me flashbacks to my experience with my old Dell circa 2007.

This level of granularity when building software and an overall installation is what gives Gentoo the possibility for highly optimized installations, as every package can be configured for the user’s exact use case for every package down to the kernel itself. It’s also a rolling release model similar to Arch, so in general the newest versions of software will be available for it as soon as possible while a Debian user might have to wait a year or two for the next stable release.

A Few Drawbacks

It’s not all upside, though. For those without a lot of Gentoo experience (including myself) it’s possible to do something like spend a day and a half compiling a kernel or desktop environment only to find out a critical feature wasn’t built, and then have to spend another day and a half compiling it again with the correct USE flags. Or to use the wrong stage file on the first try, or realize OpenRC won’t work as an init system for a specific use case, or having Grub inscrutably be unable to find the installation. Also, don’t expect Gentoo to be faster out-of-the-box than Debian or Fedora without a customization effort, either; for me Gentoo was actually slower than Debian in my benchmarks without a few kernel and package re-compiles. With enough persistence and research, though, it’s possible to squeeze every bit of processing power out of a computer this way.

Personally, I’m not sure I’m willing to go through the amount of effort to migrate my workstations (and especially my servers) to Gentoo because of how much extra configuration is required for often marginal performance gains thanks to the power and performance capabilities of modern hardware. Debian Stable will likely remain my workhorse for the time being for those machines, and I wouldn’t recommend anyone install Gentoo who doesn’t want to get into the weeds with their OS. But as a Linux hobbyist there’s a lot to be said for using other distributions that are a little more difficult to use than Debian or even Arch, although I’d certainly recommend using a tool like Clonezilla to make backups of your installation from time to time so if you do make the same mistakes I made in college you can more easily restore your system. For me, though, I still plan to keep Gentoo on my MacBook Pro since it’s the machine that I tinker with the most in the same way that a classic car enthusiast wants to keep their vehicle on the road and running as well as it did when it was new. It also lets me end forum posts with a sardonic “I use Gentoo, btw” to flex on the Arch users, which might be the most important thing of all.

]]>
https://hackaday.com/2024/11/04/i-installed-gentoo-so-you-dont-havtoo/feed/ 46 729862 gentoo
Oscillator Needs Fine-Tuning https://hackaday.com/2024/11/03/oscillator-needs-fine-tuning/ https://hackaday.com/2024/11/03/oscillator-needs-fine-tuning/#comments Sun, 03 Nov 2024 15:00:36 +0000 https://hackaday.com/?p=732662 Since their invention more than a century ago, crystal oscillators have been foundational to electronic design. They allow for precise timekeeping for the clocks in computers as well as on …read more]]>

Since their invention more than a century ago, crystal oscillators have been foundational to electronic design. They allow for precise timekeeping for the clocks in computers as well as on our wrists, and can do it extremely accurately and inexpensively to boot. They aren’t without their downsides though; a quartz watch might lose or gain a few seconds a month due to variations in temperature and other non-ideal environmental situations, but for working in the world of high-frequency circuits this error is unacceptable. For that you might reach for something like an oven oscillator, a circuit with a temperature controlled chamber able to keep incredibly precise time.

[IMSAI Guy] found this 10 MHz oven oscillator on a site selling bulk electronics at bargain basement prices. But as is unsurprising for anyone who’s used a site like this to get cheap circuits, it didn’t quite hit its advertised frequency of 10.000000 MHz. The circuit design is capable of this amount of accuracy and precision, though, thanks to some cleverly-designed voltage dividers and filtering. One of those voltage dividers allows a potentiometer to control a very narrow range of output frequencies, and from the factory it was outputting between 9.999981 and 9.9999996 MHz. To get it to actually output a 10 MHz wave with eight significant digits of accuracy, a pull-up resistor on the voltage divider needed to be swapped out.

While this was a fairly simple fix, one might wonder how an off-the-shelf component like this would miss the mark in such an obvious way but still go into production. But that’s one of life’s great mysteries and also the fun of sourcing components like this. In this case, the oven oscillator was less than $10. But these circuits aren’t always as good of a deal as they seem.

]]>
https://hackaday.com/2024/11/03/oscillator-needs-fine-tuning/feed/ 23 732662 txco-main
Few Things Are Cheaper than This Antenna https://hackaday.com/2024/10/31/few-things-are-cheaper-than-this-antenna/ https://hackaday.com/2024/10/31/few-things-are-cheaper-than-this-antenna/#comments Fri, 01 Nov 2024 02:00:15 +0000 https://hackaday.com/?p=730912 As far as hobbies go, ham radio tends to be on the more expensive side. A dual-band mobile radio can easily run $600, and a high-end HF base station with …read more]]>

As far as hobbies go, ham radio tends to be on the more expensive side. A dual-band mobile radio can easily run $600, and a high-end HF base station with the capability of more than 100 watts will easily be in the thousands of dollars. But, like most things, there’s an aspect to the hobby that can be incredibly inexpensive and accessible to newcomers. Crystal radios, for example, can be built largely from stuff most of us would have in our parts drawers, CW QRP radios don’t need much more than that, and sometimes even the highest-performing antennas are little more than two lengths of wire.

For this specific antenna, [W3CT] is putting together an inverted-V which is a type of dipole antenna. Rather than each of the dipole’s legs being straight, the center is suspended at some point relatively high above ground with the two ends closer to the earth. Dipoles, including inverted-Vs, are resonant antennas, meaning that they don’t need any tuning between them and the radio so the only thing needed to match the antenna to the feed line is a coax-to-banana adapter. From there it’s as simple as attaching the two measured lengths of wire for the target band and hoisting the center of the antenna up somehow. In [W3CT]’s case he’s using a mast which would break the $8 budget, but a tree or building will do just as well.

The video on the construction of this antenna goes into great detail, so if you haven’t built a dipole yet or you’re just getting started on your ham radio journey, it’s a great place to get started. From there we’d recommend checking out an off-center-fed dipole which lets a dipole operate efficiently on multiple bands instead of just one, and for more general ham radio advice without breaking the bank we’d always recommend the $50 Ham series.

]]>
https://hackaday.com/2024/10/31/few-things-are-cheaper-than-this-antenna/feed/ 40 730912 antenna-main
Pi Pico Lays Down the Groove https://hackaday.com/2024/10/30/pi-pico-lays-down-the-groove/ https://hackaday.com/2024/10/30/pi-pico-lays-down-the-groove/#comments Wed, 30 Oct 2024 23:00:39 +0000 https://hackaday.com/?p=730375 From the 60s to perhaps the mid-00s, the path to musical stardom was essentially straight with very few forks. As a teenager you’d round up a drummer and a few …read more]]>

From the 60s to perhaps the mid-00s, the path to musical stardom was essentially straight with very few forks. As a teenager you’d round up a drummer and a few guitar players and start jamming out of a garage, hoping to build to bigger and bigger venues. Few people made it for plenty of reasons, not least of which was because putting together a band like this is expensive. It wasn’t until capable electronic devices became mainstream and accepted in popular culture in the last decade or two that a few different paths for success finally opened up, and this groovebox shows just how much music can be created this way with a few straightforward electronic tools.

The groovebox is based on a Raspberry Pi Pico 2 and includes enough storage for 16 tracks with a sequencer for each track, along with a set of 16 scenes. Audio plays through PCM5102A DAC module, with a 160×128 TFT display and a touch-sensitive pad for user inputs. It’s not just a device for looping stored audio, though. There’s also a drum machine built in which can record and loop beats with varying sounds and pitches, as well as a sample slicer and a pattern generator and also as the ability to copy and paste clips.

There are a few limitations to using a device this small though. Because of memory size it outputs a 22 kHz mono signal, and its on-board storage is not particularly large either, but it does have an SD card slot for expansion. But it’s hard to beat the bang-for-the-buck qualities of a device like this, regardless, not to mention the portability. Especially when compared with the cost of multiple guitars, a drum set and a bunch of other analog equipment, it’s easy to see how musicians wielding these instruments have risen in popularity recently. This 12-button MIDI instrument could expand one’s digital musical capabilities even further.

]]>
https://hackaday.com/2024/10/30/pi-pico-lays-down-the-groove/feed/ 7 730375 picogroove-featured
Custom Fan Controller For Otherwise Fanless PCs https://hackaday.com/2024/10/29/custom-fan-controller-for-otherwise-fanless-pcs/ https://hackaday.com/2024/10/29/custom-fan-controller-for-otherwise-fanless-pcs/#comments Tue, 29 Oct 2024 20:00:29 +0000 https://hackaday.com/?p=729952 Most of us using desktop computers, and plenty of us on laptops, have some sort of fan or pump installed in our computer to remove heat and keep our machines …read more]]>

Most of us using desktop computers, and plenty of us on laptops, have some sort of fan or pump installed in our computer to remove heat and keep our machines running at the most optimum temperature. That’s generally a good thing for performance, but comes with a noise pollution cost. It’s possible to build fanless computers, though, which are passively cooled by using larger heat sinks with greater thermal mass, or by building more efficient computers, or both. But sometimes even fanless designs can benefit from some forced air, so [Sasa] built this system for cooling fanless systems with fans.

The main advantage of a system like this is that the fans on an otherwise fanless system remain off when not absolutely necessary, keeping ambient noise levels to a minimum. [Sasa] does have a few computers with fans, and this system helps there as well. Each fan module is WiFi-enabled, allowing for control of each fan on the system to be set up and controlled from a web page. It also can control 5V and 12V fans automatically with no user input, and can run from any USB power source, so it’s not necessary to find a USB-PD-compatible source just to run a small fan.

Like his previous project, this version is built to easily integrate with scripting and other third-party software, making it fairly straightforward to configure in a home automation setup or with any other system that is monitoring a temperature. It doesn’t have to be limited to a computer, either; [Sasa] runs one inside a server cabinet that monitors the ambient temperature in the cabinet, but it could be put to use anywhere else a fan is needed. Perhaps even a hydroponic setup.

]]>
https://hackaday.com/2024/10/29/custom-fan-controller-for-otherwise-fanless-pcs/feed/ 5 729952 fan-control-main
Custom Drone Software Searches, Rescues https://hackaday.com/2024/10/24/custom-drone-software-searches-rescues/ https://hackaday.com/2024/10/24/custom-drone-software-searches-rescues/#comments Fri, 25 Oct 2024 05:00:52 +0000 https://hackaday.com/?p=729718 When a new technology first arrives in people’s hands, it often takes a bit of time before the full capabilities of that technology are realized. In much the same way …read more]]>

When a new technology first arrives in people’s hands, it often takes a bit of time before the full capabilities of that technology are realized. In much the same way that many early Internet users simply used it to replace snail mail, or early smartphones were used as more convenient methods for messaging and calling than their flip-phone cousins, autonomous drones also took a little bit of time before their capabilities became fully realized. While some initially used them as a drop-in replacement for things like aerial photography, a group of mountain rescue volunteers in the United Kingdom realized that they could be put to work in more efficient ways suited to their unique abilities and have been behind a bit of a revolution in the search-and-rescue community.

The first search-and-rescue groups using drones to help in their efforts generally used them to search in the same way a helicopter would have been used in the past, only with less expense. But the effort involved is still the same; a human still needed to do the searching themselves. The group in the UK devised an improved system to take the human effort out of the equation by sending a drone to fly autonomously over piece of mountainous terrain and take images of the ground in such a way that any one thing would be present in many individual images. From there, the drone would fly back to its base station where an operator could download the images and run them through a computer program which would analyse the images and look for outliers in the colors of the individual pixels. Generally, humans tend to stand out against their backgrounds in ways that computers are good at spotting while humans themselves might not notice at all, and in the group’s first efforts to locate a missing person they were able to locate them almost immediately using this technology.

Although the system is built on a mapping system somewhat unique to the UK, the group has not attempted to commercialize the system. MR Maps, the software underpinning this new feature, has been free to use for anyone who wants to use it. And for those just starting out in this field, it’s also worth pointing out that location services offered by modern technologies in rugged terrain like this can often be misleading, and won’t be as straightforward of a solution to the problem as one might think.

]]>
https://hackaday.com/2024/10/24/custom-drone-software-searches-rescues/feed/ 17 729718 drone-main
Artificial Intelligence Runs on Arduino https://hackaday.com/2024/10/24/artificial-intelligence-runs-on-arduino/ https://hackaday.com/2024/10/24/artificial-intelligence-runs-on-arduino/#comments Thu, 24 Oct 2024 18:30:20 +0000 https://hackaday.com/?p=729698 Fundamentally, an artificial intelligence (AI) is nothing more than a system that takes a series of inputs, makes some prediction, and then outputs that information. Of course, the types of …read more]]>

Fundamentally, an artificial intelligence (AI) is nothing more than a system that takes a series of inputs, makes some prediction, and then outputs that information. Of course, the types of AI in the news right now can handle a huge number of inputs and need server farms’ worth of compute to generate outputs of various forms, but at a basic level, there’s no reason a purpose-built AI can’t run on much less powerful hardware. As a demonstration, and to win a bet with a friend, [mondal3011] got an artificial intelligence up and running on an Arduino.

This AI isn’t going to do anything as complex as generate images or write clunky preambles to every recipe on the Internet, but it is still a functional and useful piece of software. This one specifically handles the brightness of a single lamp, taking user input on acceptable brightness ranges in the room and outputting what it thinks the brightness of the lamp should be to match the user’s preferences. [mondal3011] also builds a set of training data for the AI to learn from, taking the lamp to various places around the house and letting it figure out where to set the brightness on its own. The training data is run through a linear regression model in Python which generates the function that the Arduino needs to automatically operate the lamp.

Although this isn’t the most complex model, it does go a long way to demonstrating the basic principles of using artificial intelligence to build a useful and working model, and then taking that model into the real world. Note also that the model is generated on a more powerful computer before being ported over to the microcontroller platform. But that’s all par for the course in AI and machine learning. If you’re looking to take a step up from here, we’d recommend this robot that uses neural networks to learn how to walk.

]]>
https://hackaday.com/2024/10/24/artificial-intelligence-runs-on-arduino/feed/ 23 729698 ai-lamp-main