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.

Comments

  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

  3. MassFactor says:

    Clearly fake, how could someone fit so much audio into such a small package?

  4. Matt says:

    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.

  5. Sprite_tm says:

    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.

  6. therian says:

    the best part, he didn’t need any shields :)

  7. @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 :)

  8. @Sprite_tm – my output freq is 1MHz. I found that 250KHz or lower did not produce good enough levels

  9. Hirudinea says:

    SUCK IT iPod! :)

  10. Matt Mackall says:

    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.

  11. aztraph says:

    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.

  12. filjoa says:

    Hi

    is possible you share some example of your code?

    like player file from card?

    best regards

  13. Beautiful and elegant! Hope you share the code, I’d really love to see how you oversample.

  14. Harvie.CZ says:

    We need to implement some mp3/ogg decoder for PIC or Attiny :-)

  15. salomon says:

    Very nice use of a PIC, im still doing sounds by single channel beeps hehehehe

  16. I swear I keep running into my clones on HAD. Every single idea I have, my clones are tirelessly working on while I sleep!

    To the LETTER you’ve created a miniature rick roll device. Great job!

  17. Really nice! loved it =D

  18. dudeman says:

    chop suey!

  19. Chewie RFC says:

    FINALLY! A project that does not involve an Arduino and uses real skill! Nice work.

  20. 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?

  21. 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

  22. Ross says:

    Can you post the code we would like to try it with 24FPIC.
    I wonder if it could play a MP3 file?

  23. @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.

  24. Frogz says:

    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

  25. ok, Frogs, you try it :)

  26. menotme says:

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

    can it play another song? ;)

  27. roliop says:

    Pins 2,4, and 7 are all grounded ? Are we sure ??

    rp

  28. mbonnin says:

    Wondering what is the capacitor for ?

  29. patheticbliss says:

    System Of A Down! Hell yeah!

  30. Chewie RFC says:

    @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.

  31. roliop says:

    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

  32. Where do you get these micros from in small quantities? Mchip has them but the minimum order seems to be 1000…
    No luck on Ebay or the usual suppliers.

  33. mbonnin says:

    I have the option to buy 1-25 for 1.28$ each on microchip website (http://www.microchipdirect.com/productdetails.aspx?mid=10&catalog=buymicrochip&category=PIC12F1840). But if you just want a few, you can try asking for samples, it usually works.

    If it does not, digikey should have a large choice of PIC microcontrollers as well

  34. geck0geek says:

    …and the source code?^^

    …how could i actually program the pic???

    …i really badly need it:) thanks^^

  35. krp says:

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

  36. dirk says:

    PWM for one

  37. Ross says:

    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.

  38. Russell_36 says:

    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…

  39. Ranzley says:

    hello sir do you have a link or tutotrial how to do that?

  40. Sehaj says:

    Hi

    When will u upload the code ?
    And does the songs starts from begining whenever we connect the battery ??

  41. Pedro Henrique says:

    Hello, does it work with other pic 12f? Like PIC 12F675?
    Thanks

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

Follow

Get every new post delivered to your Inbox.

Join 96,650 other followers