• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Music Player with NFC using Raspberry Pi and .NET

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,049 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
Started work on a new side project: a portable music player for my daughter. Select song by placing a NFC token on the player, similar to Toniebox or Phoniebox

Will code a proper .NET application though, with web services, instead of a mix of Python + Shell scripts like some other solutions



Made good progress this weekend. Playback and switching between Internet Radio stations with NFC tags already works.

Red PCB on the left is the NFC reader, above it, green PCB is a Hifiberry Miniamp. The big PCB on the right side is a Raspberry Pi 4B

Incoming tomorrow is a USB battery pack, and an electronic MOSFET relay, so I can properly power off the whole thing on shutdown
 
Last edited:

silentbogo

Moderator
Staff member
Joined
Nov 20, 2013
Messages
5,474 (1.44/day)
Location
Kyiv, Ukraine
System Name WS#1337
Processor Ryzen 7 3800X
Motherboard ASUS X570-PLUS TUF Gaming
Cooling Xigmatek Scylla 240mm AIO
Memory 4x8GB Samsung DDR4 ECC UDIMM
Video Card(s) Inno3D RTX 3070 Ti iChill
Storage ADATA Legend 2TB + ADATA SX8200 Pro 1TB
Display(s) Samsung U24E590D (4K/UHD)
Case ghetto CM Cosmos RC-1000
Audio Device(s) ALC1220
Power Supply SeaSonic SSR-550FX (80+ GOLD)
Mouse Logitech G603
Keyboard Modecom Volcano Blade (Kailh choc LP)
VR HMD Google dreamview headset(aka fancy cardboard)
Software Windows 11, Ubuntu 20.04 LTS
Did you have to beat down a few scalpers for that 4B, W1zz? :D

Cool project. Do you run Windows IoT? I tried it once - wasn't my bag of beans ))))
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,049 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
Did you have to beat down a few scalpers for that 4B, W1zz? :D
I simply bought it online in a shop here in Germany for 50 Euros. Not a lot of stock around though it seems.

Do you run Windows IoT?
Nah, Linux all the way. Will strip down the boot process though to save on boot time. Little girls can be impatient :)
 

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,888 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
Please review this on the blue table.
 
Joined
Mar 21, 2021
Messages
4,403 (3.89/day)
Location
Colorado, U.S.A.
System Name HP Compaq 8000 Elite CMT
Processor Intel Core 2 Quad Q9550
Motherboard Hewlett-Packard 3647h
Memory 16GB DDR3
Video Card(s) Asus NVIDIA GeForce GT 1030 2GB GDDR5 (fan-less)
Storage 2TB Micron SATA SSD; 2TB Seagate Firecuda 3.5" HDD
Display(s) Dell P2416D (2560 x 1440)
Power Supply 12V HP proprietary
Software Windows 10 Pro 64-bit
Might not be the right place to ask, but what is the progress with Windows 11 ARM on the Raspberry Pi?
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,049 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
Progress update:


USB battery pack (20000 mAh) can power this for 30 hours. I tested with less than half-full and it ran over 10 hours
Got me some little speakers, which sound worse than I expected t.t, ordered bigger ones
Added a rotary encoder for volume control. The existing libraries are surprisingly bad and either require polling, miss pulses or generate fake pulses from noise/bouncing. Ended up writing my own interrupt-driven library using a state-machine

Next: look into power on/off capability using MOSFETs
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,049 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit


First super ghetto prototype. Works really well

- Switched from Raspberry Pi 4 to Pi Zero 2W for the lower power consumption/longer battery life
- Web interface using .NET core working great. Upload MP3 working perfectly.
- Added shairport-sync so the player appears as AirPlay audio device on the network. Everything played back is automatically recorded and can be saved into replayable tracks
- Found some bugs in the .NET IOT button debounce code, issue opened on Github so they can add my fix

Next:
- Build a prototype wooden case to get a feel for what's usable in dimensions, then look into 3D printing a case
- Add Atmel Microcontroller for power management (Raspberry cannot power off on its own)
- Look into how to improve durability of print on these cards
- Find a knob for the rotary dial
- Look into buildroot to build a custom linux that boots as quickly as possible
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,049 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit


Much less ghetto prototype, to get a feel for dimensions and component placement, etc, so I can 3D print the case later



Went through several component revisions

  • Switched to Pi Zero 2W for its lower power consumption
  • Turns out a power bank is unusable for this kind of project, because the power bank will just turn off when power draw is low (Raspberry off, MCU on)
  • Now using a 4-battery 18650 Li-ion "Battery Shield", which can permanently supply power
  • Built a custom Linux distro using Buildroot to reduce boot time, now around 12 seconds (still super long with an impatient kid, but better than 30 secs). Loading and starting a .NET app takes surprisingly long, like 3 seconds
  • Added an Atmel AVR 8-bit microcontroller for power management (Raspberry cannot power down on its own). Raspberry pulls a GPIO pin high on shutdown that the AVR watches for and then cuts the power
  • For power management I tried a bunch of MOSFET modules, but they all suck because they are low-side switching, finally found a module using IRF5305S, which does high-side switching, so I have a common ground and my buttons can be used to power on the machine
  • Raspberry is super annoying with its voltage requirements.. as soon as you have a little bit of resistance, voltage can drop below 5 V, at which point the Raspberry will crash or run into other issues. Solution: use a MT3608 voltage booster, set it to 5.7 V output via trimpot and all voltage problems solved, it will just boost whatever input voltage you have to the target voltage
  • Wanna make awesome cable connections? Buy a "Dupont" crimping set on Amazon and make your own cables
 
Last edited:
Joined
Mar 21, 2021
Messages
4,403 (3.89/day)
Location
Colorado, U.S.A.
System Name HP Compaq 8000 Elite CMT
Processor Intel Core 2 Quad Q9550
Motherboard Hewlett-Packard 3647h
Memory 16GB DDR3
Video Card(s) Asus NVIDIA GeForce GT 1030 2GB GDDR5 (fan-less)
Storage 2TB Micron SATA SSD; 2TB Seagate Firecuda 3.5" HDD
Display(s) Dell P2416D (2560 x 1440)
Power Supply 12V HP proprietary
Software Windows 10 Pro 64-bit
Why two different speakers?
 
Joined
May 9, 2012
Messages
8,408 (1.92/day)
Location
Ovronnaz, Wallis, Switzerland
System Name main/SFFHTPCARGH!(tm)/Xiaomi Mi TV Stick/Samsung Galaxy S23/Ally
Processor Ryzen 7 5800X3D/i7-3770/S905X/Snapdragon 8 Gen 2/Ryzen Z1 Extreme
Motherboard MSI MAG B550 Tomahawk/HP SFF Q77 Express/uh?/uh?/Asus
Cooling Enermax ETS-T50 Axe aRGB /basic HP HSF /errr.../oh! liqui..wait, no:sizable vapor chamber/a nice one
Memory 64gb Corsair Vengeance Pro 3600mhz DDR4/8gb DDR3 1600/2gb LPDDR3/8gb LPDDR5x 4200/16gb LPDDR5
Video Card(s) Hellhound Spectral White RX 7900 XTX 24gb/GT 730/Mali 450MP5/Adreno 740/RDNA3 768 core
Storage 250gb870EVO/500gb860EVO/2tbSandisk/NVMe2tb+1tb/4tbextreme V2/1TB Arion/500gb/8gb/256gb/2tb SN770M
Display(s) X58222 32" 2880x1620/32"FHDTV/273E3LHSB 27" 1920x1080/6.67"/AMOLED 2X panel FHD+120hz/FHD 120hz
Case Cougar Panzer Max/Elite 8300 SFF/None/back/back-front Gorilla Glass Victus 2+ UAG Monarch Carbon
Audio Device(s) Logi Z333/SB Audigy RX/HDMI/HDMI/Dolby Atmos/KZ x HBB PR2/Edifier STAX Spirit S3 & SamsungxAKG beans
Power Supply Chieftec Proton BDF-1000C /HP 240w/12v 1.5A/4Smart Voltplug PD 30W/Asus USB-C 65W
Mouse Speedlink Sovos Vertical-Asus ROG Spatha-Logi Ergo M575/Xiaomi XMRM-006/touch/touch
Keyboard Endorfy Thock 75% <3/none/touch/virtual
VR HMD Medion Erazer
Software Win10 64/Win8.1 64/Android TV 8.1/Android 13/Win11 64
Benchmark Scores bench...mark? i do leave mark on bench sometime, to remember which one is the most comfortable. :o
Why two different speakers?
bass and mid/high... eh?

usually multi driver speaker units have a big woofer and a tweeter, better sound replication :p

same kind as my FH1s... 13.6mm dynamic for the bass and balanced armature for the mids and high (all that in one ear, double that if i use both ears ... and yes i do use them both, most of the time. )
 
Joined
Feb 22, 2016
Messages
1,489 (0.50/day)
Processor Intel i5 8400
Motherboard Asus Prime H370M-Plus/CSM
Cooling Scythe Big Shuriken & Noctua NF-A15 HS-PWM chromax.black.swap
Memory 8GB Crucial Ballistix Sport LT DDR4-2400
Video Card(s) ROG-STRIX-GTX1060-O6G-GAMING
Storage 1TB 980 Pro
Display(s) Samsung UN55KU6300F
Case Cooler Master MasterCase Pro 3
Power Supply Super Flower Leadex III 750w
Software W11 Pro
Großer Vater!
 

silentbogo

Moderator
Staff member
Joined
Nov 20, 2013
Messages
5,474 (1.44/day)
Location
Kyiv, Ukraine
System Name WS#1337
Processor Ryzen 7 3800X
Motherboard ASUS X570-PLUS TUF Gaming
Cooling Xigmatek Scylla 240mm AIO
Memory 4x8GB Samsung DDR4 ECC UDIMM
Video Card(s) Inno3D RTX 3070 Ti iChill
Storage ADATA Legend 2TB + ADATA SX8200 Pro 1TB
Display(s) Samsung U24E590D (4K/UHD)
Case ghetto CM Cosmos RC-1000
Audio Device(s) ALC1220
Power Supply SeaSonic SSR-550FX (80+ GOLD)
Mouse Logitech G603
Keyboard Modecom Volcano Blade (Kailh choc LP)
VR HMD Google dreamview headset(aka fancy cardboard)
Software Windows 11, Ubuntu 20.04 LTS
Got some upgrades I see.... :D
Pi4s are still as rare as unicorn's ass here, but I had a chance to play with one just a few weeks ago. Super-fast, super-cool, but unfortunately not mine...
Added an Atmel AVR 8-bit microcontroller for power management (Raspberry cannot power down on its own). Raspberry pulls a GPIO pin high on shutdown that the AVR watches for and then cuts the power
It's finicky, but it can. There are some premade solutions for that, but ultimately it all boils down to the following: on the Pi you need to attach a power button to GPIO3(GLOBAL_EN), then you disable "WAKE_ON_GPIO" and enable "POWER_OFF_ON_HALT", add "GPIO_SHUTDOWN" as well(or just write a script that triggers on GPIO, if you need to do something specific prior to powering off). That's pretty much an equivalent of your conventional power button.
I don't remember if power LED is staying on or not with this thing, but it can be disabled in that same script(temporarily) or in config(permanently, since it's in the box anyways).


Turns out a power bank is unusable for this kind of project, because the power bank will just turn off when power draw is low (Raspberry off, MCU on)
Not a conventional power bank, but there are some that do have continuous output regardless of power draw. Though, I'm not even sure if Pi4's outrageous standby power can be considered "low".

Raspberry is super annoying with its voltage requirements.. as soon as you have a little bit of resistance, voltage can drop below 5 V, at which point the Raspberry will crash or run into other issues.
If I were you, I'd check that wiring for issues. PMIC cuts off at 4.6V, which is a long way from 5V input. Kinda the issue that plagues cheap chinese powerbanks, which put out more power than designed for.

Wanna make awesome cable connections? Buy a "Dupont" crimping set on Amazon and make your own cables
Or use your existing mini-fit crimper. I just had to adjust gears for proper release point - now it's all nice and clean.
Though, I'd really want to find a set of attachments for crimping short contacts, cause these get mangled on any gear settings with my current setup.
Had to use dupont connectors throughout my entire 3D Printer wiring, which was and still is a nightmare, and still isn't finished.... :banghead:
 
Joined
Nov 18, 2010
Messages
7,125 (1.45/day)
Location
Rīga, Latvia
System Name HELLSTAR
Processor AMD RYZEN 9 5950X
Motherboard ASUS Strix X570-E
Cooling 2x 360 + 280 rads. 3x Gentle Typhoons, 3x Phanteks T30, 2x TT T140 . EK-Quantum Momentum Monoblock.
Memory 4x8GB G.SKILL Trident Z RGB F4-4133C19D-16GTZR 14-16-12-30-44
Video Card(s) Sapphire Pulse RX 7900XTX + under waterblock.
Storage Optane 900P[W11] + WD BLACK SN850X 4TB + 750 EVO 500GB + 1TB 980PRO[FEDORA]
Display(s) Philips PHL BDM3270 + Acer XV242Y
Case Lian Li O11 Dynamic EVO
Audio Device(s) Sound Blaster ZxR
Power Supply Fractal Design Newton R3 1000W
Mouse Razer Basilisk
Keyboard Razer BlackWidow V3 - Yellow Switch
Software FEDORA 39 / Windows 11 insider
I simply bought it online in a shop here in Germany for 50 Euros. Not a lot of stock around though it seems.

I am jelly... here those come around 100-150€ :(

Also I ordered Raspberry Pi Zero 2 W on Farnell, I don't hope it to see it this year.

One fair warning about 5.7V.

The TVS surpressor diode there is SMBJ5.0A-TR so breakdown at 6.4V... with trimp pot you may trigger it.

Another fair warning the PMIC there is extremely fragile and if you fry it you cannot replace it as it needs to be configured as it is a programmable PMU, code for that isn't known IMHO.

Just put thicker wires as there is low voltage. Another trick is add a capacitator at the TYPE-C wire connector, strip it and solder a cap at the end of it, it will mitigate fluctuations and then you may omit the Vreg.
 
Last edited:

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,049 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
Why two different speakers?
Bought two different ones to get a feel for the quality difference. The bigger one is MUCH better and will use 2x in final

It's finicky, but it can. There are some premade solutions for that, but ultimately it all boils down to the following: on the Pi you need to attach a power button to GPIO3(GLOBAL_EN), then you disable "WAKE_ON_GPIO" and enable "POWER_OFF_ON_HALT", add "GPIO_SHUTDOWN" as well(or just write a script that triggers on GPIO, if you need to do something specific prior to powering off). That's pretty much an equivalent of your conventional power button.
Yeah, I built that myself. dtoverlay=gpio-shutdown in config.txt is what you want, don't use a shutdown script. The unit has no power off button, it will automatically shut down itself after x minutes of not playing music. You can power it back on by pressing a button

but there are some that do have continuous output
Not in the EU, at least not as "power bank". There's something from TalentCell, which has a physical switch, but that can't be switched off through software.

Though, I'm not even sure if Pi4's outrageous standby power can be considered "low".
Pi has no standby. You mean its off state that really isn't off? That's high enough to not shutoff the power bank, but too high for a battery-powered device. Battery will be empty in a day or two. What I meant was "when the Pi is really off and the MCU is on, the power draw is so low that the power bank will turn itself off"

PMIC cuts off at 4.6V, which is a long way from 5V input.
I mean the low voltage warning (0x00050005) and things get unstable long before 4.6 V is reached

PAM2306 on Pi Zero 2W, up to 6.5 V absolute max, 5.5 V recommended, I think I'll be fine
 
Top