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. ›Projects
  3. ›Belt linear axis

3D printing & laser projects

Build a belt-driven linear axis on 2020 extrusion with a CNC shield

A NEMA 17, a GT2 belt and an endstop make a homing axis: the same parts that move every 3D printer and plotter.

By Geekobot Learning Team

Intermediate
Difficulty
1 day
Build time
₹3,287
Parts cost
17
Parts
Arduino
Platform
Add all parts · ₹3,287Start building
  • Making & fabrication
  • Learning & classroom
  • Workshop & industry
UNO
Tap a part to see what it does
OverviewPartsWiringBuildCodeTroubleshootFAQIdeas

What you'll build

Every FDM printer is three of these axes. You will bolt a NEMA 17 motor, a GT2 pulley and idler and a carriage on smooth rods to a length of 2020 aluminium extrusion, drive it from an Arduino Uno with a CNC shield and stepper driver, home it against a micro switch and move it in millimetres. A drag chain keeps the motor cable tidy.

What you'll learn

  • Steps per millimetre for a GT2 belt and 20-tooth pulley
  • Setting stepper driver current (Vref)
  • Homing against an endstop
  • Belt tension and why it matters for print quality
Safety

Set the driver current before connecting the motor, and never unplug a motor while the shield is powered.

  1. SenseMicro switch endstop
  2. ThinkArduino Uno counts steps
  3. ActStepper driver and NEMA 17 move the belt

Parts list

Tick anything you already have and the total updates.

PartQtyPrice
  • UNO
    Uno R3 CH340G ATmega328p Compatible Development Board
    GB-SBCD-0329Guide

    Runs the sketch and sends step pulses

    × 1₹204₹204
  • CNC Shield V3 for Arduino UNO – A4988 DRV8825 Compatible
    GB-SBCD-0235Guide

    Holds up to four drivers and has endstop headers

    × 1₹89₹89
  • Makerbase MKS A4988 Stepper Motor Driver
    GB-3DDF-1829

    Stepper driver; set its current before connecting the motor

    × 1₹219₹219
  • NEMA 17 2.6 kg-cm Stepper Motor 42HS34-0404 D-Type
    GB-3DDF-1864

    Moves the belt

    × 1₹605₹605
  • GT2 20-Tooth Timing Pulley, 5mm Bore for 6mm Belt
    GB-3DDF-1411

    Drive pulley on the motor shaft

    × 1₹26₹26
  • Generic 2GT 20-Tooth 6mm Belt Idler Pulley – 5mm Bore
    GB-3DDF-1384

    Idler at the far end of the belt

    × 1₹89₹89
  • GT2 6mm Open Timing Belt for 3D Printers – 1 Meter
    GB-3DDF-1409

    Open GT2 belt, 6 mm wide, 1 m

    × 1₹88₹88
  • GT2 6mm Timing Belt Tensioner Torsion Spring – 5 Pcs
    GB-3DDF-1426

    Keeps the belt tight

    × 1₹21₹21
  • EasyMech 20×20 4T Slot Aluminum Extrusion Profile 100mm
    GB-3DDF-1951

    Frame rail; buy the length you want

    × 1₹57₹57
  • EasyMech Cross/Plus 2020 Aluminum Profile Bracket
    GB-3DDF-1937

    Joins extrusions

    × 1₹76₹76
  • 8mm x 400mm Chrome Plated Smooth Rod
    GB-3DDF-1459

    Smooth rods the carriage slides on

    × 2₹338₹338
  • XKB DM1-135P SPDT Micro Switch, 30V 1A Plugin Limit
    GB-3DDF-1471

    Endstop for homing

    × 1₹5₹5
  • NEMA17 Stepper Motor Pure Copper Cable, 70cm Bare Wire
    GB-3DDF-1871

    Motor cable

    × 1₹83₹83
  • Two Trees 7x7mm 1m Cable Drag Chain Wire Carrier
    GB-3DDF-1803

    Guides moving cables

    × 1₹249₹249
  • Aluminum Heat Sink for DRV8825 A4988 Stepper Drivers
    GB-3DDF-1320

    Stick-on heat sink: drivers get hot near full current

    × 1₹60₹60
  • Makerbase MKS TMC2209 v2.0 Stepper Motor Driver
    GB-3DDF-1826Guide

    Quieter driver: plugs into the same socket in step/dir mode (check the pin orientation)

    × 1₹479₹479
  • RepRapDiscount 2004 LCD Smart Controller with Adapter
    GB-3DDF-1801

    If you later move to a RAMPS board and Marlin, this is its display

    × 1₹599₹599

