Single-chip digital audio player

[Dmitry Gr.] built a simple circuit to playback digital audio. At the center you can see an 8-pin PIC 12F1840 microcontroller. It’s pulling audio data from a microSD card which is read through a full-sized SD card adapter to which he soldered jumper wires for all of the necessary connections. There is one additional semiconductor, a FET which is used to drive the speaker seen to the left. Unregulated power is provided by a pair of AA batteries (four are seen in the picture above but only two are actually connected to the circuit). He’s planning to post his code package soon, but for now you’ll have to be satisfied with a couple of demo videos and a schematic. Both videos are embedded after the break, and we’ve also included a screenshot of the schematic which is shown in the second video.

This is very similar to the 1-Bit Symphony CD we saw almost a year ago in a links post. That one used a jewel case instead of the protoboard seen here, and had a headphone jack instead of the speaker.

48 thoughts on “Single-chip digital audio player

  1. Except this one is not 1 bit :) the output resolution is adjustable and currently stands at 6bit in that video. Sampling rate is adjustable too, and is 44100 Hz in that video. The cool parts are: card sector size is 512 bytes, but this pic has less ram, so card data is streamed to a circular buffer.

  2. Oh, and this also plays real music, not single channel beeps :)
    I always welcome suggestions, and I’ll post the code sometime this week on my site together with a writeup and a few cool additions

    1. The music is on the SD card, why would you think thats too small to hold any music? The pic micro is only the card reader/player!

  3. Embed video sez-“This video contains content from Sony ATV publishing. It is restricted from playback on certain sites.”

    Plus side of that: This thing’s fidelity(?) is good enough to be picked up by content protection.

    Looks neat.

  4. Dmitry: Actually, being somewhat pedantic, it’s still one bit: the output of your pin either is one or zero. It’s probably oversampled heavily, giving the effect of being 6-bit at 44KHz, but it’s still one bit.

    Do you get any good quality from the single FET btw? I’d think the FET can ‘push out’ the conus of the speaker OK, but the ‘pulling in’ it has to do by means of the elasticity of the rubber, which isn’t too stong a force. You might want to try putting half an H-bridge in the FETs place, I’d think it’d improve the quality/volume by a fair amount.

    Btw, have you seen this? http://elm-chan.org/works/sd8p/report.html <-8bit wav playing, oversampling the PWM at 0.25MHz. Sounds absolutely awesome and indistinguishable from a PC+soundcard.

      1. Because the quality of the audio is only as good as the number of bits in the encoded audio sample and how you take those bits and convert them back to an analog signal. Does a 64kbps MP3 sound as good as a 320kbps MP3? 16bit WAV vs. 44bit WAV?

  5. @Sprite_tm – no I haven’t seen that – seems like quite a similar idea. The speaker I use is quite elastic, so it pulls in fine for my purposes. Sadly pic is not able to provide the current needed to drive the speaker directly. It works without the FET, but much quieter. my goal with this project is to make it wake up periodically at random periods, play a few seconds and go back to sleep. microsd, 3v cell battery, SOIC PIC, stacked together for a tiny device that is easy to hide under a desk. it will wake-up and rickroll random persons and go back to sleep :)

  6. It’s not at all like 1-bit Symphony. That project fit an entire CD’s worth of artful musical composition into the microcontroller itself, together with the multivoice waveform synthesis playback code. This project, while clever, is not in the same ballpark.

  7. Brilliant, love using the sd adapter as a dock. at first i thought he ruined a perfectly good card.

    what i want to know is did he have to change the mp3 to mono from stereo? I tried sending some old waves to my phone for ring tones and i had to convert them to stereo for my phone to recognize them.

  8. Neat idea, presumably the extra program memory makes this possible whereas a 12F683 wouldn’t do it.

    What about modifying this code to decode a microSD card enough to read two audio channels?

  9. Actually this PIC choice was for speed. PICs run an instruction at every 4 clock cycles so to obtain 8MIPS performance a clock of 32MHz is needed, which this PIC has. With an AVR, this would be much easier since they do not have this atrocious 4 clocks per instruction problem.

    Code size is not large

  10. @Chewie RFC – I would argue that it could take a lot of skill to make a big turd, and little skill to make something wonderful and beautiful complicated. Also, If someone implements a task using the Arduino platform vs. the same task done using say a TI-85 calculator with Z80 assembly code, what’s so great about it being done on the TI-85? Most people don’t have access to the tools that you need to even program that processor or the matching TI-85 calculator. Can the TI-85 calculator then be miniaturized and turned into a real product very easily? You can still be impressed by the TI-85 achievement, but I don’t think this diminishes the overall use of the Arduino platform. The same can be said with working with a standalone Atmel uC in AVR Studio with an AVR programmer vs. the ATmega328 and an Arduino. The end is the same, and better yet you can even use AVR Studio and an ISP programmer with the Arduino if you chose to. You can also chose to not use the Arduino libraries and write your own code right in the Arduino IDE. I think too many people see the Arduino as a bad thing, a toy, but in fact it’s quiet the opposite. It’s just another well designed and supported tool to complete a task.

  11. its reading a uncompressed wave of unknown bitrate directly, this shouldnt be that hard for a pic to handle, its not like it has to decode a compressed encoded ogg file

  12. how does it sound with 8khz samples? what mosfet did you use? was your pwm freq really 1mhz?

    can it play another song? ;)

  13. @Brett W. – I don’t think I conveyed completely what I meant. I don’t see the Arduino as a bad thing at all. I think it’s a great platform for rapid prototyping and for non-engineering types to get into the hobby. It’s great for that.

    But when you break it down, the Arduino platform also removes a lot of the more skilled engineering that may be involved with more a “direct hardware” approach, if I may coin the term. Also, you see a lot of Arduino projects that are essentially killing a mosquito with a nuclear missile. Like I said before, GREAT for the beginner or the rapid prototype… but it’s also great for those people to maybe open their experiences up with other platforms and solutions.

    Plus, I’m a PIC fan. :) (first microcontroller I learned, PIC16F877A). Actually, I like analog, specifically RF.

  14. OK… Dmitry has provided a different diagramme on his website: he has corrected the wiring ( which is wrong in the video ) and also uses the more conventional numbering of the pins. None of this is mentioned, so keep your eyes peeled :-)
    Apart from that, a nice project. If I were doing it, I’d probably just glue everything to the back of the SD adapter, and maybe pot it.
    rp

  15. it is purely fake, how would you produce analog sound signal from a digital pin of microcontroller pwm without using any capacitor+resistor filter.

  16. This concept is not fake we are doing a similar project. Our design comes from “Programming 16-bit Microcontrollers in C Learning to Fly the PIC 24″ (which is a great book you should get one)- the audio is stored on the SD card the PIC does a fairly simple PWM function with very good quality audio.

  17. ARDUINO = DO I REALLY KNOW ???
    No, that is why I picked ARDUINO…
    ARDUINO is designed for beginners and people
    that really don’t care how you setup a circuit for a microcontroller…

    Myself I love Pic Micro, it is untouched…
    I can do whatever I want to. I don’t have to buy a prefabbed board ever single time for a project…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s