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.
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”
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”
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”
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”
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”
When reading textual communications, it can be difficult to accurately acertain emotional intent. Individual humans can be better or worse at this, with sometimes hilarious results when it goes wrong. Regardless, there’s nothing a human can do that a machine won’t eventually do better. For just this purpose, Tweetbot is here to emotionally react to Twitter so you don’t have to.
The ‘bot receives tweets over a bluetooth link, handled by a PIC32, which also displays them on a small TFT screen. The PIC then analyses the tweet for emotional content before sending the result to a second PIC32, which displays emotes on a second TFT screen, creating the robot’s face. Varying LEDs are also flashed depending on the emotion detected – green for positive emotions, yellow for sadness, and red for anger.
The final bot is capable of demonstrating 8 unique emotional states, far exceeding the typical Facebook commenter who can only express unbridled outrage. With the ‘bot packing displays, multiple microcontrollers, and even motor drives, we imagine the team learned a great deal in the development of the project.
The project was the product of [Bruce Land]’s ECE 4760 course, which has shown us plenty of great hacks in the past – Bike Sonar being one of our favorites. Video after the break.
Continue reading “Tweetbot Expresses Twitter Emotions”