Product Details
Items Discontinued
MPN :
SKU : EG2V120R-HB
Stock : Out of Stock
Price:PKR 1400.00
High torque 12V 120RPM Motor with Encoder and Gearbox unit JLN4B02
Length: 70 + 5 +15 width: shaft = 5 , Motor = 38
Weight: 235g
Arduino Example codes:
Note:
Base resistor: 10-ohm to 220-ohm.
Transistor: any kind of NPN.
int rpm_pin=4, state, state2, read_time=1000;
double counter, rpm, last=0, rps;
void setup() {
Serial.begin(9600);
pinMode(rpm_pin, INPUT_PULLUP);
}
void loop() {
if(digitalRead(rpm_pin)==LOW){ state=LOW; }
else{ state=HIGH; }
if(state2!=state){ counter++; state2=state; }
if(millis()-last>=read_time){
rps = counter/2;
rpm = rps*60;
counter=0;
Serial.println(rpm);
Serial.println(rps);
last=millis();
}
}