C12 Embedded systems in MicroPython and C · Practice
Problem set 10: watchdogs, power, flash and control
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
A main loop's longest normal pass is 12 ms. The watchdog gets a 2× margin, and the device may be out of action for at most 500 ms after a hang.
(a)
What timeout does the margin give?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
Does that meet the outage limit (1 for yes)?
(c)
What is the largest margin the outage limit would allow?
Check
A sensor node sleeps at 0.002 mA. Every 10 s it wakes for 100 ms at 2 mA, then transmits for 5 ms at 30 mA. It runs from 220 mAh.
(a)
What is the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How long does the battery last?
Check
A linear regulator drops 5 V to 3.3 V for a load of 0.05 mA, and draws 100 µA of its own (quiescent) current.
(a)
What does it dissipate from the load current?
Write units the way you normally would: 1.5 mW, 1500 µW and 0.0015 W are the same answer.
(b)
What is its efficiency?
Check
A task needs 100000 cycles. Active current is 0.3 mA plus 0.3 mA per MHz of clock, and the board can run at 2 or 10 MHz from 3.3 V.
(a)
What energy does the task take at 2 MHz?
Write units the way you normally would: 1.5 µJ, 1500 nJ and 0.0015 mJ are the same answer.
(b)
And at 10 MHz?
Check
A coin cell at 2.9 V has 20 Ω of internal resistance; a radio burst draws 10 mA, and the board resets below 2.6 V.
(a)
What voltage does the board see during the burst?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What is the largest burst current that avoids a reset?
Check
A supercapacitor of 1 F charged to 3.3 V keeps a clock and RAM alive at 0.01 mA until the voltage falls to 2.4 V.
(a)
How long does it last (constant current)?
(b)
How much energy does it give up?
Write units the way you normally would: 1.5 J, 1500 mJ and 0.0015 kJ are the same answer.
Check
A device logs 64-byte records 24 times a day across 4 flash sectors of 2048 bytes, each rated for 10000 erases.
(a)
How long does one lap of the log take?
(b)
How long until the flash wears out?
Check
A firmware bug resets a device 5 times a day, and each reset writes a crash record by erasing and rewriting one fixed sector rated for 10000 erases.
(a)
How long until that sector wears out?
(b)
And if 32-byte crash records are appended to a 4 KB log in the same sector instead?
Check
A plant of gain 2 and time constant 10 ms is sampled every 0.5 ms.
(a)
What is ?
(b)
What is the largest stable proportional gain?
(c)
Above what gain does the response alternate sign each sample?
Check
A loop was designed for 60° of phase margin at a 50 Hz crossover, ignoring sampling. It runs at 2 kHz with 2 samples of total delay.
(a)
How much margin does the delay take?
(b)
What margin is left?
Check
A PI controller stores = 0.42 in Q10 and = 0.0007 in Q20.
(a)
What integer holds ?
(b)
And ?
(c)
How far off is the stored integral gain, in percent?
Check
A heater's PWM is pinned at 100% for 20 s with an error of 200 codes, sampled every 5 ms; each sample adds 0.002 × e to the integrator.
(a)
How much does the integrator wind up without anti-windup?
(b)
How much with conditional integration?
Check
A proportional loop with gain 5 controls a plant of gain 1; then an integrator is added.
(a)
What steady-state error does the proportional loop leave?
(b)
And with the integrator, once settled?
Check
A windowed watchdog must be kicked between 5 and 20 ms after the last kick. A loop kicks once per pass; passes take 15 ms, and once a second a slow job adds 30 ms to one pass.
(a)
Are normal passes inside the window (1 for yes)?
(b)
Is the slow pass inside it too (1 for yes)?
Check
A device must last 1 years on 1000 mAh.
(a)
What average current may it draw?
Write units the way you normally would: 1.5 µA, 1500 nA and 0.0015 mA are the same answer.
(b)
And if 20% of the capacity is lost to self-discharge and cold?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C12