Home > Driving Motors, Exploring Ideas > Arduino Compass Stepper Test

Arduino Compass Stepper Test

After some work, the compass and solenoids array is ready.

Using 1600 ohms coils from 24VDC relays.

A simple test demonstrate that 3 milliamps from the Arduino’s logic pins will be enough to move the compass needle.

This is the Sketch used (the one shown in YouTube is incorrect):

/*
CompassStepper
Arduining.com 04 MAR 2012
Driving 4 electromagnets arranged arround a compass
to produce angular movements of the needle.
*/
#define COIL11   11  // Terminal 1 of the Coil 1
#define COIL12   10  // Terminal 2 of the Coil 1

#define COIL21   9  // Terminal 1 of the Coil 2
#define COIL22   8  // Terminal 2 of the Coil 2

#define COIL31   5  // Terminal 1 of the Coil 3
#define COIL32   4  // Terminal 2 of the Coil 3

#define COIL41   3  // Terminal 1 of the Coil 4
#define COIL42   2  // Terminal 2 of the Coil 4

#define STEPTIME 1000

void setup(){
// Digital pins 2~11 as outputs. 
  for(int i=2;i<12;i++){
    pinMode(i,OUTPUT);
    digitalWrite(i,LOW);        //all coils OFF.
  }

}

void loop(){
digitalWrite(COIL11,HIGH);  //Turn ON Coil 1
digitalWrite(COIL41,LOW);   //Turn OFF Coil 4
delay(STEPTIME);
digitalWrite(COIL21,HIGH);  //Turn ON Coil 2
digitalWrite(COIL11,LOW);   //Turn OFF Coil 1
delay(STEPTIME);
digitalWrite(COIL31,HIGH);  //Turn ON Coil 3
digitalWrite(COIL21,LOW);   //Turn OFF Coil 2
delay(STEPTIME);
digitalWrite(COIL41,HIGH);  //Turn ON Coil 4
digitalWrite(COIL31,LOW);   //Turn OFF Coil 3
delay(STEPTIME);
}

Related videos in YouTube:

 

See the video of  how was made:

Advertisements
  1. AntonioLopez
    April 21, 2012 at 12:39 PM

    I need the code for this video you posted,

    Please….Please………Thank you

    antonio_lopez949@yahoo.com

    • April 22, 2012 at 6:23 PM

      Code sent and posted!

      • AntonioLopez
        April 22, 2012 at 10:31 PM

        Thank you for the code.

  1. April 16, 2012 at 11:17 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: