A graph visualising approximation errors - the specific principle pictured is described well by the linked article

Time And Accuracy In Las ATMegas

Do you ever have to ensure that an exact amount of time passes between two tasks in your microcontroller code? Do you know what’s the difference between precision and accuracy? Today, [Jim Mack] tells us about pushing timers and interrupts to their limits when it comes to managing time, while keeping it applicable to an ever-popular ATMega328P target! Every now and then, someone decides to push the frontiers of what’s possible on a given platform, and today’s rules is coding within constraints of an Arduino environment. However, you should check [Jim]’s post out even if you use Arduino as a swearword – purely for all of the theoretical insights laid out, accompanied by hardware-accurate examples!

This will be useful to any hacker looking to implement, say, motor encoder readings, signal frequency calculations, or build a gadget processing or modifying audio in real time. To give you a sample of this article, [Jim] starts by introducing us to distinctions between precision and accuracy, and then presents us with a seemingly simple task – creating exactly 2400 interrupts a second. As much as it might look straightforward, problems quickly arise when clock crystal frequency doesn’t cleanly divide by the sampling frequency that you have to pick for your application! This is just a taste of all the examples of hidden complexity presented, and they’re accompanied with solutions you can use when you eventually encounter one of these examples in your hacker pursuits. In the end, [Jim] concludes with links to other sources you can study if you ever need to dig deeper into this topic.

Keeping our projects true to the passage of time can be an issue, and we’ve been at it for ages – calibrating your RC oscillator is a rite of passage for any ATTiny project. If you ever decide to have an interrupt peripheral help you with timing issues, we’ve gone in-depth on that topic in the past, with a three-part series describing the benefits, the drawbacks and the edgecases of interrupts. Going for a more modern target? Our piece on using interrupts with STM32 is a great path for trying out tools of the modern age.

NTP Server Gets Time From Space

Cheap GPS units are readily available nowadays, which is great if you have something that needs to be very precisely located. Finding the position of things is one of many uses for GPS, though. There are plenty of ways to take advantage of some of the ancillary tools that the GPS uses to determine location. In this case it’s using the precise timekeeping abilities of the satellites to build a microsecond-accurate network time protocol (NTP) server.

GPS works by triangulating position between a receiver and a number of satellites, but since the satellites are constantly moving an incredibly precise timing signal is needed in order to accurately determine location from all of these variables. This build simply teases out that time information from the satellite network and ignores the location data. There are only two parts to this build, a cheap GPS receiver and a Raspberry Pi, but [Austin] goes into great detail about how to set up the software side as well including installing PPS, GPSd, and then setting up the actual NTP server on the Pi.

While this is an excellent way to self-host your own NTP server if you don’t have Internet access (or just want to do it yourself), [Austin] does note that this is probably overkill on timekeeping as far as accuracy goes. On the other hand, the Raspberry Pi has no built-in real time clock of its own, so this might actually be a cost-competitive way of timekeeping even when compared to something more traditional like a DS3231 RTC module.

Continue reading “NTP Server Gets Time From Space”

Adam Savage with a box ceramic blocks

A Savage Discussion Of Measurement And Accuracy

It’s commonly said that the great thing about standards is that there are so many of them. Of course, that’s talking about competing standards. But there’s another kind of standard that you want a lot of: Measurements. Without standard measurements, the Industrial Revolution wouldn’t have been facilitated to the extent it was. The illustrious [Adam Savage] takes a deep dive into the art of measurement in the video below the break, and if you have 45 minutes to spare, you will not be disappointed.

We don’t want to give away any big spoilers, but [Adam] starts out with things we can all relate to if we’ve done any kind of measuring for accuracy: measuring between the given lines on a standard tape measure. From there he goes into calipers and other tools for measurement.

Then, out come the Big Guns. The ceramic blocks so flat that… well you’ll just have to watch it. But the discussion goes deep into nanometers, microns, and jeweled movements.

Whether you’re a machinist or a garage hacker with nothing more than a stick welder and an angle grinder at your disposal, or anywhere in between in any segment of being a maker, this video is for you. [Adam]’s enthusiasm is off the charts in this diatribe, and we have to admit- it’s contagious! We’ve never been so excited about measuring things.

Of course, if you need to measurement tool, you can just build a measurement tool. It’s all subjective, after all.

Continue reading “A Savage Discussion Of Measurement And Accuracy”

Digital Pregnancy Tests Use LEDs To Read Between The Lines

[Foone] saw a tweet a few weeks ago alleging that digital pregnancy tests are a rip-off. Regular, cheap tests have an absorbent strip running the length of the plastic, with one end exposed for collecting urine. A few excruciating minutes later, a little plastic window in the middle will show one line, two lines, or a plus or minus sign depending on the presence of human chorionic gonadotropin (HCG) in the urine.

As it turns out, at least two digital tests out there are the exact same thing, but with more steps. Instead of a window, they include circuitry that interprets the lines and publishes the result to a little screen in plain English. It can even tell you if you’re doing it wrong by flashing a little RTFM icon.

[Foone]’s teardown reveals a CR1616 coin cell, an 8-bit microcontroller, and a little phototransistor setup that shines LEDs on the strip and reads the incoming light. Unfortunately, the micro is the mask ROM version, so [Foone] can’t reprogram it to run Doom.

