New gun director - RC Groups
Thread Tools
Aug 29, 2017, 08:05 PM
Registered User

New gun director

compassdirector (1 min 3 sec)

This gun director (sorry, I lost my lindberg director, had to use a turret) is run from a compass. As you can see in the video the director tracks on a compass reading. This solves a lot of the "what to do" issues with the directors and turrets. It can run from a single radio channel. You drive the ship out a ways, turn 90 degrees and activate the director it will rotate to 90 deg from dead ahead. Then you turn the ship the director continues to hold the compass direction. As the ship turns the director, and turrets continue to point at the original compass direction.

With my previous director sketches it works fairly simple, the turrets react only to the director angle, so when the target (deflection) is not within the turrets range it returns to the zero position. So the turrets are not in the video, will be added later. The one turret in the video is the director.

The motor for the director (and turrets) is the 28BYJ-48 5v stepper motor, running on a uln2003 array. The readout from the compass is a bit variable, but that can be smoothed within the sketch. The compass breakout is the LSM303 and is tilt compensated.

I've been tinkering with the director-turret-ship animation for a while and I do think that the compass controlled director is best. My larger DD model has direct input for the director deflection angle, but what good is that when you have to manually input the angle constantly? This would, I think, work on a 1/200 scale BB model (styrene kit), we'll see.... Any volunteers? Cap
Last edited by capricorn; Aug 30, 2017 at 06:08 AM.
Sign up now
to remove ads between posts
Aug 30, 2017, 11:00 AM
Big Boats Rule!
boater_dave's Avatar
Cap, you beat me to it. I have been watching videos and reading threads on all the neat Arduino parts and came across the compass piece and thought to myself that would make a great addition to the turret drive. I wanted to go one step further, though, and since you are prototyping already maybe you can try it first. Would it be possible to drive the director with a rotating knob (potentiometer input), then push a button to 'lock' the director onto whatever compass heading it's currently pointed at? This would allow the director to sweep around until a target is found, then stay on that heading while the ship rotates around underneath. In my eye, that would be visually stunning on the water. Logically, I haven't worked through what the programming code would look like. I figure the ship would have a heading value at all times, and the director would have a relative bearing. Some simple math to find the difference, then grab that value.
Great job, by the way.

Aug 30, 2017, 06:45 PM
Registered User
Dave, That is somewhat similar to what I had in mind except that you would turn the boat rather than a pot. It would be fairly simple to incorporate the aiming feature, if your radio has the spare channels. You'd mount the pot on the radio I presume? You'd need a multi turn pot or could use a rotary encoder. My larger DD project is a bit odd in that I'm using an xbee and laptop to control it so I can make most any command I choose, a standard RC radio is a bit more restricted.

I did a bit more on the sketch, it now recognizes the change over from 0 to 360 on the heading so doesn't make a full turn when it crosses north (as it did in the end if the video). Also dulled the jitters by reducing motor speed when the turn degrees are small. The way I have it set up it gets a turn degrees command, so when that is large the rpm is large, when the command is small the rpm is small, it helps keep it from oscillating as much. (the compass is not precise, it returns a variable heading when pointed in a constant direction). (those controls are available in the customstepper.h library which is a bit more extensive than the standard stepper.h library) The tilt compensation works just fine, if you tip it, it does not change the heading much at all.

I used the poulolo library for the compass, it took me weeks to get it working a year or two ago, this time I opened the heading example and ran it and it worked perfectly, a welcome change. I'd recommend the LSM303 to start with at least, it works, and is tilt compensated, which is good for a boat.

Your build is a 1/48 fletcher, is that right? That will be much fun. I believe that the 28BYJ-48 would work just fine for that size turret, it's a geared motor so the motion will be fine, it's relatively small light, no more than a standard servo. The drawback is that each one has 5 wires and you need the driver chip and 4 digital outputs per function (you can drive 2 motors from the same driver for this size), but it's basically flawless operation which is a plus. And the motor is very cheap, you can get motor with driver for 4.95 ea at, motor only for 3$. Much cheaper than a good servo! Note that you can buy the uln2003 chip and wire it yourself and you can run 2 functions off it rather than 1. For the fletcher you'd need 4 functions, director, turret12, turret3, turret45, so two chips.

Like I said I'm considering a 1/200 scale Trumpter BB for a testbed. They are about 4 ft long. I know the motors etc affect the compass, but I think it can be far enough away to work reasonably, maybe 4" or more from a motor?

