Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
141431 stories
·
32 followers

Raspberry Pi Pico–powered drum machine

1 Share

A brand-new issue of Raspberry Pi Official Magazine is out today! One of our favourite projects featured therein is this one, in which Phil King teaches us how to play drum samples at the press of a button with Raspberry Pi Pico.

This project was inspired by Arnov Sharma’s Pico drum machine, for which he created a custom PCB to house the buttons

While the first ever drum machine is considered to be the Rhythmicon, developed by Leon Theremin (yes, he invented that instrument too) in the early 1930s, digital drum machines came to the fore in the 1980s with the likes of the Linn LM-1. The latter cost the equivalent of over $19,000 today, and yet we can now create a DIY drum machine using a $5 Raspberry Pi Pico.

Inspired by Arnov Sharma’s project on Hackster, your author decided to try to create a Pico-powered drum machine using a DF Mini Player to play the drum samples. While Arnov’s version uses a custom PCB for the buttons, we decided to keep it simple with a breadboard-based design — the downside being the spaghetti of jumper wires needed to connect everything up. Still, the principle is the same: you press different push buttons to trigger different drum samples on the DF Mini Player, outputting the audio to a mini speaker.

Building the circuit

To make it easier to wire the buttons to our Raspberry Pi Pico, we opted to put them on a second half-size breadboard, as you can see in the wiring diagram (Figure 1). Each four-legged button spans the division in the middle of the breadboard, with the pins on one side connected to a ground rail. The other side of each button is connected to a GPIO pin on Pico — we used GPIO 28, 27, 26, 21, 20, and 19 — that is pulled up (in the code). So when you press the button, the GPIO pin is pulled low, and the code senses this and triggers the DF Mini Player to play the relevant sample (more on that later).

Figure 1: The wiring diagram for the Pico drum machine

The DF Mini Player was placed on the same breadboard as Pico, connected via UART RX and TX pins, along with 3.3V power and ground. We used its speaker output pins to connect a mini speaker (ours was 2W, 8Ω).

To play some sounds, we needed some drum samples. There are lots of free, open-source ones available online; we got ours from GitHub. We found that some of the samples were a little long — and the DF Mini Player can only play one file at a time — so we opted to edit them in Audacity. If, after trimming the end of a sample, you find it ends too abruptly, you can always apply a fade-out effect.

A close-up of the buttons; each has one pin wired to the ground rail and one on the other side wired to a GPIO pin on Pico

The microSD card must be formatted as FAT32, so we erased it in Raspberry Pi Imager: select Choose OS > Erase, then Choose Storage and select the card. In addition, the files must be named 0001, 0002, 0003, etc., with the relevant suffix — you can use MP3 or WAV files. As we used the latter, ours were named 0001.wav, 0002.wav0006.wav. We found that it doesn’t matter whether you put them in a folder or not.

Coding it

Unlike Arnov, who programmed his drum machine in C, we opted to use MicroPython. For this, we made use of Stewart Watkiss’ DF Mini Player library. Just download the dfplayermini.py script from there and then, using the Files tab in Thonny IDE, right-click and upload the file to your connected Pico (which already has MicroPython installed). You can then call the library in your programs.

We edited our drum samples in Audacity to reduce the length of some of the longer ones

To make sure our drum samples were playing correctly, we created a program (play_drums_seq.py) to test them in sequence:

from dfplayermini import DFPlayerMini
import time

player1 = DFPlayerMini(1, 4, 5)
player1.reset()

print ("Set SD Card")
read_value = player1.select_source('sdcard')

print ("Set Volume 30")
read_value = player1.set_volume(30)

read_value = player1.query_num_files()
print (f"Num files {read_value}")

for i in range(6):
    print("Play",i+1)
    read_value = player1.play(i+1)
    time.sleep(1)

After importing the libraries, we set up a player1 object to work with UART 1 on GPIO pins 4 and 5. We then reset the DF Mini Player so it was ready to start communicating and selected the SD card as the audio source, before setting the volume — we maxed ours up to 30. Next, we queried the number of files on the card (which should be six) and played each one in turn.

Along with Pico, we placed the DF Mini Player on another breadboard and connected it to a mini speaker

We then adapted this to create our main program, which reads the button presses and triggers the sounds accordingly:

from dfplayermini import DFPlayerMini
from machine import Pin
import time

player1 = DFPlayerMini(1, 4, 5)
player1.reset()

print ("Set SD Card")
read_value = player1.select_source('sdcard')

print ("Set Volume 30")
read_value = player1.set_volume(30)

