# How can one model a microcontroller's power consumption?

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?

• 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". – uint128_t Jan 7 '16 at 3:47
• That's fine if your only concern is power. But with batteries the surge current can be important as well. – Ignacio Vazquez-Abrams Jan 7 '16 at 6:04
• @uint128_t Can you please explain further? – John Wick Aug 9 '16 at 9:55
• @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. – uint128_t Aug 16 '16 at 4:48