Bare Metal STM32: The Various Real Time Clock Flavors

Keeping track of time is essential, even for microcontrollers, which is why a real-time clock (RTC) peripheral is a common feature in MCUs. In the case of the STM32 family there are three varieties of RTC peripherals, with the newest two creatively called ‘RTC2′ and RTC3’, to contrast them from the very basic and barebones RTC that debuted with the STM32F1 series.

Commonly experienced in the ubiquitous and often cloned STM32F103 MCU, this ‘RTC1’ features little more than a basic 32-bit counter alongside an alarm feature and a collection of battery-backed registers that requires you to do all of the heavy lifting of time and date keeping yourself. This is quite a contrast with the two rather similar successor RTC peripherals, which seem to insist on doing everything possible themselves – except offer you that basic counter – including giving you a full-blown calendar and today’s time with consideration for 12/24 hour format, DST and much more.

With such a wide gulf between RTC1 and its successors, this raises the question of how to best approach these from a low-level perspective.

Continue reading “Bare Metal STM32: The Various Real Time Clock Flavors”

FreeCAD Foray: From Brick To Shell

Over a year ago, we took a look at importing a .step file of a KiCad PCB into FreeCAD, then placing a sketch and extruding it. It was a small step, but I know it’s enough for most of you all, and that brings me joy. Today, we continue building a case for that PCB – the delay is because I stopped my USB-C work for a fair bit, and lost interest in the case accordingly, but I’m reviving it now.

Since then, FreeCAD has seen its v 1.0 release come to fruition, in particular getting a fair bit of work done to alleviate one of major problems for CAD packages, the “topological naming problem”; we will talk about it later on. The good news is, none of my tutorial appears to have been invalidated by version 1.0 changes. Another good news: since version 1.0, FreeCAD has definitely become a fair bit more stable, and that’s not even including some much-needed major features.

High time to pick the work back up, then! Let’s take a look at what’s in store for today: finishing the case in just a few more extrusions, explaining a few FreeCAD failure modes you might encounter, and giving some advice on how to make FreeCAD for you with minimum effort from your side.

Continue reading “FreeCAD Foray: From Brick To Shell”

GPS And Its Little Modules

Ever want to find your device on the map? Think we all do sometimes. The technology you’ll generally use for that is called Global Positioning System (GPS) – listening to a flock of satellites flying in the orbit, and comparing their chirps to triangulate your position.

The GPS system, built by the United States, was the first to achieve this kind of feat. Since then, new flocks have appeared in the orbit, like the Galileo system from the European Union, GLONASS from Russia, and BeiDou from China. People refer to the concept of global positioning systems and any generic implementation as Global Navigation Satellite System (GNSS), but I’ll call it GPS for the purposes of this article, and most if not all advice here will apply no matter which one you end up relying on. After all, modern GPS modules overwhelmingly support most if not all of these systems!

We’ve had our writers like [Lewin Day] talk in-depth about GPS on our pages before, and we’ve featured a fair few projects showing and shining light on the technology. I’d like to put my own spin on it, and give you a very hands-on introduction to the main way your projects interface with GPS.

Continue reading “GPS And Its Little Modules”

Psst… Got A Second? Here Are The 2025 One-Hertz Challenge Winners

Even with teachers with names like Kirchhoff and Helmholtz, old Heinrich Hertz himself likely didn’t have the slightest idea that his name would one day become an SI unit. Less likely still would have been the idea that Hackaday would honor him with the 2025 One-Hertz Challenge.

The challenge was deliberately — dare we say, fiendishly? — simple: Do something, anything, but do it once a second. Flash a light, ring a bell, click a relay, or even spam comments on a website other than Hackaday; anything at all, but do it at as close to one Hertz as possible. These are our favorite kinds of contests, because the simplicity affords a huge canvas for the creative mind to paint upon while still providing an interesting technical constraint that’s just difficult enough to make things spicy.

And boy, did you respond! We’ve received over a hundred entries since we announced the contest back in June, meaning that many of you spent 4,662,000 seconds of your summer (at least those of you above the equator) rising to the challenge. The time was well spent, with projects that pushed the limits of what we even expected.

While we loved ’em all, we had to winnow them down to the top three, each of which receives a $150 gift certificate from our sponsor, DigiKey. Let’s take a look at them, along with our favorite runners-up.

Continue reading “Psst… Got A Second? Here Are The 2025 One-Hertz Challenge Winners”

Bootstrapping Android Development: A Survival Guide

Developing Android applications seems like it should be fairly straightforward if you believe the glossy marketing by Google and others. It’s certainly possible to just follow the well-trodden path, use existing templates and example code – or even use one of those WYSIWYG app generators – to create something passable that should work okay for a range of common applications. That’s a far cry from learning general Android development, of course.

The process has changed somewhat over the years, especially with the big move from the Eclipse-based IDE with the Android Development Tools (ADT) plugin, to today’s Jetbrains IntelliJ IDEA-based Android Studio. It’s fortunately still possible to download just the command-line tools to obtain the SDK components without needing the Google-blessed IDE. Using the CLI tools it’s not only possible to use your preferred code editor, but also integrate with IDEs that provide an alternate Android development path, such as Qt with its Qt Creator IDE.

Continue reading “Bootstrapping Android Development: A Survival Guide”

Field Guide To North American Crop Irrigation

Human existence boils down to one brutal fact: however much food you have, it’s enough to last for the rest of your life. Finding your next meal has always been the central organizing fact of life, and whether that meal came from an unfortunate gazelle or the local supermarket is irrelevant. The clock starts ticking once you finish a meal, and if you can’t find the next one in time, you’ve got trouble.

Working around this problem is basically why humans invented agriculture. As tasty as they may be, gazelles don’t scale well to large populations, but it’s relatively easy to grow a lot of plants that are just as tasty and don’t try to run away when you go to cut them down. The problem is that growing a lot of plants requires a lot of water, often more than Mother Nature provides in the form of rain. And that’s where artificial irrigation comes into the picture.

We’ve been watering our crops with water diverted from rivers, lakes, and wells for almost as long as we’ve been doing agriculture, but it’s only within the last 100 years or so that we’ve reached a scale where massive pieces of infrastructure are needed to get the job done. Above-ground irrigation is a big business, both in terms of the investment farmers have to make in the equipment and the scale of the fields it turns from dry, dusty patches of dirt into verdant crops that feed the world. Here’s a look at the engineering behind some of the more prevalent methods of above-ground irrigation here in North America.

Continue reading “Field Guide To North American Crop Irrigation”

The Sense And Nonsense Of Virtual Power Plants

Over the past decades power grids have undergone a transformation towards smaller and more intermittent generators – primarily in the form of wind and solar generators – as well as smaller grid-connected batteries. This poses a significant problem when it comes to grid management, as this relies on careful management of supply and demand. Quite recently the term Virtual Power Plant (VPP) was coined to describe these aggregations of disparate resources into something that at least superficially can be treated more or less as a regular dispatchable power plant, capable of increasing and reducing output as required.

Although not actual singular power plants, by purportedly making a VPP act like one, the claim is that this provides the benefits of large plants such as gas-fired turbines at a fraction of a cost, and with significant more redundancy as the failure of a singular generator or battery is easily compensated for within the system.

The question is thus whether this premise truly holds up, or whether there are hidden costs that the marketing glosses over.

Continue reading “The Sense And Nonsense Of Virtual Power Plants”