The Shell And The Microcontroller

One of the nicest amenities of interpreted programming languages is that you can test out the code that you’re developing in a shell, one line at a time, and see the results instantly. No matter how quickly your write-compile-flash cycle has gotten on the microcontroller of your choice, it’s still less fun than writing blink_led() and having it do so right then and there. Why don’t we have that experience yet?

If you’ve used any modern scripting language on your big computer, it comes with a shell, a read-eval-print loop (REPL) in which you can interactively try out your code just about as fast as you can type it. It’s great for interactive or exploratory programming, and it’s great for newbies who can test and learn things step by step. A good REPL lets you test out your ideas line by line, essentially running a little test of your code every time you hit enter.

This is your development environment

The obvious tradeoff for ease of development is speed. Compiled languages are almost always faster, and this is especially relevant in the constrained world of microcontrollers. Or maybe it used to be. I learned to program in an interpreted language — BASIC — on computers that were not much more powerful than a $5 microcontroller these days, and there’s a BASIC for most every micro out there. I write in Forth, which is faster and less resource intensive than BASIC, and has a very comprehensive REPL, but is admittedly an acquired taste. MicroPython has been ported over to a number of micros, and is probably a lot more familiar.

But still, developing MicroPython for your microcontroller isn’t developing on your microcontroller, and if you follow any of the guides out there, you’ll end up editing a file on your computer, uploading it to the microcontroller, and running it from within the REPL. This creates a flow that’s just about as awkward as the write-compile-flash cycle of C.

What’s missing? A good editor (or IDE?) running on the microcontroller that would let you do both your exploratory coding and record its history into a more permanent form. Imagine, for instance, a web-based MicroPython IDE served off of an ESP32, which provided both a shell for experiments and a way to copy the line you just typed into the shell into the file you’re working on. We’re very close to this being a viable idea, and it would reduce the introductory hurdles for newbies to almost nothing, while letting experienced programmers play.

Or has someone done this already? Why isn’t an interpreted introduction to microcontrollers the standard?

Bare-Metal STM32: Universal, Asynchronous Communication With UARTs

One of the most basic and also most versatile communication interfaces on an MCU is the UART, or Universal Asynchronous Receiver/Transmitter. Usually found in the form of either a UART or USART, the former allows for pure asynchronous serial communication, whereas the latter adds flow control. When working with MCUs, they’re also one of the most common ways to output debug information.

While somewhat trickier to set up and use than a GPIO peripheral, the U(S)ART of ST’s STM32 families is fairly uncomplicated to use, and immediately provides one with an easy way to communicate in a bi-directional fashion with a device. In this article we’ll see what it takes to get started with basic UART communication on STM32 microcontrollers.

Continue reading “Bare-Metal STM32: Universal, Asynchronous Communication With UARTs”

Active Camouflage Material Shows Promise At Hiding From Infrared Or Visual Detection

An invisibility cloak may seem like science fiction, but despite that, many scientists and engineers have put much time into developing the concept, pushing it closer to reality. A device which detects the nature of its surroundings and changes its own properties to blend in may be complex, but a multitude of examples in the animal world show that it’s not impossible to achieve.

A team from Seoul National University recently developed a flexible material designed in part as a flexible “cloaking” material. We’ll take a look at the underlying concept behind such devices below, and look at how this work furthers the state of the art in the field.

Continue reading “Active Camouflage Material Shows Promise At Hiding From Infrared Or Visual Detection”

The Day The Russians And Americans Met 135 Miles Up

If you watched the original Star Trek series, you’d assume there was no way the Federation would ever work with the Klingons. But eventually the two became great allies despite their cultural differences. There was a time when it seemed like the United States and Russia would never be friends — as much as nations can be friends. Yet today, the two powers cooperate on a number of fronts.

One notable area of cooperation is in spaceflight, and that also was one of the first areas where the two were able to get together in a cooperative fashion, meeting for the first time in orbit, 135 miles up.  The mission also marks the ultimate voyage of the Apollo spacecraft, a return to space for the USSR’s luckiest astronauts, and the maiden flight of NASA’s oldest astronaut. The ability to link US and Soviet capsules in space would pave the way for the International Space Station.  The Apollo-Soyuz mission was nothing if not historic, but also more relevant than ever as more nations become spacefaring. Continue reading “The Day The Russians And Americans Met 135 Miles Up”

