New to Arduino question about motor control

Hi all, new here to the forum! I plan on getting an Arduino Uno to start out my learning on Arduino. Once I understand the programming and operation, my intention is to learn how to control motors on a radio control warship which will control the rotation of the gun turrets. It looks like I can use micro servos for each turret and use PWM to control each of them from the Uno. Would I need the Motor Shield at all? Reading about the Motor Shield, looks like it will let me control 2 non-PWM motors if I decide not to use the servos, is that the case?

Thanks for the advice!

Hi, You can control many servos from a single Arduino, you can also modify servos for constant rotation in case you wanted to be able to rotate your turrets through more than a complete rotation. To do this all you will need is an external power source for the servos, I am assuming that you boat uses nimh, nicad or Lipo batteries like my cars do, in which case they will provide all of the power you need.

Have a look at my blog for lots of posts regarding reading from rc receivers, controlling servos and on that might be of particular interest to you regarding a cheat for adding extra channels.

Duane B

rcarduino.blogspot.com

One thing I was thinking after my post was that I don't want the turrets to rotate as I turn the control on the transmitter. More like this, move the transmitter to a certain position, than have the turret slowly rotate as though it is being turned by a motor and stop once it reaches that point. Not looking for one to one control from transmitter to turret and they would only need to turn maybe 270 degrees, never full rotation. So far I'm using Nimh so no problem with power there.

Still have to order the Uno board so I am a long way off from starting this. I will check out your blog, thanks.

Hi, This is the post I thought you might find relevant - basically using set zones within the throttle signal to trigger a mode change or initiate a preset sequence of actions, such as panning some turrets to a set point -

http://rcarduino.blogspot.com/2012/01/how-to-read-rc-receiver-with_25.html

Duane B

rcarduino.blogspot.com

Hi Duane, sounds interesting with set points, and sounds like what I need to do. Give me lots of time to get an Adruino and get use to the programming as right now it is Greek to me, as the phrase goes. I'm going to be in newbie learning mode for a while.

Ken_NJ: One thing I was thinking after my post was that I don't want the turrets to rotate as I turn the control on the transmitter. More like this, move the transmitter to a certain position, than have the turret slowly rotate as though it is being turned by a motor and stop once it reaches that point. Not looking for one to one control from transmitter to turret and they would only need to turn maybe 270 degrees, never full rotation. So far I'm using Nimh so no problem with power there.

Still have to order the Uno board so I am a long way off from starting this. I will check out your blog, thanks.

As you know, servos can turn quite fast, and while it would be rather funny to watch the turrets turning madly - it's obviously not what you want.

:)

What you would need to do is set the Arduino up to control the turrets - you know this much already. But you have another problem (if I am understanding you correctly): You need to have the Arduino take your commands from the RC receiver, and interpret those to do what you intend. The problem is you can have only so many servos on a standard Arduino (12, IIRC, on the Uno - not sure how many on the Mega), but you'll need to use some of the pins for the channels from the receiver.

Will you have one channel per turret (that doesn't seem very feasible - but then again, maybe it is)? Will you have a channel for a "set button" or something? However it is set up, you'll need to use that many pins on the Arduino, which may cut into the budget on the number of servos you can have (unless you go fancy and have two Arduinos being used one for interpretation of the RC commands, the other to control the servos - communicating thru some kind of serial connection or similar).

So - you'll have some code that interprets the RC commands (there's examples and tutorials out there on doing this; I suggest you compile what you can find right now, with the aim to understand it later), then applies the commands to move a servo to the desired position. At it simplest, these interfaces read the PPM channel from the receiver and turn the result into a number that corresponds to the signal; from what I've seen, you can apply this number (sometimes via the map() function) directly to the Servo library to output PPM to the servos. In essence, the Arduino is a "pass-thru" device. You might want to get this to work, first, because it will be essential to understand what you need to do next.

What you'll want to do is then, rather than "passing thru" the value to the servo, is instead increment the servo slowly from the current servo's PPM setting in the Servo library to the "next" setting. There are examples of how to do this as well out there. Unfortunately, what you want to do goes into potentially (not sure, never researched it) territory where you will probably want to set the position of a servo, hit "set", then move to the "next" servo, position, then "set", and so on - so that the turrets are all moving, slowly from one position to the next; in a sort of multi-servo slow-positioning "ballet".

Getting servos to do this is possible, and I know I have seen something akin to this discussed in these forums and elsewhere (but perhaps relating to other projects - one area you might look into is hexapod and biped walking robots). Do some searching around, I am sure others have had this same issue.

Another possibility, though, which may be ultimately simpler - is to look into servo animation controllers. These are devices which can generally be communicated with using a microcontroller (I am sure some of them might even allow you to communicate using an R/C receiver) and programmed in such a way as to command a myriad of servos all at the same time; the more complex ones allow for things like "easing", "slow-mo", and "tweening" functionalities.

Check out vendors like Pololu, CrustCrawler, and LynxMotion; you might also check out Servo City as well. Another area to look into for such ideas is the Halloween "Dark Ride"/"Haunted House" enthusiast sites; they generally are interested in and come up with interesting and unique animatronic control solutions using multiple servos, and may have some ideas/postings for multiple-servo control that may be applicable.

Good luck with your project!

Thanks there cr0sh. A lot to ponder. I have a long way to go on this. Ordered my Uno from Amazon this morning. I want to implement this on a destroyer. The two forward guns will train together and the two aft guns will train together. So the forward guns could be on the same shared signal and the aft guns on their own shared signal. There might be another gun in the center which will mostly likely train with the forward guns. So I hope that one output would be able to 'operate' a pair or more of guns so that does not seem to be using up to many inputs or outputs.

For now this is turning into another hobby for me in additional to all of the other things I'm doing so like I said, have to start learning the programming. I've built and etched my own PCB's but I'm no electronics wiz, usually get help from other forums for electronics or borrow from public domain.