Getting Started with Encoder Sensor Module (SN-ENC-MOD)

The Encoder Sensor Module (SN-ENC-MOD) is an electro-mechanical device that converts the angular position or motion to an analog or digital code. This tutorial will show you the basic operation on how to use this sensor.

Last Updated on 6 July 2017
This article is written by internship student Tian Fu Loke


The Encoder Sensor Module (SN-ENC-MOD) is an electro-mechanical device that converts the angular position or motion of a shaft or axle to an analog or digital code. The parameters monitored are determined by the type of application and can include speed, distance, RPM, position and etc. Revolutions per minute (abbreviated rpm, RPM, rev/min, r/min) is a measure of the frequency of rotation, specifically the number of rotations around a fixed axis in one minute. It is used as a measure of rotational speed of a mechanical component.

The RPM can be calculate as:
(60 * 1000 / pulsesperturn )/ (millis() – timeold)* pulses


  • Use imported groove coupler sensor.
  • Groove width:5mm.
  • Output state indicator lights.
  • Obscured output high; unobstructed output low.
  • The comparator output, the signal is clean, the waveform, driving ability, more than 15mA.
  • Operating voltage 3.3V-5V.
  • The output in the form: Digital switching outputs. (0 and 1)
  • A fixed bolt hole for easy installation.
  • Small plates PCB Dimensions: 3.2cm x 1.4cm.
  • Using a wide voltage LM393 comparator.
VCC3.3v-5v available
GNDGround connected to 0v
DODigital output
AOAnalog output



Arduino IDE


  1. Stack up your Arduino UNO/CT-UNO and 3A Motor Driver Shield together.
  2. Connect Dc Motor 12V to motor driver shield (M1A, M2A) to the terminal connector.
  3. Connect your dc encoder sensor Vcc to Arduino Vin, GND to Arduino GND and D0 to Arduino digital pin2. A0(Analog signal of the output pulses. The output signal in real time. (Usually not used).
  4. Connect your potentiometer Vcc to 5V, ground to 0V and Vco to Arduino A1.
  5. Connect USB port between Arduino UNO/CT-UNO to the computer to get the upload program.
  6. Connect your 12v power supply to the 3A motor driver shield.
  7. You can make a simple prototype to take look after upload program.


signed int motor1Speed;
int encoder_pin = 2;  // The pin the encoder is connected           
unsigned int rpm;     // rpm reading
volatile byte pulses;  // number of pulses
unsigned long timeold; 
// The number of pulses per revolution
// depends on your index disc!!
unsigned int pulsesperturn = 20;

 void counter()
    //Update count

void setup()
   pinMode(encoder_pin, INPUT);
   pinMode(motor1Speed , OUTPUT); 
   attachInterrupt(0, counter, FALLING);
   pulses = 0;
   rpm = 0;
   timeold = 0;


 void loop()
   if (millis() - timeold >= 1000){  /*Uptade every one second, this will be equal to reading frecuency (Hz).*/
  //Don't process interrupts during calculations
   //Note that this would be 60*1000/(millis() - timeold)*pulses if the interrupt
   //happened once per revolution
   rpm = (60 * 1000 / pulsesperturn )/ (millis() - timeold)* pulses;
   timeold = millis();
   pulses = 0;
   //Write it out to serial port
   Serial.print("RPM = ");
   //Restart the interrupt processing
   attachInterrupt(0, counter, FALLING);
   int potvalue = analogRead(1);  // Potentiometer connected to Pin A1
    int motorspeed = map(potvalue, 0, 1023, 255, 0);
  analogWrite(motor1Speed, motorspeed); 
  digitalWrite(motor1Speed, 1);  


Note: For further inquiry, please visit our technical forum as we seldom check the comment here. ?

2 thoughts on “Getting Started with Encoder Sensor Module (SN-ENC-MOD)”

  1. Hi, maaf kami tiada dokumen untuk fail tersebut. Boleh cuba tanya dengan Prof Google 🙂 Terima kasih.


    saya nak tanya ada x link utk saya download encoder sensor module utk fritzing

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

DIY Digital Alarm Clock Using REKA:BIT With Micro:bit
Display Internet Time (NTP) on micro:bit
DIY Interactive Robot Using REKA:BIT With Micro:bit
BLTouch Installation for Ender 3 with 32-bit V4.2.2 Board
Pick and Send Random Meal’s Option and Locations through Telegram Bot Using Grove WiFi 8266 on micro:bit
Tutorials of Cytron Technologies Scroll to Top