Onward! Cap
Aug 30, 2017, 09:40 PM
Registered User
Just another quick note. The director in the video is turning opposite direction than it should, it should sit on the rotating platform with the compass and turn opposite, easy enough to fix . ( "-" bang, done). Also the uln2003 or stepper driver is a not mysterious thing so should not be a block to anyone attempting to use steppers. It's simply a bunch of switches, the digital output from the processor simply turns on a switch for the motor coil via the driver to the power source. Two reasons (at least), the processor doesn't have capacity for much current, and because the motor coil is a coil of wire it returns reverse voltage spike when turned on and off, again not good for processor operation. So the driver chip isn't at all complicated just a necessary intermediate step/buffer. Some motors probably have driver chip embedded which would be great. Tons of images and explanations on inet show exactly how to wire up the driver, once done it works flawlessly (but remember to document the wire color/order in code, saves redoing process). Cap
Aug 31, 2017, 12:07 PM
Big Boats Rule!
boater_dave's Avatar
Cap, your work is impressive. Instead of a DD, how about a 1:200 IJN Yamato? I've got one that I don't use anymore. Running gear installed, but the upper works are a bit rough. It was a club hand me down that I acquired many years ago. I think If I ever go back into big battleships, it will be with a 1:200 scale HMS Hood.

Aug 31, 2017, 04:37 PM
Registered User
Dave, that is what I was suggesting, a 1/200 BB for me to install the turret motors on. That Yamato looks huge, how long is it? Not sure how much you are selling it for, I'm a bit fussy so would probably prefer to start fresh, but on the other hand there's probably a million pieces that would take me a while, plus the painting. Shipping it sounds like a chore too. Let me know what you want for it, I'll think it over. It's the last thing I need is another oversized project... My 1/35 scale DD takes up much space and I don't know what I'll ever do with it, hopefully get it in the water some day, maybe it will sink and I can move on. The 1/200 Arizona is much smaller but likely plenty big enough, I like the older dreadnaught like ships too. Just not sure how good they are for RC conversion, will have to do some research. Cap
Sep 02, 2017, 07:29 AM
Registered User
Correcting error above, I noted you can run two (unipolar) steppers from the ULN2003, that was an error, it has only 7 switches, why 7 I have no idea. The ULN2803, has 8 switches so can run two motors. So if you are doing multipler steppers I'd recommend ULN2803, it has 18 pins vs 16, and just as cheap and available. Cap
Sep 05, 2017, 04:16 PM
Registered User
So I showed this video to my dad, whom I built a fairly complicated custom RC transmitter for his Fletcher class 4 years ago. He's getting ready to build a new ship, a Flower class WW2 corvette, and has asked me to build a new custom transmitter. My dad said to me, "You know what would be cool? If we could give an order to steer to a heading and be able to maintain the ship on that heading". I said, "We'll I'm pretty sure I can figure out a way to do that, probably by using the same module that Cap is using here." So I spent all of my free time over Thursday and Friday figuring out how I would do this. I figured out all the (simple) math so that the ship would compare it's actual compass heading against the target course and figure out whether it is quicker to turn left or to turn right, and to ease out the rudder as the ship gets closer to the target course so that it is less likely to overshoot. And to maintain that course once it's on it, and auto steer back onto the course if the heading gets disrupted. So I even went as far as building a simulator program, and then built out a circuit on a breadboard with an Arduino Micro, a rotary encoder, an OLED display, and a servo. Only thing missing was the magnetometer chip, which I basically just simulated. Brought the whole thing over to my dad's house on Saturday and showed him. He says, "That's not at all what I want. I just want to know what the course the ship is on so I can steer the ship on to that course and maintain it. I don't want the ship to do that."


That's what you get for not doing full requirements gathering, which I should know better, since I'm a software architect in profession. Oh well, maybe it's time I just build my own ship and do what *I* want?

I'm planning on using FrSky DIY TX and RX to send the compass heading back to the TX as telemtry for his ship. Not nearly as sexy as having a compass autopilot. LOL
Sep 06, 2017, 09:11 AM
Big Boats Rule!
boater_dave's Avatar
OK Skystream, you've been drafted into the warship gun director project. When you report for duty we will give you project requirements and a projected timeline. Just kidding.
Did you ever find an arduino component to offer the compass reading? I saw a nice shield that looked like it would perform well. Even gyro stabilized. All of your features could be incorporated into the gun director program. I remember your transmitter project. Very neat. If that had a two way link between ship and controller, how much range did you get and what were the RF parts used? I know it's a Lindy BD, so maybe you never operated too far from shore. The shield I see that has the antenna trace on the edge of the board advertises 100 meter range line of sight, but over water 2.4 G gets weird. The next step up in range would include the short antennas that we are all familiar with. I couldn't see you using one in a small ship like the Blue Devil. My project is a large destroyer, so I can handle the size and weight, but I figure a realistic range of a couple hundred feet would be fine.
Thanks for sharing all your ideas.

Sep 06, 2017, 09:56 AM
Registered User

My custom setup for the Lindy BD was 1-way communication from TX to RX. All the engine management was done by the transmitter, not the receiver. The ship had just a regular 2.4 Ghz receiver, nothing special about it, and everything was conventional inside the ship. Of course it had 2 ESC's for independent engine control of the port and starboard engines, but other than that, it was straight vanilla.

