RP2040 Boot Loader Is A Worm

[Hunter Adams] has written a secondary bootloader for the RP2040 that uses an IR link and can be extended to behave like a polite worm virus. This allows the easy updating of a large cluster of co-located RP2040-based controllers. This could be handy in applications like swarm robotics or virtual cattle fencing. The project he demonstrates in the two videos ( below the break ) uses a pair of IR transmitters/receivers. But he purposely wrote the boot loader to be independent of the serial link, which could be infrared, radio, audio, or just wires.

Not only did [Hunter] make a boot loader, but he documented the entire boot process of the RP2040 chip. Whether or not you need a secondary bootloader, this is an excellent resource for understanding how the RP2040 responds to power cycling and resets. The boot loader code is available at his GitHub repository.

You may recall that [Hunter] is the lecturer of Cornell University’s Designing with Microcontroller classes, whom we’ve mentioned before. We’ve also covered some of his students’ projects as well, like these air drums and this CoreXY pen plotter.

Continue reading “RP2040 Boot Loader Is A Worm”

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”

Turning Sounds From A Flute Into Sheet Music

Composing music can be quite difficult – after all, you have to keep in mind all of the elements of musical theory, from time signature and key signature to the correct length for all of the notes. A team of students from Cornell University’s Designing with Microcontrollers class developed a solution for this problem by transcribing sounds from a flute into sheet music.

The project doesn’t simply detect the notes played – it is able to convert the raw audio into a standardized music score complete with accurate note timings and beats per minute. Before transcribing the music, some audio processing was necessary. The team chose to use a Sallen-Key filter to amplify the raw audio input due to its complex conjugate poles. They then used a fast Fourier Transform (FFT) to determine the frequency for the input note, converting the signal from the time domain to the frequency domain.

The algorithm samples the data to generate an input signal, using the ADC on the microcontroller to receive input from the microphone. It takes the real and imaginary components of the sampled signals and outputs a pair of real and imaginary amplitude components corresponding to the sampled frequency, evenly spaced from 0 to the Nyquist rate (half the sampling rate). The spacing of these bins and the bin with the largest amplitude are used to convert the signal back to a real frequency and a MIDI note.

The system uses a PIC32 for the logic. The circuitry for the microphone amplification uses a non-inverting op-amp with a gain of 50 to increase the microphone output signal amplitude from 15 mV to 750 mV to use by the microcontroller’s ADC. The signal is then sent to the anti-aliasing Sallen-Key filter, with a pole at 2.5 kHz and a Q of 1. The frequency was chosen since the FFT samples at 8 kHz and the frequency corresponds to a note out of the range of a flute. As for the filters, only the low pass filter was implemented in hardware.  While a bandpass filter could have been implemented in hardware, the team decided on a cleaner software approach.

The project is well-documented on the team’s project page, and it’s certainly worth checking out for more detailed discussions on the keypad controls and the software side of the audio processing. If you want to learn more about the FFT, check out this 2016 Hackaday Prize entry for an FFT spectrum analyezer.

Continue reading “Turning Sounds From A Flute Into Sheet Music”

PIC-Powered Game Console Is Blocky Goodness

Picking up new skills in the electronics field is often best served by the classic mantra – “learn by doing”. [Juan] and [Leo] did just that, deciding to build a handheld game console for a University project, and delivering the PGC-32.

Built as a final project for the Digital Systems Design course at Cornell University, the PGC-32 takes on a daunting chunk of functionality, and pulls it off in time to get the grades. The team coded a basic block-based game for the hardware, and control is switchable between the analog stick and a built-in accelerometer. Gameplay is displayed on a 320 x 280 color TFT display. Learning to code a basic game is useful, as it teaches student engineers to consider important concepts like timing, race conditions, interrupts, and display routines.

As a university project, it is well documented and the team step through each detail in their code with explanations as to how and why things are done. The internals are particularly neat, too, with a tidy PCB layout and 3D printed case holding everything together.

We’ve seen plenty of work from Cornell’s courses before, too – like this sleep quality monitor.  Video after the break.

Continue reading “PIC-Powered Game Console Is Blocky Goodness”

Rickroll The Masses With A Coin Cell Throwie