The original tweet’s author is probably not alone in assuming that digital tests are supposed to be more accurate somehow. We think the accuracy claim is more about removing the frazzled and/or incompetent human variable from the equation. If the test interprets the results for you, then there’s no mistaking the results, which is technically a higher degree of accuracy. But if you’re in doubt, you get a test from a doctor.

There’s been some discussion about the e-waste aspect of these all these tests — that it’s a shame to produce a microcontroller just to pee on it and throw it away. Sure, you could look at it that way, but unlike a lot of e-waste, these are tools. It’s unfortunate that this is the industry’s idea of higher accuracy, but what should we expect? It’s just testing for the presence of a hormone in urine. Interpreting the results is up to the viewer. We should probably be astounded that they got the cost down to two for $7.

Many people choose to wait a while to start spreading the news. With a Bluetooth-enabled pregnancy test, everyone can find out together.

Thanks for the tip, [Jay]!

Finding Perfect Part Fits With The Goldilocks Approach (and OpenSCAD)

There is something to be said for brute force or trial-and-error approaches to problems, especially when finding a solution has an empirical element to it. [Tommy] perceived that to be the case when needing to design and 3D print servo horns that would fit factory servos as closely as possible, and used OpenSCAD to print a “Goldilocks array” from which it was possible to find a perfect match for his printer by making the trial and error process much more efficient. By printing one part, [Tommy] could test-fit dozens of options.

What made doing this necessary is the fact that every 3D printer has some variance in how accurately they will reproduce small features and dimensions. A 6.3 mm diameter hole in a CAD model, for example, will not come out as exactly 6.3 mm in a 3D-printed object. It will be off by some amount, but usually consistently so. Therefore, one way around this is to empirically determine which measurements result in a perfect fit, and use those for production on that specific 3D printer.

That’s exactly what [Tommy] did, using OpenSCAD to generate an array of slightly different sizes and shapes. The array gets printed out, servos are test-fitted to them, and whichever option fits best has its dimensions used for production. This concept can be implemented in any number of ways, and OpenSCAD makes a decent option due to its programmatic nature. Interested in OpenSCAD? It will run on nearly any hardware, and you can get up and running with the basics in probably less than ten minutes.

3D-Printed Tourbillon Demo Keeps The Time With Style

It may only run for a brief time, and it’s too big for use in an actual wristwatch, but this 3D-printed tourbillon is a great demonstration of the lengths watchmakers will go to to keep mechanical timepieces accurate.

For those not familiar with tourbillons, [Kristina Panos] did a great overview of these mechanical marvels. Briefly, a tourbillon is a movement for a timepiece that aims to eliminate inaccuracy caused by gravity pulling on the mechanism unevenly. By spinning the entire escapement, the tourbillon averages out the effect of gravity and increases the movement’s accuracy. For [EB], the point of a 3D-printed tourbillon is mainly to demonstrate how they work, and to show off some pretty decent mechanical chops. Almost the entire mechanism is printed, with just a bearing being necessary to keep things moving; a pair of shafts can either be metal or fragments of filament. Even the mainspring is printed, which we always find to be a neat trick. And the video below shows it to be satisfyingly clicky.

[EB] has entered this tourbillon in the 3D Printed Gears, Pulleys, and Cams Contest that’s running now through February 19th. You’ve still got plenty of time to get your entries in. We can’t wait to see what everyone comes up with!

Continue reading “3D-Printed Tourbillon Demo Keeps The Time With Style”

Fail Of The Week: 3D Printed Worm Gear Drive Project Unveils Invisible Flaw

All of us would love to bring our projects to life while spending less money doing so. Sometimes our bargain hunting pays off, sometimes not. Many of us would just shrug at a failure and move on, but that is not [Mark Rehorst]’s style. He tried to build a Z-axis drive for his 3D printer around an inexpensive worm gear from AliExpress. This project was doomed by a gear flaw invisible to the human eye, but he documented the experience so we could all follow along.

We’ve featured [Mark]’s projects for his ever-evolving printer before, because we love reading his well-documented upgrade adventures. He’s not shy about exploring ideas that run against 3D printer conventions, from using belts to drive the Z-axis to moving print cooling fan off the print head (with followup). And lucky for us, he’s not shy about document his failures alongside the successes.

He walks us through the project, starting from initial motivation, moving on to parts selection, and describes how he designed his gearbox parts to work around weaknesses inherent to 3D printing. After the gearbox was installed, the resulting print came out flawed. Each of the regularly spaced print bulge can be directly correlated to a single turn of the worm gear making it the prime suspect. Then, to verify this observation more rigorously, Z-axis movement was measured with an indicator and plotted against desired movement. If the problem was caused by a piece of debris or surface damage, that would create a sharp bump in the plot. The sinusoidal plot tells us the problem is more fundamental than that.

This particular worm gear provided enough lifting power to move the print bed by multiplying motor torque, but it also multiplied flaws rendering it unsuitable for precisely positioning a 3D printer’s Z-axis. [Mark] plans to revisit the idea when he could find a source for better worm gears, and when he does we’ll certainly have the chance to read what happens.