Arnov Sharma
Published © MIT

The Beetles PCB ART

It’s a PCB art board. It’s a music player. It’s something else entirely. Hard to define

BeginnerFull instructions provided1 hour4
The Beetles PCB ART

Things used in this project

Hardware components

Raspberry Pi Pico 2
Raspberry Pi Pico 2
×1

Software apps and online services

Fusion
Autodesk Fusion
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

STEP FILE

Schematics

SCH

Code

code

C/C++
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
#include <Adafruit_NeoPixel.h>

SoftwareSerial mySerial(7, 8); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

const int totalSongs = 4;
int currentSong = 1;
int currentVolume = 20;

// Button pins
const int nextPin = 12;
const int volUpPin = 13;
const int volDownPin = 14;

// LED setup
#define LED_PIN     0
#define LED_COUNT   24
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);

  pinMode(nextPin, INPUT_PULLUP);
  pinMode(volUpPin, INPUT_PULLUP);
  pinMode(volDownPin, INPUT_PULLUP);

  strip.begin();
  strip.show();

  if (!myDFPlayer.begin(mySerial)) {
    Serial.println("DFPlayer Mini not found");
    while (true);
  }

  myDFPlayer.volume(currentVolume);
  delay(1000);
  myDFPlayer.play(currentSong);
  updateLEDs();
}

void loop() {
  if (myDFPlayer.available()) {
    uint8_t type = myDFPlayer.readType();
    if (type == DFPlayerPlayFinished) {
      currentSong++;
      if (currentSong > totalSongs) currentSong = 1;
      myDFPlayer.play(currentSong);
    }
  }

  // ⏳ Press-and-hold logic for next song
  static unsigned long nextPressStart = 0;
  if (digitalRead(nextPin) == LOW) {
    if (nextPressStart == 0) nextPressStart = millis();
    if (millis() - nextPressStart >= 1000) {
      currentSong++;
      if (currentSong > totalSongs) currentSong = 1;
      myDFPlayer.play(currentSong);
      nextPressStart = 0;
      while (digitalRead(nextPin) == LOW); // Wait for release
    }
  } else {
    nextPressStart = 0;
  }

  // Volume Up
  if (digitalRead(volUpPin) == LOW) {
    delay(200);
    if (currentVolume < 30) currentVolume++;
    myDFPlayer.volume(currentVolume);
    while (digitalRead(volUpPin) == LOW);
  }

  // Volume Down
  if (digitalRead(volDownPin) == LOW) {
    delay(200);
    if (currentVolume > 0) currentVolume--;
    myDFPlayer.volume(currentVolume);
    while (digitalRead(volDownPin) == LOW);
  }
}

void updateLEDs() {
  for (int i = 0; i < LED_COUNT; i++) {
    if (i < 6) {
      strip.setPixelColor(i, strip.Color(255, 255, 0)); // Yellow
    } else if (i < 12) {
      strip.setPixelColor(i, strip.Color(255, 0, 128)); // Pink-purple mix
    } else if (i < 18) {
      strip.setPixelColor(i, strip.Color(0, 255, 255)); // Cyan-blue
    } else {
      strip.setPixelColor(i, strip.Color(0, 255, 0)); // Light green
    }
  }
  strip.show();
}

Credits

Arnov Sharma
357 projects • 363 followers
I'm Arnov. I build, design, and experiment with tech—3D printing, PCB design, and retro consoles are my jam.

Comments