Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Motors & Motion
  4. ›N20 Micro Metal Gear Motor

Component guide · Beginner · 3 min read

N20 Micro Metal Gear Motor

RPM, Wiring, Encoder and Code

By Geekobot Learning Team · Updated 29 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWhat the N20 gear motor isN20 gear motor pinoutWiring the N20 gear motorExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Short answer

The N20 is a 12 mm micro metal gear motor with a 3 mm D-shaft, used in mini robots, line followers, locks and small mechanisms. It comes in 3, 6 and 12 V versions with gear ratios giving about 30 to 1000 RPM. The encoder version adds a magnetic Hall encoder (two channels) on the back so you can measure speed and distance.

Key specs at a glance

Size
12 x 10 mm gearbox, 3 mm D-shaft, about 25 to 35 mm long
Voltage
3, 6 or 12 V versions
Speed
About 30 to 1000 RPM depending on gear ratio
Current
About 0.05 A free running, 0.5 to 1.6 A stall (6 V)
Encoder (GB-MOTR-0151)
Magnetic Hall, 2 channels, 7 pulses per motor turn per channel (times the gear ratio at the shaft)
Gears
All-metal spur gears

Models in this guide

These are alternatives. Pick the one that fits your project; you only need one.

  • Option 1N20 Micro Metal Gear Motor₹229
  • Option 2Waveshare N20 DC Gear Motor with Magnetic Hall Encoder₹460
01

What the N20 gear motor is

Lower RPM means more torque from the same motor. For a small robot car with 34 mm wheels, 200 to 300 RPM at 6 V is a good start; for a line follower, 500 to 1000 RPM.

The encoder board has six wires: two motor wires, encoder power and ground, and the A and B channels. Counting A and B gives speed and direction for PID speed control.

02

N20 gear motor pinout

The pins on the N20 gear motor and what each one does.

PinFunction
M1 / M2Motor terminals (swap to reverse)
VCCEncoder power, 3.3 to 5 V
GNDEncoder ground
A (C1)Encoder channel A
B (C2)Encoder channel B
PinFunction
M1 / M2
Motor terminals (swap to reverse)
VCC
Encoder power, 3.3 to 5 V
GND
Encoder ground
A (C1)
Encoder channel A
B (C2)
Encoder channel B
03

Wiring the N20 gear motor

Drive the motor through a driver such as a TB6612FNG or DRV8833, never straight from a GPIO pin. On ESP32 GPIO 34 and 35 are input-only, which suits encoder signals.

N20 gear motor pinArduino UnoESP32
M1 / M2TB6612 AO1 / AO2TB6612 AO1 / AO2
Encoder VCC / GND5V / GND3V3 / GND
Encoder AD2 (interrupt)GPIO 34
Encoder BD4GPIO 35
M1 / M2
Arduino Uno:
TB6612 AO1 / AO2
ESP32:
TB6612 AO1 / AO2
Encoder VCC / GND
Arduino Uno:
5V / GND
ESP32:
3V3 / GND
Encoder A
Arduino Uno:
D2 (interrupt)
ESP32:
GPIO 34
Encoder B
Arduino Uno:
D4
ESP32:
GPIO 35
04

Example code

This counts rising edges on channel A only; count both edges of A and B for four times the resolution. Change PPR to match your gear ratio.

Count encoder pulses and print RPM (Arduino) · Arduino C++Verify & upload in Electrolark
const int ENC_A = 2, ENC_B = 4;
const float PPR = 7 * 100.0;      // 7 pulses x gear ratio 100:1 (change to yours)
volatile long count = 0;

void onA() { count += digitalRead(ENC_B) ? -1 : 1; }

void setup() {
  Serial.begin(115200);
  pinMode(ENC_A, INPUT_PULLUP);
  pinMode(ENC_B, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(ENC_A), onA, RISING);
}

void loop() {
  noInterrupts(); long c = count; count = 0; interrupts();
  float rpm = c / PPR * 600.0;    // counts per 100 ms -> RPM
  Serial.println(rpm);
  delay(100);
}
05

Setup and tuning

Choosing voltage

a 6 V N20 runs well from 2 AA cells less driver loss, or 1S Li-ion through a TB6612.

Mounting

use N20 brackets with M1.6 screws; do not clamp the gearbox hard.

