how to produce electricity from magnets