Soon, broken electronic devices could repair themselves.

Printable electronics, made by depositing electronic ink onto a flexible material like plastic, have allowed manufacturers to mass-produce electronic circuits. Tons of them can now be printed on large sheets or rolls all at once—much like traditional printing methods, such as screen printing and inkjet printing, but with conductive inks. The production is faster and more cost-effective than conventional methods, and resulting electronic components are light-weight, thin, flexible, and inexpensive.

With the technology, you can create flexible solar cells, point-of-care medical diagnostic devices, novel drug delivery devices, smart packaging, and clothing, among other things. However, their flexibility is also their weakness: it makes them more susceptible to mechanical deformation over time, making them prone to damage.

“Fragility is the ‘Achilles’ heel’ of the multibillion dollar field of printed electronics,” a team of University of California San Diego researchers wrote in a paper published in Science Advances in early November. The printed electronics industry is set to be worth over $12 billion by 2022. “Development of self-healing inks will thus be germane to printed electronics for their numerous applications in scenarios where mechanical damage of devices is common.”

To solve the problem, the UCSD engineers created an ink made of tiny particles—typically smaller than 0.5 millimeters—of pulverized neodymium, the strongest permanent magnet. The researchers used the ink to create a circuit that they attached, along with an LED light and a coin battery, to the sleeve of a T-shirt. To test it, they cut the circuit as well as the fabric, causing the LED to turn off. A few seconds later, it came back on.

Normally, the magnetic fields neodymium microparticles cancel each other out. However, the researchers figured out that if they oriented the microparticles in a specific configuration in the presence of an external magnetic field, particles on both sides of a tear appeared to be magnetically attracted.

The new technology allows devices with the magnetic ink to self-repair tears as wide as 3 millimeters—a record size.

Although the neodymium particles are highly conductive, they have poor electrochemical properties, which bars them from picking up cues like temperature and pH changes. To remedy this, the microparticles were combined with carbon black, ”a widely explored material for fabricating electrochemical systems” like batteries and sensors, according to the researchers. The addition is essential for restoring the complete functionality of electrochemical devices such as wearables or implantable medical devices.

The state-of-the art ink has an edge over existing self-healing methods: the older techniques have to be kickstarted with an external trigger and can take several hours or days to repair circuits. The new technology can repair a tear in around 50 milliseconds. Previously, scientists have used microcapsules filled with metal materials to heal electronics, but the technology isn’t repeatable. By contrast, the magnetic ink can heal recurring damages in the same spot or multiple damages in different regions.

“Our work holds considerable promise for widespread practical applications for long-lasting printed electronic devices,” said Joseph Wang, director of UCSD’s Center for Wearable Sensors, in a press release. Devices like self-healing batteries; electrochemical sensors; and wearable, textile-based electrical circuits could boost the longevity of electronic devices in the near future.