read_value = player1.query_num_files()
print (f"Num files {read_value}")

# Define GPIO pins for buttons
button_pins = [28, 27, 26, 21, 20, 19]

# Initialize input pins
buttons = [Pin(pin, Pin.IN, Pin.PULL_UP) for 
pin in button_pins]

# Main loop
while True:    
    for i in range(len(buttons)):        
        # Read button state        
        if buttons[i].value() == 0:            
            player1.stop() # stop current sound            
            read_value = player1.play(i+1)         
        time.sleep(0.01) # Debounce delay

Here, we added a line at the top to import the Pin method from the machine library. We created a list to set the GPIO pins for the buttons, then initialised them as inputs with the pin pulled up. In the main loop, we read the button state and then, after stopping any currently playing sound, played the relevant drum sample. We added a very short debounce delay to prevent a button press causing multiple triggers.

You need to name the files on the microSD card in (four-digit) numerical order for the DF Mini Player to recognise them

Hands up: the performance wasn’t as good as we’d hoped, with a noticeable lag between pressing a button and the sound being played. As already mentioned, the DF Mini Player can only play one file at a time, which is a major limitation for a drum machine. An alternative would be to use an I2S-based audio board, such as the Waveshare Pico-Audio, to play the drum sounds. Still, our little Pico drum machine does work, and you could use it to trigger other samples, such as spoken phrases or funny noises. Alternatively, using four of the buttons, you could try out Stewart Watkiss’ MP3 player project to play songs stored on the microSD card. 

Raspberry Pi Official Magazine #155 out NOW!

You can grab the latest issue right now from Tesco, Sainsbury’s, Asda, WHSmith, and other newsagents, including the Raspberry Pi Store in Cambridge. It’s also available from our online store, which ships around the world. And you can get a digital version via our app on Android or iOS.

You can also subscribe to the print version of our magazine. Not only do we deliver worldwide, but people who sign up to the six- or twelve-month print subscription get a FREE Raspberry Pi Pico W!

The post Raspberry Pi Pico–powered drum machine appeared first on Raspberry Pi.

Read the whole story
alvinashcraft
5 hours ago
reply
Pennsylvania, USA
Share this story
Delete

MessagingCenter Is Dead in .NET 10 - Here's What's Next For Your MAUI app!

1 Share
From: Gerald Versluis
Duration: 12:28
Views: 23

It's happening! The MessagingCenter is really going away in .NET 10! I know a lot of you are using this and to make the transition a bit easier, I have created the Plugin.Maui.MessagingCenter plugin.

Wondering what else is coming in .NET 10? Check out this video: https://youtu.be/90lmtvsAVqs

With Plugin.Maui.MessagingCenter you get a drop-in compatible plugin that immediately improves performance as it uses the CommunityToolkit.Mvvm WeakReferenceManager under the hood!

💝 Join this channel to get access to perks:
https://www.youtube.com/channel/GeraldVersluis/join

🛑 Don't forget to subscribe to my channel for more cool content: https://www.youtube.com/GeraldVersluis/?sub_confirmation=1

🔗 Links
Sample App repo: https://github.com/syncfusion/maui-toolkit
What's coming in .NET 10 video: https://youtu.be/90lmtvsAVqs

⏱ Timestamps
00:00 - MessagingCenter is going away!
00:19 - What is coming in .NET 10?
00:44 - What is MessagingCenter?
02:25 - Enter Plugin.Maui.MessagingCenter
03:10 - Powered by WeakReferenceMessenger
03:54 - .NET MAUI MessagingCenter Demo App
04:53 - Breaking change!
06:47 - Update sample from .NET 9 to .NET 10
07:42 - Implement Plugin.Maui.MessagingCenter
11:09 - Plugin.Maui.MessagingCenter demo!
11:27 - Use WeakReferenceMessenger!

🙋‍♂️ Also find my...
Blog: https://blog.verslu.is
All the rest: https://jfversluis.dev

#messagingcenter #pubsub #dotnet10 #dotnet #dotnetmaui

Read the whole story
alvinashcraft
5 hours ago
reply
Pennsylvania, USA
Share this story
Delete

Random.Code() - Adding Digit Separators to Numbers (Part 6)

1 Share
From: Jason Bock
Duration: 0:00
Views: 5

Somebody did work for me, let's review it and hopefully end this separator work!

https://github.com/JasonBock/Transpire/issues/22

Read the whole story
alvinashcraft
5 hours ago
reply
Pennsylvania, USA
Share this story
Delete

Building Self-Sufficient Teams Through Emotional Intelligence | Lilia Pulova

1 Share

Lilia Pulova: Building Self-Sufficient Teams Through Emotional Intelligence

Read the full Show Notes and search through the world's largest audio library on Agile and Scrum directly on the Scrum Master Toolbox Podcast website: http://bit.ly/SMTP_ShowNotes.

Lilia defines success for Scrum Masters by asking a simple but powerful question: "Do people feel supported?" Her approach focuses on training teams to take on her responsibilities and make their own decisions. Rather than dictating solutions, she presents options and allows teams to choose their path. Over time, teams learn these options and develop independence in decision-making. 

She maintains awareness by monitoring delivery metrics, watching for tickets that take too long, and staying attentive during daily stand-ups. With her primarily remote team keeping cameras open, Lilia reads emotions and body language to identify potential issues early, preventing small conflicts from escalating into major problems.

Self-reflection Question: How well do you read the emotional state of your team members, and what early warning signs might you be overlooking?

Featured Retrospective Format for the Week: 1-on-1 Retrospective

Lilia advocates for the 1-on-1 retrospective as her most effective format, explaining that people open up more in private conversations than in group settings. While group retrospectives can work well with smooth conversation flow, she finds that structured formats don't always suit every team - sometimes the "lack of format" creates better outcomes. The key to successful 1-on-1 retrospectives is building strong relationships and establishing trust, which she considers the most important foundation for effective retrospectives.

[The Scrum Master Toolbox Podcast Recommends]

🔥In the ruthless world of fintech, success isn’t just about innovation—it’s about coaching!🔥

Angela thought she was just there to coach a team. But now, she’s caught in the middle of a corporate espionage drama that could make or break the future of digital banking. Can she help the team regain their mojo and outwit their rivals, or will the competition crush their ambitions? As alliances shift and the pressure builds, one thing becomes clear: this isn’t just about the product—it’s about the people.

🚨 Will Angela’s coaching be enough? Find out in Shift: From Product to People—the gripping story of high-stakes innovation and corporate intrigue.

Buy Now on Amazon

[The Scrum Master Toolbox Podcast Recommends]

About Lilia Pulova 

Lilia Pulova, a former Business Intelligence Analyst, discovered her passion as a Scrum Master by chance. A natural communicator with a love for languages, she now bridges the gap between business and tech, translating complex needs into streamlined processes that boost productivity and keep teams aligned and focused.

You can link with Lilia Pulova on LinkedIn. 





Download audio: https://traffic.libsyn.com/secure/scrummastertoolbox/20250626_Lilia_Pulova_Thu.mp3?dest-id=246429
Read the whole story
alvinashcraft
5 hours ago
reply
Pennsylvania, USA
Share this story
Delete

How Electronic Arts standardized C++ builds across Windows and Linux with Visual Studio Build Tools

1 Share

At Electronic Arts (EA), the Frostbite Enginering Workflows team has thousands of developers who work on powerful game engines behind popular games.  EA has relied on Visual Studio for years due to several features such as IntelliSense, Build Insights, and the overall debugging experience and eagerly use newer integrations such as GitHub Copilot.  They also use Visual Studio capabilities for their cross-platform development needs.

We’re proud to partner with EA to shape cross-platform development capabilities in Visual Studio. Read more in the full story about how we worked with EA to enable them to customize their build experience and ensure consistent builds for thousands of developers at: aka.ms/ea-vs-game-dev

A picture of a college football game in a video game

A snapshot from EA Sports College Football 25, a video game produced by Electronic Arts

Send us feedback!

Download Visual Studio and give our cross-platform tooling a try! If you have any feedback for us on how to improve our cross-platform tooling for you, please file a suggestion ticket on Developer Community. The comments below are open and we are also available via email at visualcpp@microsoft.com.

 

The post How Electronic Arts standardized C++ builds across Windows and Linux with Visual Studio Build Tools appeared first on C++ Team Blog.

Read the whole story
alvinashcraft
5 hours ago
reply
Pennsylvania, USA
Share this story
Delete

Cloudflare Expands AI Capabilities with Launch of Thirteen New MCP Servers

1 Share

Cloudflare has unveiled thirteen new Model Context Protocol (MCP) servers, enhancing the integration of AI agents with its platform. These servers allow AI clients to interact with Cloudflare's services through natural language, streamlining tasks such as debugging, data analysis, and security monitoring.

By Craig Risi
Read the whole story
alvinashcraft
5 hours ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories