Author Topic: Small and cheap MCU with DAC  (Read 14957 times)

0 Members and 1 Guest are viewing this topic.

Offline nick_d

  • Regular Contributor
  • *
  • Posts: 120
Re: Small and cheap MCU with DAC
« Reply #25 on: December 18, 2018, 11:24:14 am »
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.
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
 
The following users thanked this post: Unixon

Offline Miyuki

  • Frequent Contributor
  • **
  • Posts: 912
  • Country: cz
    • Me on youtube
Re: Small and cheap MCU with DAC
« Reply #26 on: December 19, 2018, 12:33:16 pm »
Hi
also ATtiny417 / ATtiny814 / ATtiny816 / ATtiny817 series have 8bit DAC and are cheap
 

Offline UnixonTopic starter

  • Frequent Contributor
  • **
  • Posts: 627
Re: Small and cheap MCU with DAC
« Reply #27 on: December 21, 2018, 10:15:23 pm »
also ATtiny417 / ATtiny814 / ATtiny816 / ATtiny817 series have 8bit DAC and are cheap
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 :(
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1135
  • Country: us
Re: Small and cheap MCU with DAC
« Reply #28 on: December 21, 2018, 11:18:16 pm »
also ATtiny417 / ATtiny814 / ATtiny816 / ATtiny817 series have 8bit DAC and are cheap
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 :(

My vote is for the Silabs MCUs...but...then...I am partial...being their father...
 

Offline nick_d

  • Regular Contributor
  • *
  • Posts: 120
Re: Small and cheap MCU with DAC
« Reply #29 on: December 22, 2018, 12:26:04 am »
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
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1135
  • Country: us
Re: Small and cheap MCU with DAC
« Reply #30 on: December 22, 2018, 01:27:09 am »
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.
At the time, it was all about die size...getting the cost down.  Same with the ADC.  Had to go with an 8-bit to save area.
Quote
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?
Good question.  You may not like the answer.  We knew of a good core at a good price so we bought it and ultimately bought the group that made the core.  Simple as that.

Quote
Do you design the core or is it more of a matter of integrating IP blocks via a standard bus structure?
Totally custom from the bottom up.
Quote
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?
Verilog.  Syopsys and Cadence tools.  A very refined methodology to ensure accuracy.  In the later days, we did top-level simulations only to ensure blocks were connected properly (pch bias current to nch mirror...stuff like that)

We were taping out a new core every four months with heavy reuse.  Virtually all of the products are still selling...18 years later.
 

Offline UnixonTopic starter

  • Frequent Contributor
  • **
  • Posts: 627
Re: Small and cheap MCU with DAC
« Reply #31 on: December 22, 2018, 02:31:20 pm »
BTW, why so many microcontrollers that have a built-in ADC consisting of a DAC and a comparator circuit don't offer a buffered output from this internal DAC?
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1135
  • Country: us
Re: Small and cheap MCU with DAC
« Reply #32 on: December 22, 2018, 03:11:43 pm »
BTW, why so many microcontrollers that have a built-in ADC consisting of a DAC and a comparator circuit don't offer a buffered output from this internal DAC?

I would say that most DACs used in SAR ADCs are charge-scaling.  These do not work as static DACs.

The 12-bit ADC on the early Silabs MCUs is a combination voltage-scaling/charge-scaling DAC.  The voltage-scaling portion could be used as a stand-alone DAC.  The Silabs 8-bit DAC is totally charge-scaling (for all the early ones).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf