Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Battery-Powered MP3 Player with Seeed Studio nRF52840 and OLED Display

View and Edit Project In Cirkit DesignerImage of Battery-Powered MP3 Player with Seeed Studio nRF52840 and OLED Display

Circuit Documentation

Summary

This circuit is designed to function as an MP3 player using a Seeed Studio nRF52840 microcontroller. It interfaces with a DFPlayer MINI for audio playback, a 0.96" OLED display for visual feedback, and several pushbuttons for user interaction. Additionally, a 3.7V LiPo battery powers the circuit, and a 3.5mm audio jack is used for audio output.

Component List

  1. Seeed Studio nRF52840

    • Description: Microcontroller
    • Pins: VUSB, GND, 3V3, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, NFC1, NFC2, B-, B+
  2. 3.7V LiPo

    • Description: Lithium Polymer Battery
    • Pins: +Ve, GND
  3. DFPlayer MINI

    • Description: MP3 Player Module
    • Pins: VCC, BUSY, RX, USB -, TX, USB +, DAC_R, K2/ADC_KEY, DAC_L, K1/ADC_KEY, SPK1, IO 2, GND, SPK2, IO 1
  4. 3.5mm Audio Jack 3 Pin

    • Description: Audio Jack
    • Pins: L, R, GND
  5. 0.96" OLED

    • Description: OLED Display
    • Pins: GND, VDD, SCK, SDA
  6. Pushbutton

    • Description: Pushbutton Switch
    • Pins: Pin 3 (out), Pin 4 (out), Pin 1 (in), Pin 2 (in)
  7. Toggle Switch

    • Description: Toggle Switch
    • Pins: L1, COM, L2

Wiring Details

Seeed Studio nRF52840

3.7V LiPo

DFPlayer MINI

3.5mm Audio Jack 3 Pin

0.96" OLED

Pushbutton

Toggle Switch

Code Documentation

/*
 * This Arduino Sketch is designed for the Seeed Studio nRF52840 microcontroller.
 * It controls a DFPlayer MINI to function as an MP3 player. The code initializes
 * the DFPlayer and OLED display, and provides basic functionality to play, pause,
 * and navigate through MP3 files stored on the DFPlayer.
 */

#include <DFPlayerMini_Fast.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);

DFPlayerMini_Fast myDFPlayer;

void setup() {
  Serial.begin(9600);
  myDFPlayer.begin(Serial1);
  myDFPlayer.volume(10); // Set volume to a medium level

  // Initialize OLED display
  if(!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
  display.display();
  delay(2000);
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0,0);
  display.println(F("MP3 Player Initialized"));
  display.display();
}

void loop() {
  // Example: Play the first track
  myDFPlayer.play(1);
  display.clearDisplay();
  display.setCursor(0,0);
  display.println(F("Playing Track 1"));
  display.display();
  delay(10000); // Play for 10 seconds

  // Example: Pause the track
  myDFPlayer.pause();
  display.clearDisplay();
  display.setCursor(0,0);
  display.println(F("Track Paused"));
  display.display();
  delay(5000); // Pause for 5 seconds

  // Example: Resume the track
  myDFPlayer.start();
  display.clearDisplay();
  display.setCursor(0,0);
  display.println(F("Resuming Track"));
  display.display();
  delay(10000); // Play for another 10 seconds

  // Example: Stop the track
  myDFPlayer.stop();
  display.clearDisplay();
  display.setCursor(0,0);
  display.println(F("Track Stopped"));
  display.display();
  delay(5000); // Stop for 5 seconds
}

This code initializes the DFPlayer MINI and the OLED display. It provides basic functionality to play, pause, resume, and stop MP3 tracks. The OLED display provides visual feedback for each action.