Magnetic Linear Encoder v1.2

Overview

flickr:5360567381

The Magnetic Linear Encoder v1.2 is a fantastic building block for positioning systems. The core of this board is the AS5306 chip. This chip is what is commonly called an encoder. What is does is measure and report its location. It does this by reading the changes in the magnetic field as the chip changes position. What this means is that when properly assembled, this board will allow you to detect the the position of something like a linear axis. If you combine this with a motor and a microcontroller, then you can build a closed-loop positioning system whose speed and position can be precisely determined and controlled, even if something unexpected happens.

Specifications

flickr:5361182338
  • Resolution: 15 microns (0.015mm)
  • Simple, 4 pin, .100" pitch interface
  • Runs on 5V
  • 18" cable included
  • 12" magnetic strip included

Interface

flickr:5360638705
PIN NAME FUNCTION
1 VCC Supply +5V on this pin to power the board.
2 GND Connect to ground to power the board.
3 B This is the 'B' channel of the quadrature output.
4 A This is the 'A' channel of the quadrature output.

LEDs

flickr:5360638459
LED DESCRIPTION
POWER This is the power LED. This will light up when the board is properly powered with 5V.
A This is the Quadrature A LED. This will turn on and off in sync with the Quadrature A signal.
B This is the Quadrature B LED. This will turn on and off in sync with the Quadrature B signal.

Usage

Quadrature Encoding

flickr:5360678825

The output signal of the board is what is called quadrature encoding (also known as incremental encoding). This is a method for precisely measuring rotation using only 2 wires. An understanding of this technology is critical of using the magnetic encoder board. You can read more about it on Wikipedia and at this excellent National Instruments tutorial.

Wire it Up, Arduino Stylie

flickr:5361531646
  • VCC goes to 5V
  • GND goes to GND
  • Channel A goes to D2
  • Channel B goes to D3

Example Code - Arduino

The code below is for Arduino, and it assumes you have the A channel hooked up to pin 2, and the B channel hooked up to pin 3. Note: it is important that those pins are used, because they include special hardware functions that make it very easy to detect when the quadrature signals change.

Upload the code below to your Arduino, and then open your Serial Monitor. Set the speed to 19200, and you should see it print the position. Move the magnet over the device and you should see the position change. If you do, then everything is working!

#define ENCODER_A_PIN 2
#define ENCODER_B_PIN 3
 
long position;
 
void setup()
{
   Serial.begin(19200);
   Serial.println("Started");
 
   pinMode(ENCODER_A_PIN, INPUT);
   pinMode(ENCODER_B_PIN, INPUT);
 
   attachInterrupt(0, read_quadrature, CHANGE);
}
 
void loop()
{
   Serial.print("Position: ");
   Serial.println(position, DEC);
   delay(1000);
}
 
void read_quadrature()
{  
  // found a low-to-high on channel A
  if (digitalRead(ENCODER_A_PIN) == HIGH)
  {   
    // check channel B to see which way
    if (digitalRead(ENCODER_B_PIN) == LOW)
        position++;
    else
        position--;
  }
  // found a high-to-low on channel A
  else                                        
  {
    // check channel B to see which way
    if (digitalRead(ENCODER_B_PIN) == LOW)
        position--;
    else
        position++;
  }
}

Using it with the Extruder Controller v3.6

flickr:5361461798

Unfortunately the code to use this board with the Extruder Controller is not yet written. Be the first to write it, and we'll give you a free gift from the MakerBot store!

Using it with the DC Servo Driver v1.0

flickr:5360847899

With the power off, connect the encoder to the DC Servo Driver and follow the usage instructions for that board.

Schematic

flickr:5360587959

Partlist / BOM

Source

flickr:5361202294

The Magnetic Linear Encoder v1.2 is Open Source Hardware and is licensed under the GNU GPLv3.

Download

History

The Magnetic Linear Encoder v1.2 is an original design by Zach Hoeken of MakerBot Industries.

cell phone number lookup

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.