Thread Tools
Mar 21, 2019, 02:17 PM
Registered User
cgbillb's Avatar
Joe
Did you post this early ?
#include <CustomStepper.h>
CustomStepper director(6, 7, 8, 9, (byte[]){8, B1000, B1100, B0100, B0110, B0010, B0011, B0001, B1001}, 4096, 5, CW);

float directorturn=135; //from dead ahead to 135 degrees
int directordir=1;

void setup()
{
}

void loop()
{

if (director.isDone() && directordir==1)
{
director.setDirection(CW);
director.rotateDegrees(directorturn);
directordir=-1;
directorturn=270; //from 135 degrees back to 0 to 225
}

if (director.isDone() && directordir==-1)
{
director.setDirection(CCW);
director.rotateDegrees(directorturn);
directordir=1; //from 225 back to 0 to 135
}

director.run();

}



There are six jumper wires and one of the premade stepper drivers (and an UNO or Mega) required.

The six wires are connected as follows:

From driver GRD > Arduino GRD
From driver V+ > Arduino 5v
From driver pin In1 > Arduino pin D6
From driver pin In2 > Arduino pin D7
From driver pin In3 > Arduino pin D8
From driver pin In4 > Arduino pin D9
Sign up now
to remove ads between posts
Mar 21, 2019, 06:00 PM
Registered User
Thread OP
yes... did you try it?
Mar 21, 2019, 06:09 PM
Registered User
cgbillb's Avatar
Yes it will not work
When I hit Verify I get errors and of course it will not let me upload.
Mar 21, 2019, 06:30 PM
Registered User
Thread OP
I'm guessing you don't have the customstepper.h library, you have to download that, it's on this page, scroll down and click on download:

https://playground.arduino.cc/Main/CustomStepper/

It will put zip file on your computer, you click on that and click "extract all files", put them in your arduino/sketchbook/libraries or arduino/libraries folder.

On the ide screen after you verify it print all the error messages on the screen at the bottom in orange text, you have to scroll up to the top and see what the first few lines say, I'm guessing something about #include<customstepper.h>, if not it's something else
Mar 21, 2019, 09:24 PM
Registered User
cgbillb's Avatar
No you are right Joe I don't thank you, I will fix it in the morning
Bill
Mar 22, 2019, 06:28 PM
Registered User
Thread OP

Part 8: Other stepper motors and gun elevation


Although the 28BYJ-48 is great it's not big enough for some turrets. The really nice thing about it is that it is geared, has internal gear box, approx 64:1 so you don't need to gear it anymore.

What I didn't mention in the previous part on stepper motors is that the motor itself has a finite number of steps per revolution. That's referred to as the SPR, or referred to by the step angle. A common one is 48 SPR or 7.5 degrees. Directly connecting it's shaft to a turret would not be ideal because each step would turn it 7.5 degrees, a bit much. Importantly you can use half steps or even smaller fractions so it actually could be used.

But if you have a larger turret you are probably going to want to animate the gun elevation as well. That typically will require you to run wiring to into the turret. Unless you use wifi I think there's about two basic ways of getting wire in there. Preferred; the turret shaft is hollow, a tube, open on top inside the turret and open on the bottom inside the hull. You run the wires through the tube and the turret can rotate and all it does is twist the wires. Less preferred; a hole in the deck behind the turret axle, and a hole in the bottom of the turret at the rear and the wires exit the hull, then enter the turret, slack required. Most ship turrets don't turn full 360 degrees so either of these methods can work. Directors on the other hand, if you let them rotate several revolutions, the second method probably doesn't work.

Unfortunately the 28BYJ-48's gear box is directly behind the output shaft so you can not drill a hole all the way through and run wires so only the less preferred method is possible, or use a cam or something. Standard stepper motors (non-geared) generally have solid steel shafts so drilling an axial hole in that is a task, and it has to be large enough.

