Random Question about Microcontroller Chips, because why not?

Faust

Supporter
27 September 2021
1,387
1,678
113
47
So, here's the dealio.

I'm trying to put together a simple light-and-sound circuit for cosplay props, and I need to make a speaker driver. But I'm a perfectionist. Sure, I can use pulse-width modulation to get a cheapo speaker to make a musical tone of sorts, but I want more flexible control over the waveform, and that means being able to control the amplitude (and therefore volume) of the sound wave rather than a simple on-off state. I want to be able to generate at least approximations of sine waves, triangle waves and sawtooth waves too. To do that, I need to be able to send an adjustable amount of current, not just a flat-out all-or-nothing.

The circuit also needs to be relatively small so it will fit into a handheld device, so the ideal solution would use a simple microcontroller circuit. But this is where I hit a bit of a snag: I'm having difficulty finding a microcontroller chip with a built-in Analog Output pin. It seems like such a simple requirement, but I'm not an electrician by trade and I'm having real difficulty finding something suitable because I don't really know what to look for.

I could use pulse-width modulation to simulate it, but I've not had very good results using this method, and that's all the majority of microcontroller chips offer. The ATTiny range of chips would have been perfect otherwise, as there's a teeny little 8-pin chip that has all the other options I need. It also seems to be the only option on Arduino and Raspberry Pi.

Now, I could use a DAC chip (Digital-Analog Converter) but that will add bulk to the electronics and, furthermore, will require several outputs from my microcontroller in order to actually drive it. Anything less than 4-bit (requiring 4 binary outputs) probably wouldn't be worth the hassle. Ideally, what I'd like is to use a small, cheap microcontroller with a built-in DAC on one of its output pins.

BUT! I don't have very good soldering skills, so it also can't be a chip that requires microsoldering. Honestly, I think my cheapo soldering iron wouldn't be capable of it even if I was! In fact, I'd vastly prefer something that I could slot into a breadboard or chip-holder, so that it was easy to take out and reprogram.

Does anyone know a chip that satisfies all these requirements?
  • Small size microcontroller chip
  • 1+ analog output pins
  • 3+ additional PWM outputs
  • 1 digital input pin for the button
  • Optionally but preferably:
    • Breadboard-compatible; no microsoldering
    • Operating voltage between 3v and 6v
    • Cost < $25
 
For the record, so far the only option I've found that MIGHT be suitable - and I stress the 'might' because I'm having difficulty finding out if it actually does have a DAC output - is the ESP32-C3. It's a breakout board, but a fairly small one so I might be able to work with it.

The ATTiny 1614 is the only other chip I've found so far, but I can only find surface-mount options and it seems expensive.
 

Users who are viewing this thread