Blinky Project Is 6502s All The Way Down

Virtually any platform you might find yourself programming on has some simple method of running a delay. [Joey Shepard] got rather creative on a recent project, though, relying on a rather silly nesting method that we’re calling 6502s All The Way Down.

The project in question was a simple PCB that was shaped like a robot, with blinking LED eyes. Typically, you’d simply reach for the usual sleep() or delay() function to control the blink rate, but [Joey] went off-piste for this one. Instead, the PIC32 on the board runs a 6502 emulator written in MIPS assembly. This emulated 6502 is then charged with running a further 6502 emulator coded in 6502 assembly, and so on, until there’s 6502 emulators running six-deep on the humble microcontroller. The innermost emulator runs a simple program that blinks the LED eyes in a simple loop. With the overhead of running six emulators, though, the eyes only blink at a rate of roughly once every two seconds.

It’s an amusing and complicated way to write a blink program, and we applaud [Joey] for going to all that trouble. We imagine it was a great way to learn about programming the PIC32 as well as emulation in general. Meanwhile, if you’re working on your own emulator feats, be sure to let us know!

Blink An LED On A PIC32 With Rust, Easily

Got a PIC32 microcontroller and a healthy curiousity about the Rust programming language and its low-level capabilities, but unsure how to squash the two of them together with a minimum of hassle? If that’s the case, then today is your lucky day!

[Harry Gill] has you covered with his primer on programming a PIC32 with Rust, which will have you blinking an LED in no time. [Harry] admits that when he got started, his microcontroller programming skills were a bit rusty, so don’t let yourself think setting this up is beyond your abilities. If you have a working knowledge of the basics of microcontroller programming, you’ll be fine. [Harry] had to jump through a few hoops to get the right tools working, but thoughtfully documented the necessary steps, and provides a bare minimum hardware list.

Unsure what Rust is or what it offers? Check out the basics here, and see if it’s something that interests you. If you want to look even deeper, check out the kind of work that goes into writing a bare metal kernel in Rust.

Logic Meter Aims To Make Hobby Electronics Troubleshooting Easier

The basic test instrument suite — a bench power supply, a good multimeter and perhaps an oscilloscope — is extremely flexible, but not exactly “plug and play” when it comes to diagnosing problems with some common hardware setups. A problem with a servo driver, for example, might be easy enough to sort of with a scope, but setting everything up to see what’s going on with the PWM signal takes some time.

There’s got to be a better way to diagnose hobby electronics woes, and if [Bob Alexander] has his way, his “Logic Meter”, or something very close to it, will be the next must-have bench tool. The Logic Meter combines some of the functionality of an oscilloscope and a logic analyzer into a handy instrument that’s as easy to use as a multimeter. The Logic Meter’s probes connect to logic-level signals in a circuit and can be set up to capture or send serial data, either directly to or from a UART or via an SPI bus connection. There are also functions for testing servos and similar devices with a configurable PWM output. [Bob] rounds out the functionality with a GPS simulator and a simple logic analyzer, plus some utility functions.

The beauty part of the Logic Meter is that [Bob] has left where it goes next largely up to the community. He’s got a GitHub repo with details on the PIC32-based hardware, and the video below makes it clear that this is just a jumping-off point to further work that he hopes results in a commercial version of the Logic Meter. That’s a refreshing attitude, and we hope it pays off; from the look of a few of [Bob]’s retrocomputing makeovers, something like the Logic Meter could come in pretty handy.

Continue reading “Logic Meter Aims To Make Hobby Electronics Troubleshooting Easier”

PIC32 DMA Is A Weird Machine

Direct memory access (DMA) systems in computers are more powerful than you might think, and [Bruce Land] and [Joseph Primmer] have done some clever hacking to take full advantage of this on the PIC32 microcontrollers. This is a cool proof-of-concept hack — you can do general computing in the DMA subsystem without using the CPU at all if you don’t mind taking your time — but they also include two useful examples: a direct digital synthesis machine and a random number generator. Both of these run using exactly 0% CPU time.

How do they do it? DMA is a mechanism for shuttling data around in memory or between hardware peripherals without involving the CPU. Say you want to take a large block of memory containing music, and spit it out slowly to an I2S audio converter. A DMA subsystem could be configured to take an interrupt from the sound chip, pass it a chunk of data, increment the data pointer, and wait for the next interrupt.

The gimmick, which goes back at least to [Rushanan] and [Checkoway]’s “Run DMA” paper, is that you can modify the memory source and destination addresses of one DMA service from another DMA service, and that some registers automatically perform mathematical operations on whatever data is put into them. Combine these together, and you’ve got transport-triggered programming.

(An awesome side-note: our own [Al Williams] developed a one-instruction transport-triggered CPU way back in the day: the One Instruction Wonder.)

What is this good for? Writing simple helper applications that run independent of the CPU on a PIC32 microcontroller. [Land] and [Primmer]’s direct-digital synthesis example is a great one. But there are a lot of cases where you simply want to take in some new data and pre-process it a little bit before it enters the main program flow. While creating weird machines in the DMA engine might be a slower way to get it done, it keeps the CPU free for doing other stuff. We’re sure you’ll come up with something.

Microcontroller Studies The Blade

Kendo, a Japanese martial art, is practiced with a special sword. It’s not a particularly sharp sword, though, since the “blade” is essentially a length of bamboo. For this reason, Kendo practitioners must rely on correct form and technique in order to make sure their practice is as effective as possible, and Cornell students [Iman] and [Weichen] have made a Kendo trainer that helps the swordsmen in their art.

The core of the project is a PIC32 microcontroller hooked up to a set of three piezoelectric sensors and a LSM9DS1 inertial module. The three piezoelectric sensors are attached to a helmet and the inertial module to the sword, and the sensors work together to determine both the location of the strike and whether or not it had enough strength to be considered a “good” strike (the rules of Kendo are beyond the scope of this article). The trainer can then calculate all of the information and provide feedback to the user on a small screen.

While martial-arts related builds seem to be relatively rare, we did find a similar project from back in 2011 called the Virtual Sensei which used a then-popular Kinect in order to track movements. This PIC32-based project, though, seems to be a little more thorough by including the strength of the strike in the information the computer uses, and is probably less expensive to boot!

Continue reading “Microcontroller Studies The Blade”

Additive, Multi-Voice Synth Preserves Sounds, Too

For his final project in [Bruce Land]’s microcontroller design class, [Mark] set out to make a decently-sized synth that sounds good. We think you’ll agree that he succeeded in spades. Don’t let those tiny buttons fool you, because it doesn’t sound like a toy.

Why does it sound so good? One of the reasons is that the instrument samples are made using additive synthesis, which essentially stacks harmonic overtones on top the fundamental frequency of each note. This allows synthesizers to better mimic the timbre of natural, acoustic sounds. For each note [Mark] plays, you’re hearing a blend of four frequencies constructed from lookup tables. These frequencies are shaped by an envelope function that improves the sound even further.

Between the sound and the features, this is quite an impressive synth. It can play polyphonically in piano, organ, or plucked string mode through a range of octaves. A PIC32 runs the synthesizer itself, and a pair of helper PIC32s can be used to record songs to be played over. So [Mark] could record point and counterpoint separately and play them back together, or use the helper PICs to fine-tune his three-part harmony. We’ve got this thing plugged in and waiting for you after the break.

If PICs aren’t what you normally choose, here’s an FPGA synth.

Continue reading “Additive, Multi-Voice Synth Preserves Sounds, Too”

AirBass Lets You Jam Wherever

If you play an instrument, you know how rewarding it is to watch and hear yourself reproduce your favorite songs and make new melodies. But you also know how steep the learning curve can be, how difficult it is to learn positions and notes while your body adjusts to the physical side. For stringed instruments, that means gaining muscle memory, growing fingertip calluses, and getting used to awkward arm positions.

For their final project in [Bruce Land]’s class on designing with microcontrollers, [Caitlin, Jackson, and Peter] decided to make a more accessible bass guitar. For starters, it can be placed flat on a table similar to a pedal steel guitar to get around those awkward arm positions. Instead of plucking or slapping the strings, the player wears a glove with a flex resistor on each finger, and plays the string by curling and uncurling their finger.

We think the team’s implementation of the left hand duties and fretboard is pretty clever. Each of the four strings has a break-beam detection circuit, and a single distance sensor decides where the finger is along the fretboard. Another great thing about this backpack-sized bass is that it never needs tuning. If you stay tuned, you can hear [Peter] play “Smoke On the Water” after the break.

There’s more than one way to make an air guitar — this one that does it with LIDAR.

Continue reading “AirBass Lets You Jam Wherever”