This shows you the differences between two versions of the page.
|
pm:prj2026:theodor_ioan.buliga:adrian.vancea [2026/05/27 07:46] adrian.vancea |
pm:prj2026:theodor_ioan.buliga:adrian.vancea [2026/05/27 08:11] (current) adrian.vancea [Results] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Portable MP3 Player ====== | + | {{:pm:prj2026:theodor_ioan.buliga:portable_mp3_player.zip|}}====== Portable MP3 Player ====== |
| ===== Introduction ===== | ===== Introduction ===== | ||
| Line 283: | Line 283: | ||
| ===== Results ===== | ===== Results ===== | ||
| + | |||
| + | The final product is a functional, standalone portable MP3 player built around | ||
| + | the Arduino Nano and DFPlayer Mini, with a custom OLED user interface written | ||
| + | entirely without external libraries. | ||
| + | |||
| + | {{:pm:prj2026:theodor_ioan.buliga:whatsapp_image_2026-05-27_at_08.06.10.jpeg?500|}} | ||
| + | {{:pm:prj2026:theodor_ioan.buliga:whatsapp_image_2026-05-27_at_08.08.02.jpeg?500|}} | ||
| + | {{:pm:prj2026:theodor_ioan.buliga:whatsapp_image_2026-05-27_at_08.05.58.jpeg?500|}} | ||
| + | **Functional features achieved:** | ||
| + | * Playback of MP3 files from a microSD card with Play / Pause / Next / Previous control | ||
| + | * 3-mode user interface (Track Mode, Volume Mode, Track Select) managed by a state machine | ||
| + | * OLED display showing a 16px scaled track number and play/pause icon, a spectrum bar animation, elapsed time, and a volume indicator bar | ||
| + | * Volume control (0–10 steps) via long-press + short-press button interaction | ||
| + | * Track select menu listing all available tracks (auto-detected from SD card at startup) | ||
| + | * Spectrum animation that instantly flattens to a straight line on pause | ||
| + | * Portable power supply: 3.7V Li-Po battery with TP4056 charging and protection circuit | ||
| + | * Stereo audio output via 3.5mm jack | ||
| + | |||
| + | **Performance measurements:** | ||
| + | * Main loop iteration: ~110ms (10ms active delay + ~100ms I2C framebuffer flush) | ||
| + | * Firmware RAM usage: 54.8% (1123 / 2048 bytes) — stable, no stack overflow observed | ||
| + | * Firmware Flash usage: 11.4% (3502 / 30720 bytes) — significant headroom remaining | ||
| + | * Button response latency: max 110ms (one loop iteration) — imperceptible in practice | ||
| + | * Volume range: 0–30 on DFPlayer (mapped from 0–10 user-facing steps) | ||
| + | |||
| + | **Hypothesis validation:** \\ | ||
| + | The initial hypothesis was confirmed. Offloading audio decoding to the DFPlayer Mini | ||
| + | allowed the ATmega328P to dedicate its full cycle budget to UI rendering and button | ||
| + | polling, resulting in a smooth 9 FPS display refresh with no audio glitches. | ||
| ===== Conclusions ===== | ===== Conclusions ===== | ||
| - | ===== Download ===== | + | The project successfully demonstrates a balanced embedded system where dedicated |
| + | hardware (DFPlayer) handles the computationally expensive task (MP3 decoding) while | ||
| + | the microcontroller focuses on user interaction and visual feedback. | ||
| + | |||
| + | **What worked well:** | ||
| + | * The bare-metal approach (no libraries) gave full control over timing and memory, | ||
| + | which was essential given the 2KB RAM constraint of the ATmega328P. | ||
| + | * The software UART bit-bang implementation proved reliable for DFPlayer communication | ||
| + | and also enabled reading the track count response at startup. | ||
| + | * The framebuffer rendering approach (draw everything into RAM, flush once) eliminated | ||
| + | partial-update artifacts on the OLED. | ||
| + | * The hold-counter button logic (short press vs. long press on the same button) reduced | ||
| + | the required number of physical buttons from 5 to 3 without sacrificing usability. | ||
| + | |||
| + | **Challenges encountered:** | ||
| + | * The ''oled_char'' (uses ''='') vs. ''draw_pixel'' (uses ''|='') page conflict required | ||
| + | careful layout planning to avoid text erasing pixel graphics in the same page byte. | ||
| + | * DFPlayer communication is sensitive to timing — the soft UART bit period (104µs) | ||
| + | had to be exact, and any I2C activity during transmission caused corruption. | ||
| + | * Power stability: the Li-Po voltage drop under load initially caused resets; | ||
| + | resolved by adding a decoupling capacitor near the Arduino VIN pin. | ||
| + | |||
| + | **Future improvements:** | ||
| + | * Replace the simulated spectrum with a real VU meter using the ADC and a signal | ||
| + | tap from the audio line. | ||
| + | * Add a progress bar using DFPlayer command 0x28 (query current playback position). | ||
| + | * Design a custom PCB to reduce size and improve reliability over the prototype board. | ||
| ===== Journal ===== | ===== Journal ===== | ||
| - | * **May 3**: Created the Wiki documentation page and the Block Diagram. | + | * **May 3**: Created the Wiki documentation page and the Block Diagram. Defined project scope and selected components. |
| - | * **May 10**: Hardware milestone reached: Developed the full system schematic including power management (TP4056) and audio routing. Verified the I2C and UART pin mapping. Added a visual demonstration of the functional prototype showing stable communication between all modules. | + | * **May 10**: Hardware milestone: developed the full system schematic in KiCad including power management (TP4056) and audio routing. Verified I2C and UART pin mapping on breadboard. Confirmed stable communication between Arduino, OLED, and DFPlayer. |
| + | * **May 15**: Implemented bare-metal I2C driver (TWI registers) and basic OLED framebuffer rendering. First text displayed on screen. | ||
| + | * **May 18**: Implemented software UART TX for DFPlayer control. First successful track playback triggered from firmware. Volume and play/pause commands verified. | ||
| + | * **May 20**: Added software UART RX and ''dfp_query_tracks()'' to auto-detect SD card track count at startup. Verified fallback behavior when DFPlayer does not respond. | ||
| + | * **May 22**: Implemented spectrum bar animation with smooth attack/decay algorithm. Added instant flatten-to-line behavior on pause. | ||
| + | * **May 24**: Designed and implemented the 3-mode state machine (Track / Volume / Track Select). Rewrote button logic to support short press vs. long press on the same button using hold counters. | ||
| + | * **May 26**: Added ''draw_big_char()'' function for 2× scaled 16px characters. Redesigned the OLED layout: big icon + track number in top 16px, spectrum in the middle, time and volume bar at the bottom. | ||
| + | * **May 27**: Final firmware build verified: RAM 54.8%, Flash 11.4%, no compilation errors. Assembled final prototype on PCB board. Completed Wiki documentation. | ||
| ===== Bibliography/Resources ===== | ===== Bibliography/Resources ===== | ||
| Line 299: | Line 362: | ||
| * SSD1306 OLED Tutorials | * SSD1306 OLED Tutorials | ||
| * Project Schematic: {{:pm:prj2026:theodor_ioan.buliga:proiect_pm_v2.pdf|}} | * Project Schematic: {{:pm:prj2026:theodor_ioan.buliga:proiect_pm_v2.pdf|}} | ||
| + | * Project Code : {{:pm:prj2026:theodor_ioan.buliga:portable_mp3_player.zip|}} | ||
| <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||