Star Tracker Using 28BYJ-48 Stepper Motor, Arduino and LCD Display to Vary Speed.

Introduction: Star Tracker Using 28BYJ-48 Stepper Motor, Arduino and LCD Display to Vary Speed.

Hi, the winter nights are on me and my mind has turned to getting good images of the Milky way and other faint objects. To do that better results are obtained when you track the rotation of the earth and the simplest of these methods is by using a "Barn Door Mount" .

This design allows you to vary the speed with the keypad for accurate timing, and if the battery voltages drop you don't get the slowing down of the drive gears that other designs may suffer from.

I wanted the design to be able to change the speed of the motor, and direction so that it will work in the northern hemisphere and the south if required. "Why would I want to be able to change the speed " I hear you ask, well if you can't get the exact thread screw specified in the design you simply change the speed to compensate :)

I looked at a few designs but I saw good features in a couple so decided to use parts of both of these. May I offer my thanks to the authors of these designs for their inspiration and information. I liked the fabrication of this design but not the electronics I liked the electronics of this design so my suggestions an amalgamation of the great work presented by the other builders.

The benefit of the ideas I have combined is that its cheep and parts are easily available, so a short list though its covered in two links above.

28BYJ-48 stepper motor and driver board ( Ebay and others )

Arduino Uno ( Ebay and others )

LCD shield with keypad HobbyTronics.

Screwed rod, hinges, misc. nuts and bolts, 1/2" plywood, Ball Mount, etc covered in the other links above.

Old brass Meccano gears one 15 tooth one 60 tooth for a 4-1 ratio ( Ebay)

Batteries and holders to power it

A box to enclose it all.

Step 1: The Wooden Parts and Gears.

I started by building the wooden parts and figuring out the drive, you can see I printed out the shape of the motor full size from a data sheet I found on line.

Once I bent the screw rod to size on a 7 inch radius and cut it to 7 inches long for a fairly long track time.

The gears I got from ebay were next, the big gear needs a hole drilled in it just big enough to clear the screw rod. Its very important that when the nut to go on the screw rod is fitted is exactly in the centre, the method I used was to cut a 1 inch long piece of screwed rod and put the nut on one end, I then wrapped PTFE tape on the rod that would pass through the big gear to centralise it, then supported on short bit of tube I soldered them together using a small blow torch and flux, all joining faces were cleaned with a wire brush and sandpaper prior to soldering to ensure a good joint. Once its cooled simply remove the 1" piece of rod and the nut should be dead centre.

The small gear required the hole opened up to 5mm to suit the motor shaft and a grub screw fitted .

The author of one of the designs I used for my ideas has very kindly forwarded some laser cutting plans that has agreed to share should you wish to use them, I have no way of testing these as don't have the kit. The author is Alex Kuzmuk, his files are in zip form here he used them in his design Alex Kuzmuk's design

Step 2: The Electronics

These stepper motors are very inexpensive I bought two :) .

You require an Arduino Uno and an LCD shield ( as they are known )

The project I followed was written some time ago and the designer used a different LCD shield, but as Arduino parts normally just work with each other I did not expect it to fail :( , the good news is that I am currently following an online course for Arduino programming and I had covered enough ground to enable me to modify the software to work with the LCD units being sold by HobbyTronics

A picture is worth a thousand words so I hope the wiring image is easier to follow than me trying to explain.

When finally connecting it all up you require to feed the Stepper motor interface board with 5 to 12 volts ( check the polarity its on the board ) as well as feeding the Arduino, I believe its better to feed the motor that way as using the 5volt pin on the Arduino board could not really supply enough amperage to be reliable.

Step 3: Program the Arduino

I have had to alter the Arduino Sketch from the original to work with the LCD used here, Open the Arduino IDE and select New. Use the code attached here.If you require to change the direction of the motor look in the sketch about line 38 you will see this line of code.

double speeds = -271.6;

//changing this value from a negative to positive changes the direction of the stepper motor. This is important depending on the hemisphere you are in.

use 271.6 for the stepper to run clockwise or -271.6 to run anti clockwise.

If you are using different screw threads to the original designs ( 32 Tpi ) like me you will have to alter the speed of the motor, there is an excellent tool online that you can mess with to determine the number of gear turns you will require to get the tracker accurate

I'm going to use

.62 RPM / ((2Π / 1436) * 20.00 TPI) = 7.08 inches from hinge to drive screw.

so 37.2 teeth per minuet is my starting point, math is not my strong suit .

After a live run and very good results I have the timing set to -170, now I just have to wait for good sky :)

