Time-of-Flight Sensors: How Do They Work?

With the right conditions, this tiny sensor can measure 12 meters

If you need to measure a distance, it is tempting to reach for the ubiquitous ultrasonic module like an HC-SR04. These work well, and they are reasonably easy to use. However, they aren’t without their problems. So maybe try an IR time of flight sensor. These also work well, are reasonably easy to use, and have a different set of problems. I recently had a project where I needed such a sensor, and I picked up a TF-MiniS, which is a popular IR distance sensor. They aren’t very expensive, and they work serial or I2C. So how did it do?

The unit itself is tiny and has good specifications. You can fit the 42 x 15 x 16 mm module anywhere. It only weighs about five grams — as the manufacturer points out, less than two ping-pong balls. It needs 5 V but communicates using 3.3 V, so integration isn’t much of a problem.

At first glance, the range is impressive. You can read things as close as 10 cm and as far away as 12 m. I found this was a bit optimistic, though. Although the product sometimes gets the name of LiDAR, it doesn’t use a laser. It just uses an IR LED and some fancy optics.

Continue reading “Time-of-Flight Sensors: How Do They Work?”

You Can Now Play DOOM In Microsoft Word, But You Probably Shouldn’t

DOOM used to primarily run on x86 PCs. It later got ported to a bunch of consoles with middling success, and then everything under the sun, from random embedded systems to PDFs. Now, thanks to [Wojciech Graj], you can even play it in Microsoft Word.

To run DOOM inside Microsoft Word, you must enable VBA macros, and ignore security warnings, to boot. You’ll need a modern version of Word, and it will only work on Windows on an x64 CPU. As you might imagine, too, the *.DOCM file is not exactly lightweight. It comes in at 6.6 MB, no surprise given it contains an entire FPS. It carries inside it a library called doomgeneric_docm.dll and the whole doom1.wad data file. Once the file is opened, a macro then extracts all the game data and executes it.

If you think that Microsoft Word doesn’t really have a way of displaying live game graphics, you’d be correct. Instead, that DLL is creating a bitmap image of the game state for every frame, which is then displayed inside Word itself. It uses the GetAsyncKeyState function to grab inputs from the arrow keys, number keys, and CTRL and space so the player can move around. It certainly sounds convoluted, but it actually runs pretty smoothly given all the fuss.

While this obviously works, you shouldn’t get in the habit of executing random code in your word processor. It’s just not proper, you see, like elbows on the dinner table! And, you know. It’s insecure. So don’t do that.

Continue reading “You Can Now Play DOOM In Microsoft Word, But You Probably Shouldn’t”

Innovative Clock Uses Printed Caustic Lens

Hackers and makers have built just about every kind of clock under the sun. Digital, analog, seven-segment, mechanical seven-segment, binary, ternary, hexadecimal… you name it. It’s been done. You really have to try to find something that shocks us… something we haven’t seen before. [Moritz v. Sivers] has done just that. 

Wild. Just wild.

Meet the Caustic Clock. It’s based on the innovative Hollow Clock from [shiura]. It displays time with an hour hand and a minute hand, and that’s all so conventional. But what really caught our eye was the manner in which its dial works. It uses caustics to display the clock dial on a wall as light shines through it.

If you’ve ever seen sunlight reflect through a glass, or the dancing patterns in an outdoor swimming pool, you’ve seen caustics at play. Caustics are the bright patterns we see projected through a transparent object, and if you shape that object properly, you can control them. In this case, [Moritz] used some GitHub code from [Matt Ferraro] to create a caustic projection clockface, and 3D printed it using an SLA printer.

The rest of the clock is straightforward enough—there’s some WS2812 LEDs involved, an Arduino Nano, and even an RP2040. But the real magic is in the light show and how it’s all achieved. We love learning about optics, and this is a beautiful effect well worth studying yourself.

Continue reading “Innovative Clock Uses Printed Caustic Lens”