If there is one educational institution that features on these pages more than any other, it may be Cornell University. Every year we receive a pile of tips showing us the engineering term projects from [Bruce Land]’s students, and among them are some amazing pieces of work. Outside the walls of those technical departments though, we suspect that cool hacks may have been thin on the ground. English Literature majors for example contain among their ranks some astoundingly clever people, but they are not known for their handiness with a soldering iron or a lathe.

We’re happy to note then that someone at Cornell who is handy with a soldering iron has been spreading the love. In the form of coin cell powered throwies that intermittently Rickroll the inhabitants of the institution’s halls of residence. We have few technical details, but they seem to be a simple affair of a small microcontroller dead-bug soldered to a coin cell and a piezoelectric speaker. If we were embarking on such a project we’d reach for an ATtiny of some description, but similar work could be done with a PIC or any number of other families.

The Cornell Daily Sun write-up is more a work of investigative journalism detailing the perplexed residents searching for the devices than it is one of technical reference. We’re pleased to note that the university authorities have a relaxed attitude to the prank, and that no action will be taken against the perpetrator should they be found.

Thus we’d like to take a moment to reach out to the Cornell prankster, and draw their attention to our Coin Cell Challenge competition. There is still time to enter, and a Rickrolling throwie would definitely qualify. This isn’t the first tiny Rickrolling prank we’ve shown you on these pages.

Thanks [Simon Yorkston] for the tip.

Final Project For Better Sleep

It’s that time of year again, and students around the world are scrambling (or have already scrambled) to finish their final projects for the semester. And, while studying for finals prevents many from sleeping an adequate amount, [Julia] and [Nick] are seeking to maximize “what little sleep the [Electrical and Computer Engineering] major allows” them by using their final project to measure sleep quality.

To produce a metric for sleep quality, [Julia] and [Nick] set out to measure various sleep-related activities, specifically heart rate, motion and breath frequency. During the night, an Arduino Nano mounted to a glove collects data from the various sensors mounted to the user, all the while beaming the data to a stationary PIC for analysis and storage. When the user awakes, they can view their sleep report on a TFT display at the PIC base station. Ideally, users would use this data to test different habits in order to get the best nights sleep possible.

Interestingly, the group chose to implement their own heart rate sensor. With an IR transmitter, IR phototransistor and an OP amp, the group illuminates user’s fingers and measure reflection to detect heartbeats. This works because the amount of IR reflected from the user’s finger changes with blood pressure and blood oxygen level, which also happen to change when the heart is beating. There were some bumps along the road when it came to the heartbeat sensor (the need to use a finger instead of the wrist forced them to use a glove instead of a wristband), but we think it’s super cool and totally worth it. In addition to heart rate, motion is measured by an accelerometer and breath is measured by a flex sensor wrapped around the user’s chest.

With all of their data beamed back by a pair of nRF24L01s, the PIC computes the sleep “chaos” which is exactly what it sounds like: it describes just how chaotic the user slept by looking for acyclic and sudden movement. Using this metric, combined with information from breathing and heart rate, the PIC computes a percentage for good sleep where 100% is a great night and 0% means you might have been just as well off pulling an all-nighter. And, to top it all off, the PIC saves your data to an SD card for easy after-the-fact review.

The commented code that powers the project can be found here along with a parts list in their project write-up.

This device assumes that sleeping is the issue, but if waking up if your problem, we’ve already got you covered, aggressive alarm clock style. For those already on top of their sleep, you might want some help with lucid dreaming.

Video of the project explained by [Julia] and [Nick] after the break.

Continue reading “Final Project For Better Sleep”

An Education On SoC Using Verilog

[Bruce Land] is one of those rare individuals who has his own Hackaday tag. He and his students at Cornell have produced many projects over the years that have appeared on these pages, lately with FPGA-related projects. If you only know [Land] from projects, you are missing out. He posts lectures from many of his classes and recently added a series of new lectures about developing with a DE1 System on Chip (SoC) using an Altera Cyclone FPGA using Verilog. You can catch the ten lectures on YouTube.

The class material is different for 2017, so the content is fresh and relevant. The DE1-SOC has a dual ARM processor and boots Linux from an SD card. There are several labs and quite a bit of background material. The first lab involves driving a VGA monitor. Another is a hardware solver for ordinary differential equations.

Continue reading “An Education On SoC Using Verilog”