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”

Audio Synthesizer Hooked Up With ChatGPT Interface

ChatGPT is being asked to handle all kinds of weird tasks, from determining whether written text was created by an AI, to answering homework questions, and much more. It’s good at some of these tasks, and absolutely incapable of others. [Filipe dos Santos Branco] and [Edward Gu] had an out of the box idea, though. What if ChatGPT could do something musical?

They built a system that, at the press of a button, would query ChatGPT for a 10-note melody in a given musical key. Once the note sequence is generated by the large language model, it’s played out by a PWM-based synthesizer running on a Raspberry Pi Pico.

Ultimately, ChatGPT is no musical genius. It’s simply picking a bunch of notes from a list that are known to work together melodically; that’s the whole point of musical keys. It would have been wild if it generated some riffs on the level of Stairway to Heaven or Spontaneous Devotion, but that might be asking for too much.

Here’s the question, though. If you trained a large language model, but got it to digest sheet music instead of written texts… could it learn to write music in various genres and styles? If someone isn’t working on that already, there’s surely an entire PhD you could get out of that idea alone. We should talk!

In any case, it’s one of the more creative projects from the ever-popular ECE 4760 class at Cornell. We’ve featured a bunch of projects from the class over the years, and noted how the course now runs on the RP2040. Continue reading “Audio Synthesizer Hooked Up With ChatGPT Interface”

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”

RP2040 DMA Hack Makes Another ‘CPU Core’

[Bruce Land] of Cornell University will be a familiar name to many Hackaday readers, searching the site for ‘ECE4760′ will bring up many interesting topics around embedded programming. Every year [Bruce] releases yet more of the students’ work out into the wild to our great delight. This RP2040-based project is a bit more abstract than some previous work and shows yet another implementation of an older hack to utilise the DMA hardware of the RP2040 as another CPU core. While the primary focus of the RP2040 DMA subsystem is moving data between memory spaces, with minimal CPU intervention, the DMA control blocks have some fairly complex behaviour. This allows for a Turing-complete CPU to be implemented purely with the DMA hardware and a sprinkling of memory.

The method ties up three of the twelve DMA channels, and is estimated to have a similar performance to ‘an Arduino’ but [Bruce] doesn’t specify which one of the varied models that could be. But who cares anyway? Programming the CPU is a matter of leveraging the behaviour of the hardware, which is all memory mapped and targetable by the DMA. For example, the CPU can waggle GPIO pins by using the DMA to write values to the peripheral address space. The basic flow can be seen in the image above. DMA0 is used as the program counter, which points DMA1 to an array of DMA control blocks, a sequence of which codes for some of the ‘opcodes’ of the CPU model. DMA0 chains to (hands over control to) DMA1 which reads the control blocks and configures itself accordingly. DMA1 performs whatever data move is programmed, chains to DMA2, which in turn reprograms the DMA0 program counter to point to the next block in the list to be executed by DMA1.

Continue reading “RP2040 DMA Hack Makes Another ‘CPU Core’”

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”

Tweetbot Expresses Twitter Emotions

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”

A Robot Arm For Virtual Beer Pong

Leave it to engineering students to redefine partying. [Hyun], [Justin], and [Daniel] have done exactly that for their final project by building a virtually-controlled robotic arm that plays beer pong.

There are two main parts to this build: a sleeve worn by the user, and the robotic arm itself. The sleeve has IMUs at the elbow and wrist and a PIC32 that calculates their respective angles. The sleeve sends angle data to a second PIC32 where it is translated it into PWM signals and sent to the arm.

There’s a pressure sensor wired sleeve-side that’s worn between forefinger and thumb and functions as a release mechanism. You don’t actually have to fling your forearm forward to get the robot to throw, but you can if you want to. The arm itself is built from three micro servos and mounted for stability. The spoon was a compromise. They tried for a while to mimic fingers, but didn’t have enough time to implement grasping and releasing on top of everything else.

Initially, the team wanted wireless communication between the sleeve and the arm. They got it to work with a pair of XBees, but found that RF was only good for short periods of use. Communication is much smoother over UART, which you can see in the video below.

You don’t have to have a machine shop or even a 3-D printer to build a robot arm. Here’s another bot made from scrap wood whose sole purpose is to dunk tea bags.

Continue reading “A Robot Arm For Virtual Beer Pong”