Using an op-amp as a 5V regulator for a uC - Page 1
Forum section: electronics / projects

author: Mike Warren
author_rank: Unknown
timestamp: September 10, 2013, 10:33:39 pm
content: I've never done this before, but it seems to work fine. Is this a stupid idea?I need one channel of a LM358 in a small circuit that I need to keep the BOM as small as possible. I also need to keep the PCB as small as I can. The micro is an ATTiny24A and only runs at a couple of mA.The only other components I'd need are a 5V1 zener and a resistor, both of which are already in my BOM.

author: c4757p
author_rank: Super Contributor
timestamp: September 10, 2013, 10:51:43 pm
content: I'd call it a perfectly reasonable "hack". I've done it. But check how it behaves driving the decoupling caps - you may want to build it as a low-pass filter rather than a simple follower to avoid oscillation.Also, are your other rails regulated with similar accuracy to what you want in the 5V rail? If so, just use a voltage divider for the reference, no need for a Zener. And remember that the Zener voltage may not be what you expect with such a low driving current. BZX84 is specified at 5mA, IIRC. A divider will have no such problem.

author: Mike Warren
author_rank: Unknown
timestamp: September 10, 2013, 10:56:46 pm
content: Quote from: c4757p on September 10, 2013, 10:51:43 pmThat's something I'm concerned about, but I have built the circuit and it seems to work perfectly fine. As an experiment, I tried removing the 1uF and changing it to 4.7uF. It still behaved fine in both cases.QuoteNo, the supply rail for the LM358 can be anywhere from 9 to 20V.

author: Mike Warren
author_rank: Unknown
timestamp: September 10, 2013, 10:59:23 pm
content: Quote from: c4757p on September 10, 2013, 10:51:43 pmBut the ATTiny24A can run down to 2.7V and that wouldn't affect my circuit operation at all.

author: free_electron
author_rank: Super Contributor
timestamp: September 10, 2013, 11:03:38 pm
content: get a regulator in sot23 and a single opamp in sot23-5. same size as your lm358 and it will work right for pulsed loads.

author: Mike Warren
author_rank: Unknown
timestamp: September 10, 2013, 11:12:11 pm
content: Quote from: free_electron on September 10, 2013, 11:03:38 pmCan you suggest an opamp and regulator that would come out similar in cost to a LM358 and a zener in sub 1K quantities?

author: dannyf
author_rank: Super Contributor
timestamp: September 11, 2013, 12:00:39 am
content: QuoteIt can be a stupid idea.On the simpler end, the "opamp" can be a npn transistor.On the more complex end, you will need the opamp to be unity stable, and it has to be stable driving either a super-fact load, or a capacitive load, neither is a simple task.Given how inexpensive today's regulators are, I don't know what you have achieved via the opamp solution.On the other hand, it can be made to work.

author: Mike Warren
author_rank: Unknown
timestamp: September 11, 2013, 12:05:55 am
content: Quote from: AcHmed99 on September 10, 2013, 11:51:55 pmI already have a 47 Ohm resistor in the BOM, so that wouldn't be a problem, but anything more complex would be a problem with PCB space.LM358s cost 12c in small quantities.

author: Mike Warren
author_rank: Unknown
timestamp: September 11, 2013, 12:12:33 am
content: Quote from: dannyf on September 11, 2013, 12:00:39 amSimplicity and very low cost. I've built several samples of the circuit, with an LM358 and also an LM324 (Ti and ST). They all work reliably over a range of voltages and temperatures without anything special being done to quell oscillation. I was worried about oscillation, but the op-amp is running at unity gain, which my gut says shouldn't be a problem, and that's borne out by my experiments.But I'd hate to discover something I didn't think of after I go into production.

author: c4757p
author_rank: Super Contributor
timestamp: September 11, 2013, 12:15:36 am
content: Obviously many of you have much more experience than I do, but honestly I think the op amp is really the way to go here. LM358s in dual packages are incredibly cheap, cheaper than most single op amps, and you might as well take advantage of the extra amplifier. They're also quite forgiving and don't care too much about a somewhat capacitve load. In theory, yep, a regulator would have better transient response and not be prone to oscillating, but in practice I just don't see a 358 causing a problem here. It seems like the ideal solution to me, given the requirements.

author: dannyf
author_rank: Super Contributor
timestamp: September 11, 2013, 01:08:15 am
content: QuoteA npn is practically free, and there are many in your tool box and can deliver much more current, and a lot easier to route.

author: c4757p
author_rank: Super Contributor
timestamp: September 11, 2013, 01:15:08 am
content: Quote from: dannyf on September 11, 2013, 01:08:15 amHe's already using one, though, and has a spare unit... That isliterallyfree.

author: Mike Warren
author_rank: Unknown
timestamp: September 11, 2013, 01:31:53 am
content: How this situation came about was I needed 3 op-amp channels and selected an LM324. I then wondered if I could use the spare channel for the regulator, built a sample and it worked fine. Later, I was able to optimise out 2 channels so moved to an LM358.I have now added a 47 Ohm resistor in series with the output of the LM358 and the ripple has dropped from 80mV to under 10mV, and a lot of that looks like common mode noise.

author: dannyf
author_rank: Super Contributor
timestamp: September 11, 2013, 01:44:45 am
content: QuoteThe typical 3-terminal regulator is effectively a voltage reference (zener in your case), + an opamp driving an emitter follower + a feedback look, effectively what you have done (save the buffer).A LDO is the same except the output is on the collector.

author: dannyf
author_rank: Super Contributor
timestamp: September 11, 2013, 01:49:03 am
content: The ripple is likely caused by the opamp oscillating while driving the two capacitors. Putting a serial resistor is a typical solution in those cases though a small inductor or even a diode works better.LM358 has an output current rating of 10-20ma so it has limited ability to drive anything serious.I would also parallel the zener with a fast capacitor, or to use as high of a serial resistor with the zener to further help reduce ripple.