I didn't find an answer on my question although similar topics can be found here or here...
That's why I'd like to explain my project in more detail:
I have a cheap audio speaker made for kids which plays MP3 songs from a micro SD card. The SD card is placed in a slot which is hard to access (and locked with a screw) so swapping the card is a pain. Also the MP3 player software ignores folders and plays only files in the root directory of the SD card so you cannot switch albums.
IDEA 1: I was wondering if it's possible to add a piece of hardware like an SD extesion cable with some electronics that enables me to use one SD card in 2 devices at the same time (also see links here and here).
The idea is to give read-only access to the MP3 player and write-access to my Pi. Using some interface I could then copy files to be played into the root directory of the SD card.
IDEA 2: maybe even better! Is it possible to emulate a SD card with the Pi and use some kind of extender cable to feed the physical card in the slot? While the MP3 player reads the FAT32 system of the card, in reality it reads from an emulated filesystem on the Pi. By doing that it could be possible to modify the files in the root directory of the virtual/emulated FAT32 filesytem simply by moving files in my Pi's filesystem...
I could also imagine to create that emulated FAT32 filesystem in RAM (max .128 MB = ~ 90 min. MP3 audio) instead of using the physical SD card.
What do you think? Feasible and if yes, how?
Thanks
Re: Use SD card in 2 devices at the same time *OR* emulator?
no - havingf an sdcard in 2 devices at the same time will not work.
have a player setup to play only from a samba share and arrange that as read only etc ....
have a player setup to play only from a samba share and arrange that as read only etc ....
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Use SD card in 2 devices at the same time *OR* emulator?
Maybe just use a Bluetooth speaker?
Re: Use SD card in 2 devices at the same time *OR* emulator?
The Sparkfun SD-card breakout board you link to allows passive "sniffing" of signals, more convenient than trying to probe the pins without such an extender. However if you want "read only" access to the SD card for your audio device, you still need to WRITE to the card to tell it what address you want to read. That means you want a 2-to-1 MUX on the signal lines in order to share access to the card, and of course only one device at a time can talk to the card.
Be aware that you can get a USB audio adaptor for less than one dollar including shipping. Check out ebay "USB audio adaptor"
Be aware that you can get a USB audio adaptor for less than one dollar including shipping. Check out ebay "USB audio adaptor"
Re: Use SD card in 2 devices at the same time *OR* emulator?
Your easiest option is to buy a micro SD extension and make a gap in the existing card slot so the ribbon cable can come out.
If the MP3 player can read off a USB drive then you can make a RPi Zero W pretend to be a USB drive.
I guess if you can find something that lets you use 1 SD card in two slots but you select the slot the SD card is connected to would work.
If the MP3 player can read off a USB drive then you can make a RPi Zero W pretend to be a USB drive.
Running both together won't work. It isn't designed to be shared like that and the two SD controllers will conflict with each other. It may actually damage the controller or card.droptix wrote: ↑Mon Jul 22, 2019 2:49 pmIDEA 1: I was wondering if it's possible to add a piece of hardware like an SD extesion cable with some electronics that enables me to use one SD card in 2 devices at the same time (also see links here and here).
The idea is to give read-only access to the MP3 player and write-access to my Pi. Using some interface I could then copy files to be played into the root directory of the SD card.
I guess if you can find something that lets you use 1 SD card in two slots but you select the slot the SD card is connected to would work.
You can make a SD card emulator but it isn't easy and usually requires FPGAs to handle the timing. The RPi won't be able to do this by itself.droptix wrote: ↑Mon Jul 22, 2019 2:49 pmIDEA 2: maybe even better! Is it possible to emulate a SD card with the Pi and use some kind of extender cable to feed the physical card in the slot? While the MP3 player reads the FAT32 system of the card, in reality it reads from an emulated filesystem on the Pi. By doing that it could be possible to modify the files in the root directory of the virtual/emulated FAT32 filesytem simply by moving files in my Pi's filesystem...
Last edited by trejan on Mon Jul 22, 2019 3:20 pm, edited 1 time in total.
Re: Use SD card in 2 devices at the same time *OR* emulator?
Hum, that complicated...
Unfortunately the speaker is not able to play from USB or network.
The speaker has AUX-in but unfortunately it doesn't accept these audio-jack-to-USB-adapters (~ 2 USD). These adapters enable you to play from USB drive (made for cars with compatible software).
The speaker also is a bluetooth speaker but I don't want my kids to use an extra device to play music (also no extra cables). The speaker itself has big buttons etc. to control everything from the speaker itself. Somehow the manufacturers just "forgot" support for folders
and to add 2 buttons to switch between them... My idea was to use a Pi Zero and place it inside the box.
The speaker was a gift and I was trying to optimize it...
Maybe the easiest and cheapest idea is to use a micro SD extender cable and don't lock the slot with the screw so that you can swap SD cards from the outside. But I'd prefer some wireless input device like a NFC reader (there's still space in the box to put it in).
Thanks for your ideas!
Unfortunately the speaker is not able to play from USB or network.
The speaker has AUX-in but unfortunately it doesn't accept these audio-jack-to-USB-adapters (~ 2 USD). These adapters enable you to play from USB drive (made for cars with compatible software).
The speaker also is a bluetooth speaker but I don't want my kids to use an extra device to play music (also no extra cables). The speaker itself has big buttons etc. to control everything from the speaker itself. Somehow the manufacturers just "forgot" support for folders

The speaker was a gift and I was trying to optimize it...
Maybe the easiest and cheapest idea is to use a micro SD extender cable and don't lock the slot with the screw so that you can swap SD cards from the outside. But I'd prefer some wireless input device like a NFC reader (there's still space in the box to put it in).
Thanks for your ideas!
Re: Use SD card in 2 devices at the same time *OR* emulator?
More work but you could replace most of the internals of the speaker. Feed audio from the Zero into the amplifier and rewire the controls so they go to the Zero instead. It'll give you maximum flexibility for improvements and future changes.
Not sure what you mean when you said "The speaker has AUX-in but unfortunately it doesn't accept these audio-jack-to-USB-adapters". The aux socket should just be regular line level audio so a cheap USB audio adapter plugged into the RPi should be okay. An alternative is to recreate the missing audio circuitry that is on a Model A/B and wire it to the Zero expansion header. The USB audio adapter is going to be easier and sound better though.
Not sure what you mean when you said "The speaker has AUX-in but unfortunately it doesn't accept these audio-jack-to-USB-adapters". The aux socket should just be regular line level audio so a cheap USB audio adapter plugged into the RPi should be okay. An alternative is to recreate the missing audio circuitry that is on a Model A/B and wire it to the Zero expansion header. The USB audio adapter is going to be easier and sound better though.
Re: Use SD card in 2 devices at the same time *OR* emulator?
Yes, much more work... don't know if it's worth time and money...
Some cars have AUX-in but no USB while the AUX is a special port (3 connectors) and the car radio's software supports playing from USB devices over AUX. You need an adapter like this: https://ebay.us/juwSoh
My primary idea is that my kids can change the album or audio book they want to listen to... my daughter also has a CD player/radio device supporting USB drives. So I bought her many of these USB thumbdrives https://ebay.us/Yx2HFf for just 1,36 EUR each... even if oversized (16 GB) she now can switch music easily.
The idea for the speaker box is almost the same but unfortunately it has no USB support. I even tried a USB-OTG adapter but not working... And the idea behind RasPi (or NodeMCU) was: being able to switch music using a NFC reader to detect the album and the Pi/Node then moves files on the SD card so that the speaker box does its job as usual without breaking with the hardware of the speaker box. But even if writing to the SD card would be possible the question is where to put the Pi/Node and power. The speaker has a built-in battery...
So thanks for your replies.
BUT STILL: emulating an SD card filesystem on the Pi and using an extender-like cable is very interesting also for other projects where the SD card is hard to access or needs to be switched often.
I didn't think that it's such a compicated thing... I mean we're able to emulate retro game consoles or PlayStation... whole virtual computers... we're actually flying to planet Mars...

Re: Use SD card in 2 devices at the same time *OR* emulator?
Indeed. If it were not we would likely be awash with solutions for doing exactly that.
The easiest way of sharing an SD Card between two devices is to physical switch it between the two and only access it from one side at a time. That's not much different to ejecting the card from one thing and inserting it into another, except there's no physical movement required.
That is fairly easy to implement. It doesn't allow both sides to access the card at the same time but can be appropriate for some use cases.
I'm not convinced that's the best way to go though. I would have a Pi generate the audio and feed that into the speaker box, or rip the speaker box apart, remove its existing innards and replace that with a Pi. Or just build your version from the ground-up based around the Pi.