ANTIRTOS: No RTOS Needed

Embedded programming is a tricky task that looks straightforward to the uninitiated, but those with a few decades of experience know differently. Getting what you want to work predictably or even fit into the target can be challenging. When you get to a certain level of complexity, breaking code down into multiple tasks can become necessary, and then most of us will reach for a real-time operating system (RTOS), and the real fun begins. [Aleksei Tertychnyi] clearly understands such issues but instead came up with an alternative they call ANTIRTOS.

The idea behind the project is not to use an RTOS at all but to manage tasks deterministically by utilizing multiple queues of function pointers. The work results in an ultra-lightweight task management library targeting embedded platforms, whether Arduino-based or otherwise. It’s pure C++, so it generally doesn’t matter. The emphasis is on rapid interrupt response, which is, we know, critical to a good embedded design. Implemented as a single header file that is less than 350 lines long, it is not hard to understand (provided you know C++ templates!) and easy to extend to add needed features as they arise. A small code base also makes debugging easier. A vital point of the project is the management of delay routines. Instead of a plain delay(), you write a custom version that executes your short execution task queue, so no time is wasted. Of course, you have to plan how the tasks are grouped and scheduled and all the data flow issues, but that’s all the stuff you’d be doing anyway.

The GitHub project page has some clear examples and is the place to grab that header file to try it yourself. When you really need an RTOS, you have a lot of choices, mostly costing money, but here’s our guide to two popular open source projects: FreeRTOS and ChibiOS. Sometimes, an RTOS isn’t enough, so we design our own full OS from scratch — sort of.

What Actually Causes Warping In 3D Prints?

The 3D printing process is cool, but it’s also really annoying at times. Specifically, when you want to get a part printed, and no matter how you orientate things, what adhesion aids you use or what slicer settings you tweak, it just won’t print right. [David Malawey] has been thinking a little about the problem of the edges of wide prints tending to curl upwards, and we believe they may be on to something.

Obviously, we’re talking about the lowest common denominator of 3D printing, FDM, here. Other 3D printing technologies have their gotchas. Anyway, when printing a wide object, edge curling or warping is a known annoyance. Many people will just try it and hope for the best. When a print’s extreme ends start peeling away from the heat bed, causing the print to collide with the head, they often get ripped off the bed and unceremoniously ejected onto the carpet. Our first thought will be, “Oh, bed adhesion again”, followed by checking the usual suspects: bed temperature, cleanliness and surface preparation. Next, we might add a brim or some sacrificial ‘bunny ears’ to keep those pesky edges nailed down. Sometimes this works, but sometimes not. It can be frustrating. [David] explains in the YouTube short how the contraction of each layer of materials is compounded by its length, and these stresses accumulate as the print layers build. A simple demonstration shows how a stack of stressed sections will want to curl at the ends and roll up inwards.

This mechanism would certainly go some way to explain the way these long prints behave and why our mitigation attempts are sometimes in vain. The long and short of it is to fix the issue at the design stage, to minimize those contraction forces, and reduce the likelihood of edge curling.

Does this sound familiar? We thought we remembered this, too, from years ago. Anyway, the demonstration was good and highlighted the issue well.

Continue reading “What Actually Causes Warping In 3D Prints?”

A RISC-V LISP Compiler…Written In Lisp

Ah, Lisp, the archaic language that just keeps on giving. You either love or hate it, but you’ll never stop it. [David Johnson-Davies] is clearly in the love it camp and, to that end, has produced a fair number of tools wedging this language into all kinds of nooks and crannies. The particular nook in question is the RISC-V ISA, with their Lisp-to-RISC-V compiler. This project leads on from their RISC-V assembler by allowing a Lisp function to be compiled directly to assembly and then deployed as callable, provided you stick to the supported language subset, that is!

