For those whose hearts occasionally go off rhythm, pacemakers are, quite literally, life savers.
By providing a small electrical jolt at the right moment, they can keep a heart working at the appropriate pace.
Their main drawback is that they use batteries. Even the best of them eventually run out of energy, and replacing the batteries requires surgery.
Since surgery is generally best avoided, the search has been on for long-lasting power sources.
Various options have been explored, including, in the 1970s, plutonium.
Nuclear-powered pacemakers have thankfully fallen out of fashion and today, devices with lithium batteries last between 5 and 15 years.
Zhang Hao of the Second Military Medical University, in Shanghai,
and Yang Bin of Shanghai Jiao Tong University sought a way of recharging a pacemaker's battery by scavenging energy from inside the body.
As they report in the journal ACS Nano they have used the heart muscle itself to power a tiny generator.
Previous attempts to use cardiac muscle power to run pacemakers relied on piezoelectric materials.
These release electrons when deformed, and can be attached to beating hearts so that they are slightly bent with each heart beat, generating electricity.
This has worked, but not well enough: the output has rarely exceeded five microwatts, while most pacemakers require at least ten.
Dr Zhang and Dr Yang speculated that they could improve matters by arranging for their piezoelectric composites to be more dramatically deformed.
First, they created a small capsule from a sheet of flexible polymer a tenth of a millimetre thick.
After compression, this capsule would return to its original shape.
They then attached strips of piezoelectric composite to either side of the capsule,
attached electrodes to these strips, and covered the strips with a protective layer of silicone.
This layout meant that the strips were slightly bent from the beginning and required only a tiny, brief pressure to generate 15 microwatts.
The question was where to put the capsule, either in or on the heart, in order to get a similar effect.
A study of cardiac anatomy suggested the pericardial sac, at the organ's base, would be ideal.
It would squeeze the capsule tightly as the heart contracted and still keep a firm grip on it when the heart was relaxed.
To test this idea, the capsule's electrodes were attached to a commercial pacemaker that had had its battery removed,
and surgically implanted into a 50kg Yorkshire pig. The capsule generated enough power for the pacemaker to function normally.
Whether such an arrangement will pass human trials remains to be seen.
But if it does, the days of pacemakers that need battery replacements, with all their associated surgery, may be numbered.