Complete kit

17 of 17 parts in one tap

₹3,287

GST included

3% off these parts while the whole kit stays in your cart

Parts you still need

₹3,287

17 of 17 parts. Tick anything you already have.

About ₹98,610 before bulk pricing for 30 kits.

Request bulk quote

Tools you'll need

  • 24 in 1 Precision Screwdriver Set

Learn the parts

  • Atal Tinkering Lab (ATL)
  • Arduino CNC, Motor and Servo Shields
  • TMC2209 and TMC2208 Stepper Driver

Wiring

Follow the colours: red is power, dark grey is ground, blue is a signal.

Needs a 12 V DC supply of at least 2 A on the shield's screw terminal (bought separately). The Uno itself runs from USB.

PartPinConnect toNote
A4988 driverDriver socketCNC shield X socketEN pin to the corner marked EN; wrong orientation destroys the driver
NEMA 174 wires (2 coils)X motor header 1A 1B 2A 2BFind the coil pairs with a multimeter
Endstop switchCOM / NOX- endstop header (D9) / GNDSwitch closes to GND when the carriage arrives
CNC shieldPower terminal12 V supply, + and -12 V 2 A or more; never connect or remove motors while powered
  • A4988 driverDriver socket → CNC shield X socketEN pin to the corner marked EN; wrong orientation destroys the driver
  • NEMA 174 wires (2 coils) → X motor header 1A 1B 2A 2BFind the coil pairs with a multimeter
  • Endstop switchCOM / NO → X- endstop header (D9) / GNDSwitch closes to GND when the carriage arrives
  • CNC shieldPower terminal → 12 V supply, + and -12 V 2 A or more; never connect or remove motors while powered
Built it? Check your wiring before you power up.Pick the pin each wire went to and we'll point out swapped pins, power mistakes and pins that clash.

Step-by-step build

0 of 6 done

Code

linear_axis.inoVerify & upload in Electrolark
// CNC shield V3 pins: X step D2, X dir D5, enable D8 (LOW = on), X- endstop D9
const int STEP = 2, DIR = 5, EN = 8, ENDSTOP = 9;
// GT2 belt (2 mm pitch) x 20 teeth = 40 mm per turn; 200 steps x 16 microsteps per turn
const float STEPS_PER_MM = 200.0 * 16 / 40.0;   // = 80
const float MAX_MM = 300;                        // usable travel, set for your build
long pos = 0;                                    // current position in steps

void pulse(int us) { digitalWrite(STEP, HIGH); delayMicroseconds(5); digitalWrite(STEP, LOW); delayMicroseconds(us); }

void home() {
  digitalWrite(DIR, LOW);                       // towards the endstop; swap if it runs away
  while (digitalRead(ENDSTOP) == HIGH) pulse(400);
  digitalWrite(DIR, HIGH);
  for (int i = 0; i < 5 * STEPS_PER_MM; i++) pulse(800);   // back off 5 mm
  pos = 0;
  Serial.println("Homed");
}

void moveTo(float mm) {
  mm = constrain(mm, 0, MAX_MM);
  long target = mm * STEPS_PER_MM;
  digitalWrite(DIR, target > pos ? HIGH : LOW);
  while (pos != target) { pulse(250); pos += target > pos ? 1 : -1; }
  Serial.print("At "); Serial.print(mm); Serial.println(" mm");
}

void setup() {
  pinMode(STEP, OUTPUT); pinMode(DIR, OUTPUT); pinMode(EN, OUTPUT);
  pinMode(ENDSTOP, INPUT_PULLUP);
  digitalWrite(EN, LOW);
  Serial.begin(115200);
  home();
  Serial.println("Type a position in mm");
}

void loop() {
  if (Serial.available()) {
    float mm = Serial.parseFloat();
    if (mm >= 0) moveTo(mm);
  }
}

Run it: what this code does

The sketch above runs here on a simulated Arduino Uno. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.

Troubleshooting

Motor buzzes but does not turn+

