Hey, I've tried to build a DC to DC convertor using the arduino, based on the following schematic:
According to Wikipedia
Strangely my circuit doesn't follow this equation.The output voltage when I changed the frequency of the PWM, The inductor or the LOAD resistor.While it should be changed by the duty cycle
Moreover, I've used the following simulator to simulate this circuit and it was working the same as my circuit on a breadboard
You are using real components instead of idealised components.
The load will affect the voltage because if it did not then you could draw an infinite amount of current from it which you can't due to things like magnetic saturation in the coil.
Getting switch mode regulators to work reliably calls for careful design. In particular, the inductor needs to have a high enough inductance to limit the ripple current to a reasonable value, it must not saturate at the peak current, and its resistive and magnetic losses must be low. The Arduino default PWM frequency is too low to make this easy and you really need to increase it, otherwise the inductor becomes unmanageably large.