A pacemaker is an implanted device that sends electrical signals to the heart, causing it to contract. Modern pacemakers usually work by detecting any period of time when the heart is not beating, and then stimulating the chambers of the heart.