I was checking out this EE.SE question and thought I might play around with a similar idea on my own. I started to think about how I would model a power supply for a microcontroller with two possible sources (like a UPS for example), let's say a battery and some regulated supply like a USB connection. As soon as I began, I realized I do not know how to appropriately model a microcontroller in this way. It seems intuitive that I could use the following process (hypothetical problem below):

  1. I know from testing that the average current into V+ of the microcontroller is 20 mA
  2. My source voltage is 3.4v
  3. Therefore, my simulated load should be \$3.4v/20mA\$ or \$170 \Omega\$

Does this approach work? If not, what is a better approach?

  • 2
    \$\begingroup\$ I find that modelling microcontrollers and similar devices as behavioural resistors works well for most purposes. There are situations in which constant current sources are more appropriate, but resistors are a bit more "friendly". \$\endgroup\$
    – uint128_t
    Commented Jan 7, 2016 at 3:47
  • \$\begingroup\$ That's fine if your only concern is power. But with batteries the surge current can be important as well. \$\endgroup\$ Commented Jan 7, 2016 at 6:04
  • \$\begingroup\$ @uint128_t Can you please explain further? \$\endgroup\$
    – John Wick
    Commented Aug 9, 2016 at 9:55
  • 1
    \$\begingroup\$ @JohnWick Modelling MCUs as as behavioural resistors is "easier" than current sources, because if you model an MCU as a constant current source, it will sink current even if the supply voltage is zero, which will typically cause weirdness during startup, and so you have to take care to modify the behaviour of the current source accordingly. With a resistor, a zero supply voltage results in zero current, which is somewhat realistic, and you can simulate different MCU current draws by varying the resistance. \$\endgroup\$
    – uint128_t
    Commented Aug 16, 2016 at 4:48

1 Answer 1


if the supply voltage is fixed you could use use a 20mA current sink, if it's variable the resistor is probably a better model.


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.