Electronics > Projects, Designs, and Technical Stuff
Small and cheap MCU with DAC
<< < (6/7) > >>
nick_d:

--- Quote ---I think it's not an issue, but the device low power anyway. Considering the resolution and sample rate...  well, I'm not sure beforehand what will it sound like, so probably I'm searching for more than would be enough for the job. May be even 8bit with half of mentioned sample rate would be OK, I just don't know at the moment.
--- End quote ---
In that case, little more needs to be said I think. I thought of a design for you and I went to check the part numbers (looked at a circuit one of my clients gave me, he said it was the cheapest MCU he could find of any stripe)... and found it's already been recommended to you, the EFM Sleepy Bee device. Mind you, the one my client uses is cheaper at Digikey than the options already mentioned in this thread... see this link:
https://www.digikey.com/product-detail/en/silicon-labs/EFM8SB10F2G-A-QFN20/336-3170-5-ND/5115727
55c each in quantity 100. It doesn't have a DAC, but it has the timer PWM channel. You can get 10 bit accuracy at 16 kHz, by running your device at 16 MHz and setting the timer PWM for a period of 1024. This is totally good enough for playing a simple sound. Bear in mind that after output filtering, it would be impossible for anyone to tell how many levels your DAC has, you will just get a nice smooth audio signal regardless.

A problem you may run into is that the EFM8SB1 has only 8 kBytes of Flash, so with uncompressed audio you can store 0.5s of 8 bits/sample mono audio at 16 kHz (less however much space you use for code). You will want to look into compression. Using ADPCM you could probably expand this to 5s without much effort. Audio quality will suffer a bit. If you want to do an advanced codec, there's huge room for improvement. Also, depending on the type of sound, you could synthesize it on the fly. This is difficult for speech, but for simple chimes, etc, it's very easy.

Regarding your output filter, to get top quality audio from this cheap and crappy PWM DAC at a low bit-accuracy, what you need is a nice sharp cutoff, just before the Nyquist frequency of 8 kHz. The best way to do this is with a single op-amp and a Sallen and Key low-pass filter. See section 6 of this reference http://www.ti.com/lit/an/sloa049b/sloa049b.pdf for the circuit. If you wish, use two Sallen and Key filters in series. Choose your response, Butterworth would be fine. Then see section 9 of the reference for how to compute the component values. Use the order=2 or the order=4 section depending on whether you're implementing just one Sallen and Key filter, or two Sallen and Key in series.

cheers, Nick
Miyuki:
Hi
also ATtiny417 / ATtiny814 / ATtiny816 / ATtiny817 series have 8bit DAC and are cheap
Unixon:

--- Quote from: Miyuki on December 19, 2018, 12:33:16 pm ---also ATtiny417 / ATtiny814 / ATtiny816 / ATtiny817 series have 8bit DAC and are cheap

--- End quote ---
Yeah, good old AVRs :) I like them.

A little time ago I've managed to get my hands on a big bunch of ATtiny841's for just $0.4 (I guess they were reselling free samples or something like that), unfortunately, 841's don't carry a DAC around, but they carry hardware I2C slave which maybe very useful. Now every AVR of this class is at minimum about $1.5 or so at 1K pcs :(
Wimberleytech:

--- Quote from: Unixon on December 21, 2018, 10:15:23 pm ---
--- Quote from: Miyuki on December 19, 2018, 12:33:16 pm ---also ATtiny417 / ATtiny814 / ATtiny816 / ATtiny817 series have 8bit DAC and are cheap

--- End quote ---
Yeah, good old AVRs :) I like them.

A little time ago I've managed to get my hands on a big bunch of ATtiny841's for just $0.4 (I guess they were reselling free samples or something like that), unfortunately, 841's don't carry a DAC around, but they carry hardware I2C slave which maybe very useful. Now every AVR of this class is at minimum about $1.5 or so at 1K pcs :(

--- End quote ---

My vote is for the Silabs MCUs...but...then...I am partial...being their father...
nick_d:
So Daddy :)

Is it true that the cheaper family members omit the DAC, this seems to be so based on the different posts here but I did not do a thorough survey.

Also, why choose 8051, the memory model seems a bit unfriendly to my modern C-oriented eye but perhaps there are good reasons for this? Or is it due to commercial reasons such as compatibility, licensing, availability of an in-house 1T 8051 core?

Do you design the core or is it more of a matter of integrating IP blocks via a standard bus structure?

Do you use a HDL, such as Verilog or VHDL? What about simulation, are gate level and transistor level sims done before masks are ordered? Do you use expensive proprietary layout and routing tools?

Getting back to the topic: I would like to know the duration of audio and its nature: chimes, speech, music, ...? Reason is it affects choice of MCU... amount of Flash or possibly the use of a cheap outboard SPI Flash.

Regarding ADPCM compression I was overly optimistic in a previous post. I suggested 8kbyte Flash could hold 0.5s uncompressed or 5s compressed. I looked into it further and discovered that the common way to do it is to compress 8 bit A-law or mu-law samples into 4-bit ADPCM nibbles. So the cheap cheap Sleepy Bee suggested by me can do 1.0s.

As it turns out I have several experimental compressors that can improve this, without requiring hefty DSP as MP3 does. This might be an application for one of them, but it depends on the type of audio to be played.

cheers, Nick
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod