using a electromagnet and a permanent magnet