[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.
[youtube=http://www.youtube.com/watch?v=HRweAaubie0&w=470]
[youtube=http://www.youtube.com/watch?v=UtMgx4yMETw&w=470]
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.
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
Clearly fake, how could someone fit so much audio into such a small package?
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!
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.
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.
Would it not be analogue at the point it goes to the speaker therefore why are we talking about bits i.e. not digital.
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?
the best part, he didn’t need any shields :)
@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 :)
@Sprite_tm – my output freq is 1MHz. I found that 250KHz or lower did not produce good enough levels
SUCK IT iPod! :)
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.
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.
Hi
is possible you share some example of your code?
like player file from card?
best regards
Beautiful and elegant! Hope you share the code, I’d really love to see how you oversample.
We need to implement some mp3/ogg decoder for PIC or Attiny :-)
Very nice use of a PIC, im still doing sounds by single channel beeps hehehehe
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!
Really nice! loved it =D
chop suey!
FINALLY! A project that does not involve an Arduino and uses real skill! Nice work.
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?
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
Can you post the code we would like to try it with 24FPIC.
I wonder if it could play a MP3 file?
@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.
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
ok, Frogs, you try it :)
how does it sound with 8khz samples? what mosfet did you use? was your pwm freq really 1mhz?
can it play another song? ;)
Pins 2,4, and 7 are all grounded ? Are we sure ??
rp
Wondering what is the capacitor for ?
System Of A Down! Hell yeah!
posting stuff now: http://dmitry.co/index.php?p=./04.Thoughts/02.%20Single-chip%20audio%20Player
@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.
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
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.
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
http://www.DigiKey.com seconded.
…and the source code?^^
…how could i actually program the pic???
…i really badly need it:) thanks^^
it is purely fake, how would you produce analog sound signal from a digital pin of microcontroller pwm without using any capacitor+resistor filter.
From the following Altera White Paper:
http://www.altera.com/literature/wp/wp-01085-analog-output-digital-cpld-pwm.pdf
“One common misconception is that an audio output requires a filter to convert the digital PWM signal to an analog voltage. A speaker is a machine just like the motor, so the amount of energy imparted on air molecules by the cone is also -> voltage x current x time = joules”
PWM for one
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.
+1 for “Programming 16-bit Microcontrollers in C – Learning to Fly the PIC 24” this is a great book!
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…
hello sir do you have a link or tutotrial how to do that?
Hi
When will u upload the code ?
And does the songs starts from begining whenever we connect the battery ??
Hello, does it work with other pic 12f? Like PIC 12F675?
Thanks