First off: Your schematic is very unusually drawn – so much it makes understanding it and discussing it hard! If you revise your schematic, please
Anyways, I'll call your
The AI propose to use …
Yeah, sorry, "AI" as you are referring to is "LLMs", and that means these are "give me what an answer to this question would usually look like" machines, not "give me an answer that makes sense based on technical understanding". That works, sometimes, for human subjects, but works never for electricity. Physics doesn't care about what sounds good, it follows simple rules. So, forget about asking your AI assistant about schematics, for the next 5 to 10 years at least. Then, re-evaluate.
I've thought that the photocoupler will be compatible with this goal,
no, you cannot attach an AC to the emitter LED of an optocoupler. An LED is not designed to operate with AC, and even if it were, you would need significant current limiting to not break it. So, this is doubly broken. If you're lucky, your AC source was current-limited enough, or its voltage was low enough, so that only small currents flowed, and U1 still works.
The next thing is that your use of the specific choice of optocoupler model makes no sense – in the "maximally on" state, it still has about 1 V of forward voltage on its output side. So, that only makes any difference at all when the voltage across R1 is larger than 1 V (when U1 is off). And at that point, the voltage across R2 is only 0.024 V (because effectively the same current flows through R2 as through R1). See the problem?
Also, I find it questionable that you want an octocoupler here – unless the microcontroller you're using is actually on an independent, isolated potential, i.e., when there's no conductive connection between OUT- or OUT+ through any component to the ground of your microcontroller. Is that really the case? We have to assume it is, otherwise the optocoupler is just the wrong device.
Let's take a step back here, and infer the problem you were trying to solve:
The "usual" solution here is to either
I'd honestly go with the former; it's easier here. Add a simple fixed-voltage linear regulator to power your microcontroller. You'd use the microcontroller's PWM unit to generate an adjustable-duty-cycle rectangular wave, filter that with a simple RC filter to get a low-ripple voltage, and use that (through a diode) to increase the current through the low-side resistor (your former R1, though that needn't be adjustable anymore) of a voltage divider (here, your R2-R1 voltage divider).
To improve accuracy, you can use the ADC of your microcontroller to sense (again, through a voltage divider across the output voltage) whether your adjustment made the LM317 produce the output voltage you wanted (and otherwise react by adjusting the PWM).
The should-be voltages would still be set from the "main" controller in that other voltgage domain, but through e.g. an UART line fed through a "digital" optocoupler (the Darlington output of U1 is really not helping anyone here).
I'd expect this is much more complicated than you expected – but you're setting yourself up for complexity if you do things with an LM317 and an isolation boundary. Isolatedly-controlled power supplies are often not that much more complex than unisolated cousins – by being switch-mode power supply designs, where the feedback from the output side is typically "binary" (just comparing the instantaneous output voltage to a reference voltage,) and then feeding that back to a controller who switches, again, just "binary" a current through an inductor on or off. Binary things are easy to get across an isolation barrier!
It seems to me your design is actually intended to be a switch-mode design, without you realizing it (because your U1 effectively is going to be on or off, by and large), with the humongous (really, unhealthily large – this brings its own set of problems!) C1 intended to act as smoothing element.
So maybe learn about switch-mode power supplies, specifically buck converters. With one of these, your whole setup gets much easier, and more power efficient (should you discover later on that you want more than a few milliampere out of your U2).
If open-loop voltage setpoint control from the microcontroller across an isolation barrier is enough, then that makes things a lot easier:
This has one significant advantage over directly PWM'ing the output: You get the full control loop of the buck converter, which is optimized for high accuracy and stability and low ripple (in various shapes of tradeoffs), without the need for a gigantic output capacitor, due to the typically relatively high (and thus, easy to smooth out) switching frequency of the controller, no matter how slow your PWM is (as long as you sufficiently filter it).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4