I ended up ordering the same magnetometer / accelerometer LSM303-based chip/board that Cap is using here. I like Adafruit's products and have used lots of them before, so I felt it was worth trying. I got a test up and running last night using the LSM303 and steering the rudder servo to keep the ship on a course of 360.
Auto-course test (1 min 12 sec)

I believe I need to add an offset for magnetic deviation. I'm in Chicago, so that about -3.82 degrees. I was also in my basement when I recorded this video last night, so I was below ground. But it seemed to work well. The important thing is not to query the magnetometer too fast (I got erroneous responses if my query rate was too high) and of course you need to keep it away from metal.
Sep 06, 2017, 10:52 AM
Big Boats Rule!
boater_dave's Avatar
Chicago? And I'm in Milwaukee. The deep south side, even. Close enough for actual exchange. This is getting scary.
Know any of the guys from Fleet Four in Schaumburg? Or the sailboat group at Axehead Lake?

Sep 06, 2017, 11:29 AM
Submarines, etc.
tsenecal's Avatar
i use the following pololu compass, i am guessing it is identical in theory if not actual design to the devices you guys have picked up elsewhere. i use it to return compass heading telemetry on my subs:

the reason i bought it from pololu was price... half of what adafruit's cost
Sep 06, 2017, 02:04 PM
Registered User
Yep, that would work just as well, tsenecal. Uses the same chip even. I like Pololu, too. I bought the geared motors for the Fletcher from Pololu. Also parts for my "cake robot" but that's another story altogether.

I don't know anybody else around that does boats. The only boat I've done is the Fletcher and 1 other scratch built that was done as joke more than anything else (using a PC case can as an airboat).
Sep 09, 2017, 09:52 AM
Registered User
Hi all, I've been busy, took many hours of effort but have "perfected" the compass director. I'll post the video below. I missed a lot of what was going on in thread but skimmed through it. Yes the adafruit LSM303 appears to work pretty well for me, I still recommend it but I am sure that the poulolo compass works just fine. But be sure to use the 3.3v vin, my extensive problems long ago have been attributed to using 5v vin. No damage done except to my progress. Also, you really need to run the calibration sketch, it serial prints the mins and maxs which you write down (with pencil) and then put into your director sketch. It corrects for bias in the compass module. See the instructions for running the calibration, you rotate the module in all directions until all the mins and maxs stabalize then you have your calibration figures

Obviously it's not "perfected" but using various means I've gotten it to track without drifting, (other than the actual heading, but I think that is due to incomplete calibration, and possibly the stepper motor magnetic fields). The main thing is that the turrets behave properly, they always point where the director points and when they are out of field they point dead ahead or astern.

Aside from the radio connection and how that works a compass heading control is definitely workable. Skystream, it's time for you to get your own boat. Dave, I shop all over, it usually comes down to the place that has most of the items I want so I don't have to do multiple orders. If you are really into it look for where they have the uln2803 "&&" 28BYJ-48

So, here it is:

compassdirectorwturrets (2 min 44 sec)

edit: you might observe the inaccurate pointing at some times in the video, originally the director is pointing a the corner of the cardboard box, at some times the director and turrets point well off that heading, that is due to incomplete calibration of the compass, the key thing to note is that when the "ship" points at the original heading, the director and turrets do as well, and a 360 degree turn does not affect that, and most happily when the turrets are out of field they point dead ahead or astern then return to match the director direction. Overall acceptable to my fussy standards, finally!
Last edited by capricorn; Sep 09, 2017 at 11:21 AM.
Sep 10, 2017, 04:16 PM
Registered User
I was able to find another ten male-male jumpers and added the missing turrets. I'll forwarn you if you want to hook this up with jumpers and breadboard you need copious quantities of male-male jumpers, in this case no less than 5x5+4x3+a few more is about 50... so order those too. I put the updated video in the scale boats page of the forum, many more viewers there. My hope is some more come along and dive in, I'd like to see the thing made use of in some form. A self contained sequencer, similar to the aircraft retract sequencer, is certainly a possibility, probably have about 10 customers world wide, maybe 50 with some marketing, not exactly a money maker. It's really the cheap little motors that make the thing viable or appealling.

Have not yet, but probably will, attempt installation of this on 1/200 scale BB styrene kit, that size boat would, I think, easily accomodate this if kept reasonably dry...

Latest version:

compassdirector with 4 turrets (3 min 17 sec)

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
New Product ImmersionRC TNR Touch N Race Wand NFC for FPV Tramp vtx - New Era for Race Directors sevet Multirotor Drone Talk 16 Apr 12, 2017 07:40 PM
Discussion Gun director capricorn Scale Boats 22 Apr 21, 2010 08:17 PM
Discussion Gun director capricorn Scale Boats 46 Feb 25, 2008 08:36 PM
New Product New DVD- Lift Ticket, Director's Cut is shipping!!! Dave Reese Slope 27 Sep 18, 2006 09:43 AM
New speed 400 pylon contest director originaljoe High Performance 2 Jan 18, 2003 11:59 PM