You didn't say what the power supply will be powering, i.e. what the output voltage and current are. Thus, it's not clear that a switching converter is really the best solution to your problem. A simple linear regulator or even unregulated rectified AC might be good enough. Without knowing the voltage and current it's impossible to recommend a topology, much less component values.
As others have noted, your circuit has a lot of problems. Here's are the ones I noticed. There may be more.
The overall topology is that of an inverting buck-boost converter, not a non-inverting buck converter.
You're using the rectified mains voltage (~170V) directly to get an output that's probably in the range of 5V. With a buck converter, that gives a duty cycle of ~3%, which is probably too low to control effectively. Also, your rectified input supply does not have a capacitor. Finally, there's no isolation between the mains and the output, which means that a fault could be lethal. This is not something you should ignore. Imagine your family and friends standing around your grave in tears, and their only consolation is the smoking remains of a crappy power supply.
Powering an MCU via a voltage divider is questionable at best. Powering an MCU from the output side of the thing it's regulating is extremely questionable. MCUs like stable voltages, and misbehave if they don't get them.
Your MCU cannot drive the switching transistor directly, since its output signal will be at the same level as the output voltage, thus making \$V_{BE} = 0\$. Also, MOSFETs are usually better than BJTs for this application.
Feedback control is a pretty big subject. You can make a nice career out of implementing and tweaking control systems for power supplies. If you're not familiar with control theory, you probably won't want to deal with it as part of another project you're already having trouble with. Errors in the control algorithm for a high-voltage circuit can be lethal.
The MCUs feedback input and VCC are both grounded.
Here's what I recommend you do:
Consider using a wall-wart instead of designing your own power supply. It will save you a lot of trouble.
If you must design your own supply, put a transformer on the input to reduce the voltage and isolate the circuit from the mains. Be sure to use a fuse and insulate all exposed high-voltage conductors.
Unless you need high efficiency (>80%), try using a linear regulator like a 7805 or LM317. An LDO will let you reduce your transformer output voltage for greater efficiency.
If you really need a switch-mode power supply, get an integrated converter like the one Russell mentioned. The datasheet will tell you what component values to use. You can also find modular power supplies that include all components. Or you could even copy an existing circuit without modification.
If you insist on designing your own switch-mode power supply from scratch, you will need to learn a lot more. For background knowledge, you'll need at least a bachelor's degree worth of EE education. This Coursera class can teach you about the basics of SMPS design and control systems. (I think you can do it even when there are no sessions scheduled.) Or you can find a textbook, or take a class at a local college.
This is a major project, not a stepping stone.
Basically what you're asking is, do current controlled switching convertes exist.
The answer is yes, as you can see here:
Yes, that looks complicated ! But it's not (for me at least).
The MAX649 is a DCDC Buck converter controller IC, it does not have a build in switch, PMOS Q1 is the switch. If you would want a constant output VOLTAGE, you would need a voltage divider (2 resistors) and feed a divided value of the output voltage back to the FB (feedback) pin.
But in this circuit, has a constant output CURRENT, to charge a battery ! Instead of sensing the output voltage, now the output current is sensed by taking the voltage across R10, amplifying this voltage (the opamp does this, with a feedback network to set the gain) and where does ths feedback signal go ? Straight back in to the FB pin !
The simple buck converter in your schematic is too simple to be considered having a voltage or a current output. If you change the load then voltage and current change, it is not regulated in any way. Yes you can change the PWM of the switch signal but that PWM signal needs te be determined somehow. This is done with voltage or current feedback.
Best Answer
It will be DC with a some ripple depending upon the inductor value, frequency and the value and quality of the output capacitor.