A pacemaker is a small, battery-operated device that senses when your heart is beating irregularly or too slowly.