Manual Stepper Motor Control (No Arduino) - Page 1
Forum section: electronics / beginners

author: Sikorsky66
author_rank: Newbie
timestamp: January 29, 2020, 03:52:56 am
content: Im Building something called a "Barn Door Star Tracker" but that's not really important, its basically just a clock you slap your camera on.For this project I'm going to need a stepper motor but with very simple functionality,basically just a way to set a constant rpm and to do it as cheaply as possible,and then power the whole thing with a simple USB 5v 2.0A power bank.I was thinking of using a 28BYJ-48 stepper motor, they're cheap and 5vSome kind of cheap stepper driver, most of the cheap ones seem to be tailored towards Arduinos which is annoying in my case(this is the part that's giving me a hard time as i just don't know enough about how these work)And finally some kind of PWM signal generator,with a 5v +- input, a screen displaying the frequency, some buttons/knob to adjust the frequency and a pwm/grnd output.These seem to be fairly cheap and common.Could I please get some help finding the right stepper driver and some guidance on how to wire this all together.Thank you

author: brucehoult
author_rank: Super Contributor
timestamp: January 29, 2020, 08:24:42 am
content: The drivers aren't really anything to do with Arduinos -- they are generally simply a kind of current amplifier to get enough power to drive the stepper.This type of stepper is a "unipolar" one which means it has a "common" wire and four phase wires. You connect common to ground (for example) and then connect each of phases 1, 2, 3, 4 in order (or in reverse order) to 5 V.You could use anything you want to generate the pulses. For example a 4 bit bidirectional shift register (you'd have to somehow get one bit set one at power up). Or a two bit up/down counter, followed by a 2-to-4 decoder.But I can't see any good reason *not* to use a cheap microcontroller or microcontroller board -- they're available for $5 or even less.Note: bigger stepper motors are usually "bipolar" and need a more complicated bridge driver board which uses two pairs or wires A and B and generates first voltage one way and then voltage the other way on each pair. If you happen to get this type of driver I've found you can use it with a unipolar stepper motor by simply leaving the common wire unconnected.

author: Ian.M
author_rank: Super Contributor
timestamp: January 29, 2020, 11:42:20 am
content: Many stepper motor driver ICs do a lot more than provide a high current output stage per coil or coil end as Bruce just described. Its common to have pulse and direction inputs, where pulse causes it to step once on each activation, and direction is a logic level that chooses whether the step is forward or backwards. Also, for a star tracker, you only need a fixed speed in tracking mode, with that speed determined by the mount's gearing, so you can calculate the exact pulse rate required and generate it in pure dumb logic by dividing down the output of a crystal oscillator, to whatever accuracy you require.However, as has been pointed out, that would be actually the *HARD* way compared to using an Arduino clone*, and a stepper driver shield. That would also let you compensate for the tangent error of the mount electronically, for optimum tracking accuracy over the full mechanical movement range.If you need a menu interface, add an I2C LCD and button shield, but the application is simple enough that once the speed is worked out, all the user interface you need would be a stop/run switch and a status LED.Also most USB powerbanks shut down at low load currents, so you may well need to use a LiPO with a separate 5V output boost board.* Genuine Arduinos use a ceramic resonator for the ATmega clock. The accuracy and thermal stability is poor compared to a crystal, so in timekeeping applications that don't justify the use of external RTC, a clone that uses a 16MHz crystal rather than a resonator is preferable.

author: rstofer
author_rank: Super Contributor
timestamp: January 29, 2020, 10:31:52 pm
content: Considering that the Internet is FULL of Arduino Barn Door Tracker projects, you probably don't need to know much about how to code the project. Copy, paste and 'click' the Upload button and it's all done.A Google search will find a lot of these projects.

author: Refrigerator
author_rank: Super Contributor
timestamp: January 29, 2020, 11:14:14 pm
content: Stepper drivers are super simple. Direction pin is to set direction and Step pin is to take a step in said direction.There are also microstepping and other pins but you can leave those disconnected and the driver will work in default mode, stepper drivers work fine at 5V.28BYJ-48 will not work with regular stepper drivers because is has a common connection in the center tap of both coils, so you need to pop the blue cover and cut a trace inside the motor to make it work.Or you can also do it with transistorsSince 28BYJ-48 steppers have a common wire you could in theory control them with a two transistor miltivibrator.Three coil wires to one transistor and one wire to the other, this way it would rotate on it's own and not buzz, sort of like a shaded pole induction motor.For smoother operation you can do the controls with a transistor ring counter. To get 4 steps for a full revolution you would need 8 transistors and two more for a multivibrator, as i've found they're the most stability you can get with two transistors. But these discrete transistor drivers would be non reversible.

author: brucehoult
author_rank: Super Contributor
timestamp: January 30, 2020, 12:12:20 am
content: Quote from: Refrigerator on January 29, 2020, 11:14:14 pmThey work fine, simply not connecting the common wire.

author: Sikorsky66
author_rank: Newbie
timestamp: January 30, 2020, 04:32:22 pm
content: The picture below is the most common stepper driver you see come with 28byj-48 stepper motors.They seem to be targeted towards Arduino and have a simple "1 2 3 4" pin-out naming scheme with no description.Do you know what these pins actually do (pulse, Direction, Ground, enable) this seem to be clearly labeled on most other drivers meant for larger motors.And how i would get this to work with a simple PWM signal generator.Arduino is just way too overkill for my application, the thing just needs to work every time without a hitch, it will probably end up being potted in epoxy and put inside a 3d printed enclosure.There will also be no access to a computer if i need to fine tune it, which is why i need a simple way to adjust the speed.

author: mikerj
author_rank: Super Contributor
timestamp: January 30, 2020, 05:18:37 pm
content: Quote from: Sikorsky66 on January 30, 2020, 04:32:22 pmThis driver uses a ULN2003 which is a simple high(ish) current driver with 7 outputs controlled by 7 inputs. It's completely 'dumb', it doesn't perform any kind of sequencing or timing for the steps so it needs to be connected to a microcontroller (or a bunch of discrete logic) to actually get the motor to step.Don't be worried about using an Arduino, they are designed for beginners. They are cheap (at least the clones are) and you don't need any other hardware to program them, just a USB connection to your PC. There is library just for controlling this stepper with the ULN2003 driver, and plenty of projects that use the library that you can download, compile and program the board without any further work.

author: brucehoult
author_rank: Super Contributor
timestamp: January 30, 2020, 07:23:12 pm
content: Quote from: Ian.M on January 29, 2020, 11:42:20 amYes, but the drivers that come with *these* steppers are usually just simple buffers/amplifiers. You need something else for the sequencing and it can be low power. Such as the simple and cheap and rock-solid reliable uController chip the OP seems determined not to consider.

author: brucehoult
author_rank: Super Contributor
timestamp: January 30, 2020, 07:34:10 pm
content: Quote from: Sikorsky66 on January 30, 2020, 04:32:22 pmWhere the board says "Arduino" it just means some digital input with one line at +5V at a time. You can generate that any way you want. A microcontroller just happens to be the cheapest, most convenient, and most reliable way to do it (because you need only a single very cheap chip). And "Arduino" happens to be the most common microcontroller used by beginners.People who are not beginners understand they can substitute whatever else they want.QuoteAnd how do you propose to do that?The simplest way would be to connect some push-buttons or similar to a couple of inputs on a microcontroller.Except the speed of the Earth's rotation dos not change so once set correctly you won't need to change the speed except to do a fast slew to track something else, which you're probably doing mechanically anyway.

author: rstofer
author_rank: Super Contributor
timestamp: January 30, 2020, 08:19:29 pm
content: Some years back I helped a fellow build this kind of mount using a PIC microcontroller.In his case, he used a potentiometer to control the rate of stepping. This is pretty easy using an analog input of the Arduino but is not a preferred method, apparently.This project steps the barn door at 15 degrees per hour. That fixed number is precomputed and is part of the code. The only thing missing in the project, that I can see, is a fast step to get on target. I would probably add a '+' and '-' button to step in each direction at some high rate. In fact, I might also add a potentiometer to control the rate of high speed stepping. But that's a refinement for another day.https://petapixel.com/2018/05/15/how-i-built-a-star-tracker-for-dslrs/There are only 10 lines of code - total! Plus downloading and installing the CheapStepper library from GitHubhttps://github.com/tyhenry/CheapStepperNote that the author of the mount goes into considerable detail on alignment, giving 2 different methods of getting the hinge axis aligned with Polaris.

author: Sikorsky66
author_rank: Newbie
timestamp: January 30, 2020, 08:53:22 pm
content: I cant reprogram an Arduino in the Canadian wilderness in temperatures so cold the cameras have to have hand warmers taped to them to keep them from shutting down. This needs to be as simple and robust as possible.Could you please recommend a stepper driver that will work.

author: jmelson
author_rank: Super Contributor
timestamp: January 30, 2020, 08:58:25 pm
content: Quote from: Sikorsky66 on January 30, 2020, 08:53:22 pmThe A4988 available from all over the world as "Pololu compatible" do quite nicely. They run most any small 4-wire stepper and have microstepping and step and direction inputs.Jon

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: January 30, 2020, 09:02:27 pm
content: Quote from: Sikorsky66 on January 30, 2020, 08:53:22 pmThere isn't one meeting your requirements. You have chosen a set of components which make your task impossible.OTOH, your goal is very simple to achieve if you chose the right components, even if you don't want to use a microcontroller. There is no need to reprogram Arduinos in the wilderness, don't know where you get that idea.You could build some hardware using TTL logic to drive the stepper, you might even find a way to incorporate the PWM driver. Basically you need a 555 to generate a clock and some logic to drive the right order of signals.

author: brucehoult
author_rank: Super Contributor
timestamp: January 30, 2020, 09:17:08 pm
content: Quote from: Sikorsky66 on January 30, 2020, 08:53:22 pmWhy on Earth would you reprogram it?

author: brucehoult
author_rank: Super Contributor
timestamp: January 30, 2020, 09:23:48 pm
content: Quote from: donotdespisethesnake on January 30, 2020, 09:02:27 pmI don't think you'll get sufficient timing stability or accuracy from a 555 -- at least not using typical R/C circuits with one. You want a crystal. And then you need a huge and exact downclocking ratio from it. You could do that with probably a 16 bit binary counter chip, with a bunch of inverters and AND gates to detect the correct maximum count and generate a reset signal.Which is going to need a whole PCB of chips and cost at least ten times more than a low end AVR or PIC with a 10 line program.

author: Refrigerator
author_rank: Super Contributor
timestamp: January 30, 2020, 10:35:32 pm
content: You don't need an arduino to make the pulses, a simple bistable multivibrator will work just fine.As far as i know their frequency is pretty stable and as long as both transistors are at the same temp the frequency does not drift.If not that then there's a pretty neat PWM generator circuit using LM393 where you can set the frequency and pulse width quite easily.Not sure about the stability of that but it's based on an RC oscillator.If you don't want an arduino because it's an overkill (or whatever) then you can use a digispark, i've myself used one for generating pulses for a stepper driver and even connected an encoder to it for added functionality. Mainly used it for testing stepper motors.