[Q] Feasibility creating a (poor-mans) DAC with a LED driver and current mirror - Page 1
Forum section: electronics / beginners

author: CircuitBreaker
author_rank: Contributor
timestamp: October 01, 2025, 06:02:41 pm
content: Dear audience,In my never-ending quest to have a cheap solution for multiple calibration voltages (context: DIY synthesiser), I have come up with the following solutions in the past:[Actually built]STM32-internal DAC synchronised with GPIO output, using an SMP-08 (a stand-alone 8-channel S&H buffered IC) to have 8 quite stable voltages <- that was the ideal when I could buy it for ca. $1,1 at AliExpress (ca. $0.15 per buffered channel). That cannot be bought anymore at that price, regrettably[Read up about, but not tried]- PWM with RC filter -> but if I want 8/16 channels, I need to multiplex a lot (and synchronise a lot), and that lowers the usable PWM rate quite a bit- Cheap DAC ICs, but they will be quite a bit above $0.15 buffered per channelLately I was thinking: can't I use a bread-and-butter LED driver IC (quite cheap for multiple channels) and convert the output from constant-current to constant-voltage using either a current mirror and resistor, or perhaps directly a resistor directly attached to the driver?The thing is, I cannot find any info whether that's feasible, since all hits I get when searching for this really focus on using it with LEDs, not how to use it for constant-voltage output (which is understandable, since that's the primary use case after all).So my question to you is: a) do you think it is feasible at all? b) do you have any actual experience doing this?(and side question: what other poor-mans DAC for control voltages can you think of that cost ca. $0.15 per channel, buffered?)Thanks for reading!

author: petemate
author_rank: Regular Contributor
timestamp: October 01, 2025, 08:47:32 pm
content: The answer to these kind of questions always end up being about your specific requirements. What are your stability requirements for your calibration requirements?PWM with RC filter can be as stable as you want if you just add enough lowpass filtering(and then stuff like component noise comes into play), but your transient performance will suffer.You can probably use a LED IC driver, but they probably aren't that stable - especially the switching ones. You'll also need to adapt your receiving end to whatever voltage that the LED driver expects to see - they probably have some sort of over- and under-voltage triggers that you'll need to navigate.why not just use a DAC instead?a) Feasible? Yes, to some degree of stability. b) No, I do not. I would definitely go with a more tried-and-true solution.

author: Smokey
author_rank: Super Contributor
timestamp: October 01, 2025, 09:55:26 pm
content: "Cheap" as in $0.15 and "Calibration" don't mix.Your LED driver probably also has terrible resolution since it's designed to dim an LED not make a highly accurate and stable voltage reference. So you probably get, what, 64 steps? Maybe 256? You can get an 8bit DAC for practically nothing and, as you noted, it's built in to many microcontrollers.

author: langwadt
author_rank: Super Contributor
timestamp: October 01, 2025, 09:59:57 pm
content: why not 8/16 pwm outputs? the stm32 has plenty of timers

author: CircuitBreaker
author_rank: Contributor
timestamp: October 02, 2025, 06:36:47 am
content: Hi, thanks for replying. Regarding your points:Quote from: petemate on October 01, 2025, 08:47:32 pmYes. The idea is that I'd do that and that I'd use the voltages for relatively stable offsets -> really to calibrate certain offsets that you would normally use single-setup potmeters for (so no "musical" transients like e.g. filter frequency, OSC frequency, etc.)So I indeed have no problems with e.g. a 10 Hz cut-off for the PWM filter.Quote from: petemate on October 01, 2025, 08:47:32 pmThanks for that insight -> that's something I didn't think of. Perhaps I need to just build it and see how it behaves.Quote from: petemate on October 01, 2025, 08:47:32 pmHonest to god -> to try to have an overall BOM cost of a single "voice module" that is as low as possible. Am prepared to do more in software like calibration, etc. to make up for it. And, since it's a hobby project -> to see how far I can go that route before giving up and say "let's just use a DAC and accept the cost".Maybe I need to fall back to a "fixed, hand-calibrated" potmeter solution; I just had really liked to firmware-auto calibrate most parts of the voice module - so that manual re-tuning would not be needed.Second point; if I have 1 DAC, I need to multiplex that for multiple voltages (they way I did with the SMP08), and I'd need to build an additional S&H per channel - basically re-building the SMP08 in discrete. Maybe thatisthe best way. Who knows...Quote from: petemate on October 01, 2025, 08:47:32 pmThanks for the input. I'll consider it.

author: CircuitBreaker
author_rank: Contributor
timestamp: October 02, 2025, 06:43:36 am
content: Quote from: Smokey on October 01, 2025, 09:55:26 pmThat is good input. Perhaps the resolution would indeed be too low. Had, however, hoped that e.g. a 10-bit LED PWM driver would be sufficient. Would have to measure it then.Regarding the DAC - same point as I wrote above: An LED driver IC has multiple PWM outputsin parallelthat was the whole point of trying out this route. With only 1 (additional) DAC at my disposal in the MCU, I'd need to multiplex it; which has its own BOM cost effect and switching issues with it.Now, PCB real estate is not yet a prohibiting factor, so maybe indeed using an external DAC per channel is the solution. But IIRC 12-bit DACs are also quite a bit above the $0.15 per channel. But maybe I didn't look well enough... I'll have a look at that again.Do you perhaps have a cheap (12-bits) DAC IC in mind that doesn't cost (much) above ca. 15-20 ct. per channel?

author: CircuitBreaker
author_rank: Contributor
timestamp: October 02, 2025, 06:47:18 am
content: Quote from: langwadt on October 01, 2025, 09:59:57 pmDedicated GPIO outputs per voltage needed you mean? So, no multiplexing?I'd need to look that up, I thought that for reasonably cheap MCUs - think F0, G0, and the like - you only have 4 dedicated mappable PWM HW outs (even when you would have pins enough).-> But, good idea, I need to look that up for newer MCUs, thanks! Just tried it out with the newest STM32CubeMX -> for a G431C6U, I can actually map 22 HW pins to PWM channels (probably fewer, since I need timers for other stuff as well, but still)! So, that might actually be a good route. Thanks for the hint.

author: Terry Bites
author_rank: Super Contributor
timestamp: October 02, 2025, 09:58:51 am
content: The ROHM BU2506FV-E2 might just meet your stinge point without any additional mickey mouse circuitry.www.lcsc.com/product-detail/C184386.html

author: CircuitBreaker
author_rank: Contributor
timestamp: October 02, 2025, 10:45:06 am
content: Quote from: Terry Bites on October 02, 2025, 09:58:51 amThanks! I'll look into it. Ah.Bufferedas well! Great.

author: petemate
author_rank: Regular Contributor
timestamp: October 02, 2025, 10:34:20 pm
content: Quote from: CircuitBreaker on October 02, 2025, 06:36:47 amYou could consider an alternative option: Some sort of resistor ladder. If you have enough GPIOs, or you are wiling to throw demux ICs at it, you can build a DAC from just resistors, which are basically free. If PCB area isn't an issue, that could be a solution. Especially considering if your alternative is potentiometers.Quote from: CircuitBreaker on October 02, 2025, 06:36:47 amI'm currently repairing a device that does exactly this. One DAC fed into a 4051, which then has a film capacitor on each output. As long as the load is negligible(in this case its buffered by some opamps), you can probably get away with it.

author: mikerj
author_rank: Super Contributor
timestamp: October 06, 2025, 12:19:48 pm
content: Quote from: petemate on October 02, 2025, 10:34:20 pmAnd providing you can tolerate the noise from the inevitable charge injection during channel switching.

author: CircuitBreaker
author_rank: Contributor
timestamp: October 06, 2025, 06:29:14 pm
content: Thanks for (all) your advice!I'll probably go for this IC first:www.lcsc.com/product-detail/C184386.htmlThe only thing I'm a bit afraid of is that I have no (cheap) option when that is out of stock or not being fabricated anymore -> that IC isso muchcheaper than comparable alternatives, that when it's not available anymore, I'd probably have to rethink the design (not just buy a different IC)But that'll be worry for later...

author: mikerj
author_rank: Super Contributor
timestamp: October 06, 2025, 09:37:00 pm
content: The Microchip MCP48FVB18 is reasonably priced, 10bit 8ch like the Rohm part:https://www.microchip.com/en-us/product/MCP48FVB18