Cornell Updates Their MCU Course For The RP2040

The School of Electrical and Computer Engineering at Cornell University has made [Bruce Land]’s lectures and materials for the Designing with Microcontrollers (ECE 4760) course available for many years. But recently [Bruce], who semi-retired in 2020, and the new lecturer [Hunter Adams] have reworked the course and labs to use the Raspberry Pi Pico. You can see the introductory lecture of the reworked class below.

Not only are the videos available online, but the class’s GitHub repository hosts extensive and well-documented examples, lecture notes, and helpful links. If you want to get started with RP2040 programming, or just want to dig deeper into a particular technique, this is a great place to start.

From what we can tell, this is the third overhaul of the class this century. Back in 2012 the course was using the ATmega1284 AVR microcontroller, and in 2015 it switched to the Microstick II using a Microchip PIC32MX. Not only were these lecture series also available free online, but each has been maintained as reference after being replaced. One common thread with all of these platforms is their low cost of entry. Assuming you already have a computer, setting up the hardware and software development environment for these modules costs less than the price of a pizza dinner, a fact no doubt appreciated by the ECE department’s budget director.

We’ve covered this course before back in 2015 when it first changed. Another free online course on embedded system design is from [Prof James Conrad] at UNC Charlotte, based on the Renasas RX63N microcontroller — the UNC Charlotte team drove development of the autonomous vehicle project we covered back in 2009. If you know of other online embedded systems classes, let us know in the comments below.

Continue reading “Cornell Updates Their MCU Course For The RP2040”

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”

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”

Team Scores Big Points With Pinball Final Project

For their final project in [Bruce Land]’s class on designing with PIC32 microcontrollers, [Sujith], [Julia] and [Andrew] wanted to do something fun. And what could be more fun than bending to the electromechanical siren song of the pinball machine?

This machine looks great, and as you can see in the demo video after the break, it plays and sounds great, too. We particularly like the boomerang obstacle and the game state-driven LED strip. The more points you score, the brighter they go. We also like that this machine combines traditional scoring methods with a few really clever ones, like the boomerang target near the top and the scoring triggers made from copper tape.

The team started by designing the heart of any pinball machine, the flippers. Though we have seen car door lock actuators used in homebrew machines, the team went with traditional solenoids to drive them. Unfortunately the solenoids caused a lot of interference, but the team got around it with filter capacitors and aluminium foil Faraday cages around the wires.

If all this pinball talk has your circuits lit up, why not try making your own machine? Continue reading “Team Scores Big Points With Pinball Final Project”

A Modular Logic Analyzer For FPGAs

When working on a project, it’s incredibly helpful to be able to visualize the various signals in play. This is important when attempting to determine if what is supposed to be happening is actually happening. However, logic analyzers can be expensive, so a group from [Bruce Land]’s ECE5760 class developed their own hardware solution instead.

The primary idea behind the project is modularity. The basic building blocks of the logic analyser are coded in Verilog. They’re designed so that the number of channels and added functions can be mixed and match to suit the given purpose and the capabilities of the target FPGA platform. The team’s logic analyzer is also capable of decoding SPI and I2C in hardware, and has a graphical user interface running on an attached laptop for visualizing signals.

It’s a tidy build, and an excellent project to learn the fundamentals of both FPGA programming and the various communications protocols involved. [Bruce Land]’s classes are a hotbed of FPGA projects, from pokerbots to NES chiptune emulators. Video after the break.

Continue reading “A Modular Logic Analyzer For FPGAs”

PokerBot Uses FPGA For Card Calculating Horsepower

Played against humans, Poker is a game as much about reading your opponent as it is about the cards you’re dealt. That doesn’t mean there aren’t certain mathematical ways to aid your decision making based on probabilities. In this vein, a group of students from Cornell’s ECE 5760 class built a pokerbot on an FPGA.

The bot uses the principle of Monte Carlo simulation to calculate the probabilities of an individual winning a hand of Limit Texas Hold’em. Calculating the entire set of possible hands is impractical, so in a Monte Carlo simulation a sample is calculated instead. By accelerating these calculations on an FPGA, the pokerbot is able to calculate 300,000 possible hands in just 150 ms, and present a probability of winning to the human player. This same calculation method is then used to make decisions for the computer players in the game, too.

The team report that the FPGA’s processing power brought a 10x speed up compared to their C++ program running on an Intel i7-6700HQ. The strong statistical calculations help to make the computer players engaging and realistic to play against.

It’s another great example of a project from Bruce Land’s classes, which are somewhat of a hotbed of development each year. Video after the break.

Continue reading “PokerBot Uses FPGA For Card Calculating Horsepower”