The coil pairs are mixed up. Find each pair with the multimeter (low resistance between the two wires of one coil) and swap the middle two wires.

Axis runs away from the endstop+

Swap the DIR level in home() or turn the motor plug round.

Steps are lost at speed+

Raise the delay in pulse(), check the belt tension and the driver current, and make sure the carriage slides freely by hand.

All three microstep jumpers fitted but distance is wrong+

The sketch assumes 1/16 microstepping. With no jumpers the A4988 does full steps: use 200 / 40 = 5 steps per mm.

FAQ

Can I add more axes?+

Yes, the shield has Y and Z sockets (step D3/D4, dir D6/D7) and the same enable pin.

Can I run GRBL instead?+

Yes. Flash GRBL to the Uno and send G-code from a sender program; the pin map matches the CNC shield.

Why 80 steps per mm?+

One turn is 200 full steps x 16 microsteps = 3200 steps and moves 20 teeth x 2 mm = 40 mm of belt.

What parts do I need to build the build a belt-driven linear axis on 2020 extrusion with a CNC shield?+

17 parts: Uno R3 CH340G ATmega328p Compatible Development Board, CNC Shield V3 for Arduino UNO – A4988 DRV8825 Compatible, Makerbase MKS A4988 Stepper Motor Driver, NEMA 17 2.6 kg-cm Stepper Motor 42HS34-0404 D-Type, GT2 20-Tooth Timing Pulley, 5mm Bore for 6mm Belt, Generic 2GT 20-Tooth 6mm Belt Idler Pulley – 5mm Bore, GT2 6mm Open Timing Belt for 3D Printers – 1 Meter, GT2 6mm Timing Belt Tensioner Torsion Spring – 5 Pcs, EasyMech 20×20 4T Slot Aluminum Extrusion Profile 100mm, EasyMech Cross/Plus 2020 Aluminum Profile Bracket, plus 7 more. Tools: 24 in 1 Precision Screwdriver Set. On this page you can tick the parts you already have and add only the rest to your cart.

How hard is it and how long does it take?+

It is a intermediate project and takes about 1 day. The build on this page has 6 steps.

Do I need to write the code myself?+

No. This page has the complete, tested code (linear_axis.ino).

Can I see what the code does before I build it?+

Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.

How much does the build a belt-driven linear axis on 2020 extrusion with a CNC shield cost to build?+

About ₹3,287 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.

What will I learn from this project?+

Steps per millimetre for a GT2 belt and 20-tooth pulley; Setting stepper driver current (Vref); Homing against an endstop; Belt tension and why it matters for print quality.

Is it safe to build?+

Set the driver current before connecting the motor, and never unplug a motor while the shield is powered.

What can I build next with these parts?+

Ideas that reuse this build: Add auto bed levelling and a PEI sheet to a printer. They are listed under Take it further on this page.

Take it further

  • Add auto bed levelling and a PEI sheet to a printer

Related projects

  • 3D printing & laser
    Intermediate· 2 hours

    Rebuild a V6 hotend and change the nozzle the right way

    Fix clogs and leaks for good: strip, clean and rebuild a V6-style hotend, then hot-tighten a fresh nozzle.

    ₹1,081 · 9 partsNo code
  • 3D printing & laser
    Intermediate· 3 hours

    Add CR Touch auto bed levelling and a PEI sheet to an Ender-style printer

    Stop re-levelling by hand: fit a CR Touch probe and a textured PEI spring-steel sheet for first layers that just stick.

    ₹6,676 · 5 partsNo code
  • KIT
    3D printing & laser
    Beginner· half a day

    Set up a new FDM printer and make your first useful prints in PLA

    Unbox, level, slice and print: a phone stand, a cable clip and a calibration cube, with the checks that save most beginners a week.

    ₹17,872 · 5 partsNo code
  • 3D printing & laser
    Intermediate· 1 day

    Print a weatherproof sensor enclosure in PETG or ASA with a TPU gasket

    Choose the right engineering filament for outdoor parts: a UV-stable box, a soft seal and a stiff carbon-fibre bracket.

    ₹8,791 · 6 partsNo code

Learning project. Check every circuit and the datasheet of each part before you power it up.

Run itChange the inputs and watch the output
D2 OFF
D5 OFF
D8 OFF
Serial monitor115200 baud
 

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 Share your build