Wheels

wheels need a 3 mm D-hole; press them on, do not hammer.

Stalling

stalling a high-ratio N20 can strip the last gear; add a limit or current sense.

06

What you need

Shop this list5 of 7 found in our store · ₹1,257

  • N20 Micro Metal Gear Motor: the part this guide coversN20 Micro Metal Gear Motor₹229
  • Waveshare N20 DC Gear Motor with Magnetic Hall Encoder: another version this guide coversWaveshare N20 DC Gear Motor with Magnetic Hall Encoder₹460
  • Uno R3 development board: the controller used in the wiring tableFind this part
  • ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
  • TB6612FNG motor driver module: an efficient driver for two small motorsTB6612FNG Dual Motor Driver Module₹130Closest match, check the specs
  • Wheel for BO and N20 motors: 3 mm D-shaft wheelsFind this part
  • Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
07

Alternatives and when to choose them

  • ✓TT and BO gear motors: bigger, cheaper plastic-gear motors.
  • ✓Motor encoders: how encoders measure speed and position.
  • ✓DC motors: choosing motor size and speed.
08

Common mistakes to avoid

  • !Driving the motor straight from a GPIO pin.
  • !Picking a 12 V N20 for a 3.7 V robot.
  • !Leaving encoder pins floating without pull-ups.
  • !Stalling a 1000:1 gearbox until the gears strip.
09

Frequently asked questions

What RPM should I choose?

200 to 300 RPM for small robot cars, 500 to 1000 RPM for line followers, under 100 RPM for mechanisms.

How many pulses per turn does the encoder give?

7 per motor turn per channel; multiply by the gear ratio for the output shaft.

Can I run a 6 V N20 at 3.7 V?

Yes, slower and with less torque.

Which driver should I use?

A TB6612FNG or DRV8833 for two N20s; an L298N wastes too much voltage.

Does the shaft fit LEGO?

Not directly; use a 3 mm D-shaft adapter.

Parts for this guide

  • N20 Micro Metal Gear Motor
    ₹229View
  • Waveshare N20 DC Gear Motor with Magnetic Hall Encoder
    ₹460View
  • Uno R3 Development Board (No Cable)
    ₹359View
  • ESP32-WROOM-32 38-Pin Development Board
    ₹389View
  • TB6612FNG Dual Motor Driver Module
    ₹130View
  • Wheel for BO and N20 Motors (by Size)
    ₹38View
  • Dupont Jumper Wires (40 pcs)
    ₹49View
Shop DC & Geared Motors

Projects that use it

Put this into practice: 1 step-by-step build in our project library uses parts from this guide.

Beginner · 6 sessions of 90 minutesSix-week STEM club plan with ready kits, from science to IoTView project
Browse all 1 project

Keep learning

Component guideBeginnerDC Motors ExplainedA brushed DC motor spins when current flows through it: voltage sets the speed and the load sets the current it draws.4 min read · Motors & MotionConcept explainerIntermediateMotor Encoders and Speed FeedbackA motor encoder reports how far and how fast a shaft has turned.3 min read · Motors & MotionComponent guideBeginnerTB6612FNG motor driverThe TB6612FNG drives two DC motors at up to 1.2 A each (3.2 A peak) with MOSFETs, so it wastes far less voltage than an L298N.4 min read · Motors & MotionComponent guideBeginnerDRV8833 motor driverThe DRV8833 is a tiny dual H-bridge for small DC motors that runs from 2.7 to 10.8 V, so a single Li-ion cell or 2xAA pack can power it.3 min read · Motors & Motion

Sources

  • N20 micro gear motor specifications
  • Magnetic Hall encoder for N20 motors datasheet

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhat the N20 gear motor isN20 gear motor pinoutWiring the N20 gear motorExample codeSetup and tuningWhat you needAlternatives and when to choose themCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide (Arduino Uno)3 items · ₹893

N20 Micro Metal Gear Motor · Waveshare N20 DC Gear Motor with Magnetic Hall Encoder · Uno R3 CH340G ATmega328p Compatible Development Board

Run itChange the inputs and watch the output

7 pulses per motor turn x 100:1 gearbox = 700 per output turn, counted every 0.1 s.

Motor fwd 50%
Serial monitor115200 baud
150.00

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question