Simon Says With An RP2040

The team of [Michael] and [Chimdi] from Cornell’s Designing with Microcontrollers (ECE 4760) Fall 2023 session designed a version of Simon Says on an RP2040 which they call Pico Says. It uses UDP packets over WiFi to communicate between the players, and supports VGA graphics for output. Each player’s hardware consists of a Pico W module plus a control panel containing the four LEDs and buttons ( red, green, yellow, and blue ) plus send and reset buttons.

For purposes of this lab, the modules were build on a solderless breadboard and used perfboard for the control panels. They weren’t entirely happy with their choice of UDP because they experienced frequent datagram dropouts in the noisy environment of the microcontroller lab. They also planned to implement sound effects, but ran out of time after spending too much time on the WiFi implementation, and had to drop that feature. In the end, however, they wrapped up their project and demonstrated a working game. We can only speculate whether this bonus lesson in resource management was intended by [Dr. Hunter Adams] or not.

Two ECE 4760 course references are highlighted in the write-up that helped them jump-start the project: the UDP and VGA examples for the Pico. These are good links to put in your RP2020 toolbox for future projects, in addition to the ECE 4760 course home page itself. We’ve covered several of these projects recently, as well as the curriculum switch from the Microchip PIC32MX-based Microstick II to the RP2040 last Spring.

Continue reading “Simon Says With An RP2040”

A Deep Dive Into Quadcopter Controls

In the old days, building a quadcopter or drone required a lot of hacking together of various components from the motors to the batteries and even the control software. Not so much anymore, with quadcopters of all sizes ready to go literally out-of-the-box. While this has resulted in a number of knock-on effects such as FAA regulations for drone pilots, it’s also let us disconnect a little bit from the more interesting control systems these unique aircraft have. A group at Cornell wanted to take a closer look into the control systems for drones and built this one-dimensional quadcopter to experiment with.

The drone is only capable of flying in one dimension to allow the project to more easily fit into the four-week schedule of the class, so it’s restricted to travel along a vertical rod (which also improves the safety of the lab).  The drone knows its current position using an on-board IMU and can be commanded to move to a different position, but it first has to calculate the movements it needs to make as well as making use of a PID control system to make its movements as smooth as possible. The movements are translated into commands to the individual propellers which get their power from a circuit designed from scratch for this build.

All of the components of the project were built specifically for this drone, including the drone platform itself which was 3D printed to hold the microcontroller, motors, and accommodate the rod that allows it to travel up and down. There were some challenges such as having to move the microcontroller off of the platform and boosting the current-handling capacity of the power supply to the motors. Controlling quadcopters, even in just one dimension, is a complex topic when building everything from the ground up, but this guide goes some more of the details of PID controllers and how they help quadcopters maintain their position.

Continue reading “A Deep Dive Into Quadcopter Controls”

An Entire RISC-V Operating System In 2000 Lines

While Microsoft and Apple don’t release the source code for their operating systems, a good estimate is that it takes around 50 million lines of code to run these software behemoths. The Linux kernel alone holds around 30 million lines, with systemd containing over one million lines on its own, which doesn’t include estimates for the desktop environment or other parts of a standard installation. But millions of lines of code, or even hundreds of thousands, aren’t necessary for building a fully functioning operating system. This one sets up a complete OS in exactly 2000 lines of code.

Called egos-2000, short for Earth and Grass Operating System, the diminutive operating system is written for RISC-V computers and while it does contain most of the tools we would recognize in an OS, it was built specifically for computer science students by PhD candidate Yunhao Zhang. The slimmed-down operating system makes it possible for students to easily read and understand every feature of an operating system without it becoming too overwhelming, and can be easily used and modified to experiment with. The name itself comes from its design principles, where parts of the operating system that interact with hardware directly are part of the “Earth” layer and parts that don’t depend on hardware being placed in the “Grass” layer, with applications taking up a third layer.

The OS is available on this GitHub page under an MIT license and works on real RISC-V hardware as well as within various emulators. Building a complete operating system in so few lines of code is an impressive feat, and making it comprehensive enough to teach students with goes well beyond that accomplishment as well. Often when concepts in computer science are reduced to their bare minimum components, we end up with completely illegible (but interesting) experiments like this programming language instead.

Mice Play In VR

Virtual Reality always seemed like a technology just out of reach, much like nuclear fusion, the flying car, or Linux on the desktop. It seems to be gaining steam in the last five years or so, though, with successful video games from a number of companies as well as plenty of other virtual reality adjacent technology that seems to be picking up steam as well like augmented reality. Another sign that this technology might be here to stay is this virtual reality headset made for mice. Continue reading “Mice Play In VR”

Learn Compilers Online From Cornell

It sounds like the start of a joke, but what’s the difference between taking Cornell’s CS6120 online and in-person? The instructor, [Adrian Samspon] notes that the real class has deadlines, an end-of-semester project, and a discussion board that is only open to real-life students. He also notes that you only earn “imagination credits.”

Still, this is a great opportunity to essentially audit a PhD-level computer science class on a fascinating topic. The course consists of videos, papers, and open source projects using LLVM and a custom internal representation based on JSON that is made for the class. It is all open source, too. You do however need access to the papers, some of which are behind paywalls. Your local library can help if you can’t otherwise find copies of the papers.

Continue reading “Learn Compilers Online From Cornell”

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”

Yo Dawg, I Heard You Like FPGAs

When the only tool you have is a hammer, all problems look like nails. And if your goal is to emulate the behavior of an FPGA but your only tools are FPGAs, then your nail-and-hammer issue starts getting a little bit interesting. That’s at least what a group of students at Cornell recently found when learning about the Xilinx FPGA used by a researcher in the 1990s by programming its functionality into another FPGA.

Using outdated hardware to recreate a technical paper from decades ago might be possible, but an easier solution was simply to emulate the Xilinx in a more modern FPGA, the Cyclone V FPGA from Terasic. This allows much easier manipulation of I/O as well as reducing the hassle required to reprogram the device. Once all of that was set up, it was much simpler to perform the desired task originally set up in that 90s paper: using evolutionary algorithms to discriminate between different inputs.

While we will leave the investigation into the algorithms and the I/O used in this project as an academic exercise for the reader, this does serve as a good reminder that we don’t always have to have the exact hardware on hand to get the job done. Old computers can be duplicated on less expensive, more modern equipment, and of course video games from days of yore are a snap to play on other hardware now too.

Thanks to [Bruce Land] for the tip!