0
\$\begingroup\$

On microcontrollers there are analog outputs which output a pulse width modulation digital signal.

I can set the output to whatever I want as long as it's not greater than 5 V.

For example, I want set the output to 4 V because there's a module that needs a 4 V power source. Can that module run without problems if the power source comes from analog output PWM?

\$\endgroup\$
4
  • \$\begingroup\$ a microcontroller has a very limited capacity to supply current from its data pins .... drawing too much current causes the microcontroller to become an expensive fuse \$\endgroup\$
    – jsotola
    Commented Dec 12, 2020 at 1:36
  • 1
    \$\begingroup\$ You may be able to work something out but it will be a bit more complicated than just connecting the PWM output to the power input of your module. You will need some kind of transistor to buffer the current and some kind of RC or LC filter to smooth it out. \$\endgroup\$
    – user57037
    Commented Dec 12, 2020 at 3:24
  • 2
    \$\begingroup\$ You already asked about this project at How to drop voltage to 4 volt from 5 volt source voltage with resistors? and were pointed at an explanation of how to properly power your GSM modem. It will be challenging enough using a quality switching power supply; please don't improvise, and please don't post multiple questions for the same need. \$\endgroup\$ Commented Dec 12, 2020 at 6:12
  • 1
    \$\begingroup\$ PWM is essentially open-loop in that it doesn’t react to changes in the load. GSM applies a highly variable (1000:1) load and so PWM is not suitable in this application. \$\endgroup\$
    – Frog
    Commented Jul 21, 2022 at 8:41

2 Answers 2

8
\$\begingroup\$

PWM outputs aren't analog; they are digital, switched with a certain duty cycle.

The idea that they are analog probably stems from the unfortunately named analogWrite() function as implemented on Arduinos, that sets a duty cycle on a PWM pin.

It is a misnomer; an 80% PWM signal on a 5 V MCU is 5 V for 80% of the time, and 0 V for 20% of the time; it is not 4 V, it is only 4 V on average.

Loads that have a maximum supply voltage of, say, 4 V shouldn't, in general, be driven with a 5 V signal, PWM or not.

Also, a PWM signal from an MCU can only source a very small current (5 mA to 20 mA for MCUs used on Arduinos), and can't be used to power loads larger than, say, a small LED.

It can be used for PWM-switching an external power source for a larger load, though, if that load can work with PWM and the voltage stays within its specifications, as above.

\$\endgroup\$
4
  • \$\begingroup\$ Then why when i test on multimeter it shown 4volt? \$\endgroup\$ Commented Dec 12, 2020 at 2:41
  • \$\begingroup\$ If it's duty cycle. The multimeter will show 5v to 0v repteadlyy in certain time? \$\endgroup\$ Commented Dec 12, 2020 at 2:43
  • 1
    \$\begingroup\$ A multimeter is too slow for that. What you see when measuring a PWM signal with a multimeter depends on the type of multimeter, and also on your setting it to DC or AC. Most multimeters don't give useful results when measuring PWM signals. \$\endgroup\$
    – ocrdu
    Commented Dec 12, 2020 at 2:57
  • 2
    \$\begingroup\$ @MuhammadIkhwanPerwira Most multimeters will read the average voltage on DC ranges. But your module needs smooth actual DC voltage, not a waveform pulsing from 0-5V. \$\endgroup\$ Commented Dec 12, 2020 at 3:03
3
\$\begingroup\$

There are limited applications where you can use a PWM signal as a power supply: if the current requirement is within what an IO pin can supply (a few milliamperes) and if the load (a) is ok with a PWM supply, something like a small light bulb, or (b) the supply is smoothed with an LC filter (inductor and capacitor). If you’re thinking of driving an LED you’d probably find that PWM will work although it’s not ideal, the IO pin will likely current-limit during its ‘on’ phase at a level that won’t damage the LED but it’s not an elegant solution.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ They're trying to power a GSM module with pulse current needs in the 2 amp range... \$\endgroup\$ Commented Dec 12, 2020 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.