The other, most common way altogether is to externally gear the motor to the turret or director shaft, with a belt and pulleys, preferably toothed, or gears.
See attached pdf sketch. You can of course gear the 28BYJ the same way, it goes fast enough that gearing it more is okay, or you can use 1:1 gear ratio. So this external gearing does two things, achieves better smoother operating of ungeared stepper, and provides access to turret for wiring. External gears on the 28BYJ-48 would enable it to turn fairly large turrets, it actually has quite a bit of torque. Incidentally stepper torque is roughly inversely proportional to rotation speed another useful aspect, has highest torque when starting, lowest while going fast.
Mar 22, 2019, 07:06 PM
Registered User
cgbillb's Avatar
Joe
I am in Jacksonville sail my boats will text later
Thanks
Bill
Mar 23, 2019, 04:26 AM
G6SWJ
...
Last edited by G6SWJ; Apr 12, 2019 at 09:05 AM.
Mar 23, 2019, 06:00 AM
Registered User
cgbillb's Avatar
Joe I got it to verify thanks
Will try it when I get home
Now I guess the question is that every time I open a sketch I have to have that library
bILL
Mar 23, 2019, 08:42 AM
Registered User
Thread OP
Sorry C6SWJ, sometimes, often, I'm not very concise. I'm not sure exactly what you are getting at but yes the 28BYJ is not geared exactly 64:1 as you say, but it's close, off 0.5% (I mention this in previous posts). I also blab on about different steppers, not just that one, an example was one with 7.5 degree step, and they certainly can have the turret mounted to the shaft and rotate nicely, is what I was working toward was the external gearing advantage in that you have wiring access to the turret for gun elevation mechanism. The photo shows this on the 1:35 DD model I have.

Bill, once you have the library downloaded you can forget about it, you have it, nothing more to do.
Mar 23, 2019, 09:06 AM
G6SWJ
...
Last edited by G6SWJ; Apr 12, 2019 at 09:05 AM.
Mar 23, 2019, 09:43 AM
Registered User
Thread OP
No, You sound like you know it, I'm a hack really, I get confused, I believe my use of the customstepper.h library utilizes half steps so there is near 4098 or 4075.8 half steps per the output shaft one revolution. The details start to fade a bit after you have the thing running and you can control it, the spr becomes a forgotten detail. Please don't get your coat, could use any corrections and guidance available. Do you use these steppers for something? You might add how once you get familiar with them they are pretty easy to use right? Cap
Mar 23, 2019, 05:44 PM
Registered User
Thread OP

Update on sample sketch post #37


See update on post #37, it has a diagram showing exactly how to wire the stepper to the arduino uno.

This is all quite tricky to try to describe in a rational way, there are so many variables. Like I explained in an earlier posts I would not use the premade stepper driver if you can avoid it (of course that is what I did on the 1/200 Bismarck ), but really good for getting started, definitely get a half dozen of them, use them to get started. If you have one turret or a radar or something yes, then you are done, there's absolutely nothing wrong with using them they just take up more space than needed and you don't need the LED's etc. I'll post another sketch showing the ULN2803 on a breadboard, that's the way to go if you have 3 or more different stepper functions to control.
Last edited by capricorn; Mar 23, 2019 at 06:28 PM.
Mar 24, 2019, 04:51 AM
Registered User
Quote:
But if you have a larger turret you are probably going to want to animate the gun elevation as well. That typically will require you to run wiring to into the turret. Unless you use wifi I think there's about two basic ways of getting wire in there. Preferred; the turret shaft is hollow, a tube, open on top inside the turret and open on the bottom inside the hull. You run the wires through the tube and the turret can rotate and all it does is twist the wires. Less preferred; a hole in the deck behind the turret axle, and a hole in the bottom of the turret at the rear and the wires exit the hull, then enter the turret, slack required. Most ship turrets don't turn full 360 degrees so either of these methods can work. Directors on the other hand, if you let them rotate several revolutions, the second method probably doesn't work.
In my days of messing with "clockwork" telephone exchanges, the switch wipers were connected using a set of flexible wires. Over the years, I changed a lot of wipers, but very few cords, so the flexible wire could be considered reliable.
strowger exchange group selectors (0 min 21 sec)
shows some of them working - "mine" were mostly like the one on the left, but the video does show the action involved. Probably a lot more violent than what you might expect under a turret. While cordage like that is probably unobtainable, HiFi tone arm pick-up wire will do nicely.
As mentioned, this will work with a restricted range of turn, something else is needed for a continuous rotation like a director, but then, the director is really just a decoration, isn't it?
Mar 24, 2019, 04:57 AM
G6SWJ
...
Last edited by G6SWJ; Apr 12, 2019 at 09:05 AM.


Quick Reply
Message:

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Turret rotation admiralbb62 Scale Boats 22 Feb 22, 2019 10:10 PM
New Product ULN2003 Stepper Motor Control Board + 5V Stepper Motor ICStation Power Systems 0 May 29, 2014 04:54 AM
Discussion Servo driven turret SwePilot Scale Helicopters 13 Dec 16, 2009 07:55 AM
Discussion Turret Rotation RussCA Dock Talk 2 Jul 24, 2009 10:33 AM
Discussion Heng Long Tiger turret rotation hanging. Rampage RC Tanks 3 Sep 28, 2008 05:35 PM