The batteries that power our phones and computers are picky about the weather. Stray out outside a narrow temperature range — typically 20 to 40 degrees Celsius (70 to 100 degrees Fahrenheit) — and they lose efficiency or fail.

Now UC Berkeley engineers have developed a new thermal regulator that keeps batteries at these “Goldilocks” temperatures even in extreme weather. The new regulator — described in a study in the journal Nature Energy — works through a passive system that does not consume extra energy.

“The optimum temperature range for lithium-ion batteries may not be a serious issue in the mild climate of the San Francisco Bay Area, but in the middle of winter in New York or Lake Tahoe, it’s not unusual for smartphones to automatically switch off because it’s too cold,” said Chris Dames, a UC Berkeley professor of mechanical engineering

“By inventing a new type of thermal regulator, we came up with a single design that can work for both Lake Tahoe in January and Death Valley in August,” Dames said.