Grove - Electromagnet

An electromagnet is a type of magnet in which the magnetic field is produced by electric current. An electric current flowing in a wire creates a magnetic field around the wire, due to Ampere's law(see drawing below). To concentrate the magnetic field, in an electromagnet the wire is wound into a coil with many turns of wire lying side by side. The magnetic field of all the turns of wire passes through the center of the coil, creating a strong magnetic field there. Grove - Electromagnet can shuck 1KG weight and hold on. it easy to use, to learn electromagnet principle.




With Arduino


  Turns on an Electromagnet on for one second, then off for one second, repeatedly.

  This example code is in the public domain.

int Electromagnet = 0;
int LED = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(Electromagnet, OUTPUT); 
  pinMode(LED, OUTPUT);   

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(Electromagnet, HIGH); // turn the Electromagnet on (HIGH is the voltage level)
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(Electromagnet, LOW);// turn the Electromagnet off by making the voltage LOW
  digitalWrite(LED, LOW);  // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second

With Raspberry Pi

1.You should have got a raspberry pi and a grovepi or grovepi+.
2.You should have completed configuring the development enviroment, otherwise follow here.

4.Navigate to the demos' directory:

   cd yourpath/GrovePi/Software/Python/
   nano   # "Ctrl+x" to exit #
import time
import grovepi

# The electromagnet can hold a 1KG weight

# Connect the Grove Electromagnet to digital port D4
electromagnet = 4


while True:
        # Switch on electromagnet
        print "on"

        # Switch off electromagnet
        print "off"

    except KeyboardInterrupt:
    except IOError:
        print "Error"

5.Run the demo.

   sudo python


File:Grove Electromagnet v1.0 SCH
Datasheet ZYE1-P20-15 PDF

Copyright (c) 2008-2016 Seeed Development Limited ( /
This static html page was created from