The fun thing is—you guessed it—it’s written in Lisp. In fact, both projects are pure Lisp and can be run on the uLisp core and deployed onto your microcontroller of choice. Because who wouldn’t want to compile Lisp on a Lisp machine? To add to the fun, [David] created a previous project targeting ARM, so you’ve got even fewer excuses for not being able to access this. If you’ve managed to get your paws on the new Raspberry Pi Pico-2, then you can take your pick and run Lisp on either core type and still compile to native.

The Lisp-Risc-V project can be found in this GitHub repo, with the other tools easy enough to locate.

We see a fair few Lisp projects on these pages. Here’s another bare metal Lisp implementation using AVR. And how many lines of code does it take to implement Lisp anyway? The answer is 42 200 lines of C, to be exact.

Building An Automotive Load Dump Tester

For those who have not dealt with the automotive side of electronics before, it comes as somewhat of a shock when you find out just how much extra you have to think about and how tough the testing and acceptance standards are. One particular test requirement is known as the “load dump” test. [Tim Williams] needed to build a device (first article of three) to apply such test conditions and wanted to do it as an exercise using scrap and spares. Following is a proper demonstration of follow-through from an analytical look at the testing specs to some interesting hand construction.

Manhattan-style layout

The load dump test simulates the effect of a spinning automotive alternator in a sudden no-load scenario, such as a loose battery terminal. The sudden reduction in load (since the battery no longer takes charging current) coupled with the inductance of the alternator windings causes a sudden huge voltage spike. The automotive standard ISO 7637-2:2011 dictates how this pulse should be designed and what load the testing device must drive.

The first article covers the required pulse shape and two possible driving techniques. It then dives deep into a case study of the Linear Tech DC1950A load dump tester, which is a tricky circuit to understand, so [Tim] breaks it down into a spice model based around a virtual transistor driving an RC network to emulate the pulse shape and power characteristics and help pin down the specs of the parts needed. The second article deals with analysing and designing a hysteric controller based around a simple current regulator, which controls the current through a power inductor. Roughly speaking, this circuit operates a bit like a buck converter with a catch diode circulating current in a tank LC circuit. A sense resistor in the output path is used to feedback a voltage, which is then used to control the driving pulses to the power MOSFET stage. [Tim] does a good job modeling and explaining some of the details that need to be considered with such a circuit.

Continue reading “Building An Automotive Load Dump Tester”

Are CRT TVs Important For Retro Gaming?

We always thought the older console games looked way better back in the day on old CRTs than now on a modern digital display. [Stephen Walters] thinks so too, and goes into extensive detail in a lengthy YouTube video about the pros and cons of CRT vs digital, which was totally worth an hour of our time. But are CRTs necessary for retro gaming?

The story starts with [Stephen] trying to score a decent CRT from the usual avenue and failing to find anything worth looking at. The first taste of a CRT display came for free. Left looking lonely at the roadside, [Stephen] spotted it whilst driving home. This was a tiny 13″ Sanyo DS13320, which, when tested, looked disappointing, with a blurry image and missing edges. Later, they acquired a few more displays: a Pansonic PV-C2060, an Emerson EWF2004A and a splendid-looking Sony KV24FS120. Some were inadequate in various ways, lacking stereo sound and component input options.

A poor analog cable coupled with rendering inaccuracy gives a nice filtering effect

A large video section discusses the reasons for the early TV standards. US displays (and many others using NTSC) were designed for 525 scan lines, of which 480 were generally visible. These displays were interlaced, drawing alternating fields of odd and even line numbers, and early TV programs and NTSC DVDs were formatted in this fashion. Early gaming consoles such as the NES and SNES, however, were intended for 240p (‘p’ for progressive) content, which means they do not interlace and send out a blank line every other scan line.  [Stephen] goes into extensive detail about how 240p content was never intended to be viewed on a modern, sharp display but was intended to be filtered by the analogue nature of the CRT, or at least its less-than-ideal connectivity. Specific titles even used dithering to create the illusion of smooth gradients, which honestly look terrible on a pixel-sharp digital display. We know the differences in signal bandwidth and distortion of the various analog connection standards affect the visuals. Though RGB and component video may be the top two standards for quality, games were likely intended to be viewed via the cheaper and more common composite cable route.

Continue reading “Are CRT TVs Important For Retro Gaming?”

Building A 3D Printed Scanning Tunneling Microscope

YouTuber [MechnicalRedPanda] has recreated a DIY STM hack we covered about ten years ago, updating it to be primarily 3D-printed, using modern electronics, making it much more accessible to many folks. This simple STM setup utilises a piezoelectric actuator constructed by deliberately cutting a piezo speaker into four quadrants. With individual drive wires attached to the four quadrants. [MechPanda] (re)discovered that piezoelectric ceramic materials are not big fans of soldering heat. Still, in the absence of ultrasonic welding equipment, he did manage to get some wires to take to the surface using low-temperature solder paste.

As you can tell, you can only image conductive samples

A makeshift probe holder was glued on the rear side of the speaker actuator, which was intended to take a super sharp needle-like piece of tungsten wire. Putting the wire in tension and cutting at a sharp angle makes it possible with many attempts to get some usable points. Usable, in this instance, means sharp down the atomic level. The sample platform, actuator mount and all the connecting parts are 3D-printed with PA-CF. This is necessary to achieve enough mechanical stability with normal room temperature fluctuations. Three precision screws are used to level the two platforms in a typical kinematic mount structure, which looks like the only hard-to-source component. A geared stepper motor attached to the probe platform is set up to allow the probe to be carefully advanced towards the sample surface. Continue reading “Building A 3D Printed Scanning Tunneling Microscope”

Making A Split-Anode Magnetron

YouTuber The Science Furry has been attempting to make a split-anode magnetron and, after earlier failures, is having another crack at it. This also failed, but they’ve learned where to focus their efforts for the future, and it sure is fun to follow along.

The magnetron theory is simple enough, and we’ve covered this many times, but the split anode arrangement differs slightly from the microwave in your kitchen. The idea is to make a heated filament the cathode, so electrons are ejected from the hot surface by thermionic emission. These are forced into a spiral path using a perpendicular magnetic field. This is a result of the Lorentz force. A simple pair of magnets external to the tube is all that is needed for that. Depending on the diameter of the cavity and the gap width, a standing wave will be emitted. The anodes must be supplied with an alternating potential for this arrangement to work. This causes the electrons to ‘bunch up’ as they cross the gaps, producing the required RF oscillation. The split electrodes also allow an inductor to be added to tune the frequency of this standing wave. That is what makes this special.

Fizz, pop, ah well.

The construction starts with pre-made end seals with the tungsten wire electrode wire passing through. In the first video, they attempted to coat the cathode with barium nitrate, but this flaked off, ruining the tube. The second attempt replaces the coiled filament with a straight wire and uses a coating paste made from Barium Carbonate mixed with nitrocellulose in a bit of acetone. When heated, the nitrocellulose and the carbonate will decompose, hopefully leaving the barium coating intact. After inserting the electrode assembly into a section of a test tube and welding on the ends, the vacuum could be pulled and sealed off. After preheating the cathode, some gasses will be emitted into the vacuum, which is then adsorbed into a nearby titanium wire getter. At least, that’s the theory.

Upon testing, this second version burned out early on for an unknown reason, so they tried again, this time with an uncoated cathode. Measuring the emission current showed only 50 uA, which is nowhere near enough, and making the filament this hot caused it to boil off and coat the tube! They decide that perhaps this is one step too many and need to experiment with the barium coating by making simpler diode tubes to get the hang of the process!

If this stuff is over your head, you need a quick history lesson about the magnetron. Next check out this teardown. Finally, we have covered DIY magnetrons before, like this excellent DIY magnetron-powered plasma sputtering device. Yes, you read that correctly.

Continue reading “Making A Split-Anode Magnetron”