You Got Something On Your Processor Bus: The Joys Of Hacking ISA And PCI

Although the ability to expand a home computer with more RAM, storage and other features has been around for as long as home computers exist, it wasn’t until the IBM PC that the concept of a fully open and modular computer system became mainstream. Instead of being limited to a system configuration provided by the manufacturer and a few add-ons that really didn’t integrate well, the concept of expansion cards opened up whole industries as well as a big hobbyist market.

The first IBM PC had five 8-bit expansion slots that were connected directly to the 8088 CPU. With the IBM PC/AT these expansion slots became 16-bit courtesy of the 80286 CPU it was built around. These slots  could be used for anything from graphics cards to networking, expanded memory or custom I/O. Though there was no distinct original name for this card edge interface, around the PC/AT era it got referred to as PC bus, as well as AT bus. The name Industry Standard Architecture (ISA) bus is a retronym created by PC clone makers.

With such openness came the ability to relatively easy and cheaply make your own cards for the ISA bus, and the subsequent and equally open PCI bus. To this day this openness allows for a vibrant ecosystem, whether one wishes to build a custom ISA or PCI soundcard, or add USB support to a 1981 IBM PC system.

But what does it take to get started with ISA or PCI expansion cards today? Continue reading “You Got Something On Your Processor Bus: The Joys Of Hacking ISA And PCI”

Amazon’s Custom T-Shirt May Rub You The Wrong Way

How far would you go in pursuit of the perfect black t-shirt? Would you let Amazon build a virtual double of your body? They already know so much about you, so what’s a body scan or two between customer and company?

So here’s the deal — Amazon is trying to launch a brand of bespoke clothing called Made for You, and they’re starting with custom solid color t-shirts. Here’s how it works: you give them $25 along with information about your height, weight, and skin tone. Then you upload two pictures of your torso to their app, and these get turned into a 3D model of your body. Once your avatar is built to match, you design your shirt to fit the model. In theory, you get a really good idea of how it will fit.

You can choose from two different fabrics and eight colors, and can customize the neckline, the shirt length, and the sleeve length. If you want to, you can put your name on the tag. Then your perfect t-shirt gets made in the US from imported fabric — either lightweight or medium weight pima cotton. We’re not sure if robots or people are making them, but our money is on people. After all, Amazon is the company that created Mechanical Turk to form a pool of humans available to do on-demand work via the Internet. This is along those lines but with tailors sewing to your specifications. The big questions are what do you get, how does the technology make these better than off-the-rack, and do you give up your privacy in return?

One-Size Fits One

To say that these are custom t-shirts is a bit of a stretch. Oh you don’t need to worry about the t-shirts being skin-tight and showcasing your spare tire — if it’s a relaxed fit you want, that’s one of the options. But the current options are limited.

Continue reading “Amazon’s Custom T-Shirt May Rub You The Wrong Way”

Solar Flares And Radio Communications — How Precarious Are Our Electronics?

On November 8th, 2020 the Sun exploded. Well, that’s a bit dramatic (it explodes a lot) — but a particularly large sunspot named AR2781 produced a C5-class solar flare which is a medium-sized explosion even for the Sun. Flares range from A, B, C, M, and X with a zero to nine scale in each category (or even higher for giant X flares). So a C5 is just about dead center of the scale. You might not have noticed, but if you lived in Australia or around the Indian Ocean and you were using radio frequencies below 10 MHz, you would have noticed since the flare caused a 20-minute-long radio blackout at those frequencies.

According to NOAA’s Space Weather Prediction Center, the sunspot has the energy to produce M-class flares which are an order of magnitude more powerful. NOAA also has a scale for radio disruptions ranging from R1 (an M1 flare) to R5 (an X20 flare). The sunspot in question is facing Earth for the moment, so any new flares will cause more problems. That led us to ask ourselves: What if there were a major radio disruption?

Continue reading “Solar Flares And Radio Communications — How Precarious Are Our Electronics?”