(SKU:RB-02S043) Wheel Encoder Set

From ALSRobot-Wki
Jump to: navigation, search
Gdcsmp.jpg

Contents

Product overview

Arduino light code disc is Harbin the loose robot technology co., LTD. In 2012, the latest photoelectric testing sensor, the product is a short response speed, speed switch output module, cooperate white encoder can measure the motor speed, the test code can be directly fixed on the double dc gear motor output shaft convenient installation, simple and easy to use.

specification

  1. Working voltage:5v DC
  2. Working current:<20mA
  3. Working temperature:10℃-30℃
  4. Compatible with sensors extension board I/O
  5. Sensor types: analog output
  6. Plane dimension:15×35×16mm
  7. weight:24g

Method of use

Pin definition

  • S:(Signal)
  • +:(VCC)
  • -:(GND)

Connection here

S ports from the I/O port of the controller. + and - received power of + 5 v &gnd respectively.

Application of routine

According to the program connect photoelectric tachometer encoder and UNO, puts the motor steering wheel code disc, observe the serial data output.

sample code

#include "MsTimer2.h"
#define ENCODER_READ 5
unsigned int encoderPos,a;
void setup()
{  
    Serial.begin(9600);
    MsTimer2::set(1000, flash); // 500ms period
    MsTimer2::start();
    counterStart();
}

void loop()
{
}
void counterStart()
{
  TCCR1A=0;                       
  TCCR1B=0;                
  TCNT1=0;                     
  TCCR1B = TCCR1B | 7; 
}
unsigned int getCount()
{
  unsigned int count;
  count = TCNT1;  
  TCNT1=0;  
  TCCR1B = TCCR1B & ~7;                      
  TCCR1B = TCCR1B | 7;                  
  return count;                             
}
void flash() {
encoderPos = getCount();
a=encoderPos*6;
Serial.print("rotate speed = ");
Serial.print(a);
Serial.println(" RPM");
}

Application effect

In a serial port to print out "rotate speed =" and "RPM" related data

Products related to recommend

Buy address:[1]

Personal tools
Namespaces

Variants
Actions
Navigation
Tools