EDIT: Thanks and recognition to those other web sites that have proven helpful

Step 4: Some Modifications After the Build

I found after completing the build that there are some things that could improve the basic design.

The main one I think would have been to add 2 inches to the left of the lower board, cut a shallow V grove or some other method of your choice to locate a green laser pointer parallel to the hinges, green pointers stand out best but only use it for initial location of the pole star as they really show up in the atmosphere and could easily be a hazard to pilots and add to light pollution.

The rubber bands hold the two halves together and make the assembly easier to move about without the camera flapping about, it also serves to hold the gears in mesh for more reliable drive.

I found my camera hitting the board when I pointed it really high, so adding the additional mount below the ball mount solved that.

Laser pointer Pivot Head



    • Creative Misuse Contest

      Creative Misuse Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Water Contest

      Water Contest

    18 Discussions

    Can you post details/close up pics on how to connect the arduino? I'm a total arduino newbie and I've been studying Kuzmuk's post before I stumbled on your comments...I have no idea what the pieces to connect the keypad shield is even called so I can't even google it :(

    2 replies

    Hi, I hope these images help, It sounds like your are concerned with the wiring of the stepper motor control board to the Arduino.

    The wires can be soldered or you have to solder pin headers, I just soldered the wires, I connected mine to the holes on the display board as holes are provided for connecting other components there.

    If you look closely at the first image you should see that I have added letters to my image indicating what the connectors are.
    If you need more information please ask.

    FYAFO0UIUHMSLR1.LARGE.jpgStepper motor 1.jpgStepper motor 2.jpg

    Hi, could I please also ask how you connected the battery source to the driver board?

    Many thanks!

    Could you link to the exact gears you got. Getting gears is often a major problem.

    2 replies

    Hi, I think if I put the ebay link after a while it would say this item no longer exists.
    The gears were old style brass Meccano gears, Meccano is a constructor toy maker, you should be able to sill find gears that give you a 4 to 1 ratio, mine were a 60 tooth and a 15 tooth they required drilling out to fit the shafts.
    I believe you can now get plastic Meccano gears if you prefer working in plastic. I just searched Ebay again and there are a few listings for these gears right now. I do hope that's helpful

    I could only find 57 tooth gear and 19 tooth gear in ebay = ratio 3. Will this still work by changing the speed of the motor?? Thanks, otherwise buy another set from


    I plan to build the barn door but I was wondering why not using a direct coupling between the motor and the rod and then using the Arduino to spin it with ~ 1RPM ? In this way I will not have to find and use the gears

    Is not powerful enough the motor for this ?

    Many thanks


    Sometimes people have a hard time with these small motors lifting a camera with large lens. I have turned my mount around, so that the motor is letting the mount "close" , with the hinge mounted on the right edge. That means the motor is slowing a falling weight instead of trying to lift it. It works better for me.

    I wonder how long of an exposure you can get? I don't see anything your using for balancing the camera.

    6 replies

    Hi Kevin, I usually take 20 second exposures to minimise noise, the camera has no balance issues and works fine.

    Nice work on your tracker build, looks great!

    I built the S&T article version back in 2008, the motor went bad. I rebuilt it based on the motor your using. But my Nikon D7000 with the 18-105mm lens kit is heavy. So I added a few pounds of weight to help with balance. I can now get at least 5 minute exposures, with good polar alignment. I also have a green laser pointer, it does not work when the temp drops below freezing.

    Here's a sample of my tracker at work...


    Neat image. To keep your lasers warm (any batteries, for that matter) I use small dry chemical handwarmers attatched with rubber bands. They are cheap and harmless. They keep the dew off my lenses (which later turns to ice in my northern climate).

    That's a great image your tracking is very accurate with no sign of trails so well done. I did get two green pointers and like yours after 5 mins out in the cold they stop working.

    I was going to post another simple instructable after I check its not already been described, its regarding getting the camera pointing at the object in the sky.

    Sounds like a great idea. Look forward to seeing it!

    I have figured out how to reverse the direction of the motor so included that in the "Software" Step

    Hi Swansong, your very welcome I hope someone else will find it helpful.