5 Motor Controller

Hi all

Needed some helpful advice.

I am working on a Motor Controller to be able to move motors in both directions at a set timing. At first i only needed to move one motor so i used the following controller.

The Controller was very basic and easy to use just needing VE+, GND, and a FW and BW command.

To set the commands

To go in both directions 6 and 8 seconds i used a 555 Timing chip and relays so once i got the timing right i put the output into FW and i also put the output into a LM741 Op Amp on the inverted side and then put the output of the LM741 into BW so i was able to get the Motor controller to drive for the correct timing in both directions, this was simple based on my simple electronics work. Im sure there could have been an easier way, i did try a Inverter (4049) but it was not powerful enough to drive the controller so the LM741 was good for this.

Where the real fun comes in and this is where i would like some help is i need to run 5 controllers one after the other. I know i cant replicate my current circuit as it will still be driving through the Op amp whilst the second triggers (if i have got that right) so im assuming i need to do the 556 system however i have been pointed in the direction of the Arduino product.

I'm looking at the Arduino Mega 2560 unit, Arduino Mega2560 A000067 Board R3 | Rapid Online

these are my questions and apologies if they seem stupid.

  1. Can i programme the unit to give me 10 analogue outputs i.e. On/Off in the following logic as an example

Arduino Unit Relay Motor Contoller

Output 1 - 6 Seconds On 1 Motor Controller 1 FW Command
Output 2 - 8 Seconds On 2 Motor Controller 1 BW Command
Output 3 - 7 Seconds On 3 Motor Controller 2 FW Command
Output 4 - 5 Seconds On 4 Motor Controller 2 BW Command
Output 5 - 6 Seconds On 5 Motor Controller 3 FW Command
Output 6 - 9 Seconds On 6 Motor Controller 3 BW Command
Output 7 - 3 Seconds On 7 Motor Controller 4 FW Command
Output 8 - 9 Seconds On 8 Motor Controller 4 BW Command
Output 9 - 4 Seconds On 9 Motor Controller 5 FW Command
Output 10- 5 Seconds On 10 Motor Controller 5 BW Command

Each output needs to run before the other and loop for upto 100,000 Cycles i.e. Simultaneously.

If this is do able, i hope it is, what external parts do i need to connect, i have resistors, capacitors, 5V and 20V regualtors etc, L.E.Ds and the relays etc but are there any specific parts the Arduino needs in order to function, connect?

I look forward to your response :slight_smile:

Lee

  1. Can i programme the unit to give me 10 analogue outputs i.e. On/Off in the following logic as an example

On/off is a digital output not an analog one.

You do not need complementary outputs, nor do you need any 555 timers, the Arduino can do the timing for you.

An LM741 will not work correctly on just 5V.

It helps if you post the links correctly using that chain icon 12 in from the left.

Do you need all those fancy features? That thing cost a bomb!

LMHEng:
The Controller was very basic and easy to use just needing VE+, GND, and a FW and BW command.

To set the commands

To go in both directions 6 and 8 seconds i used a 555 Timing chip and relays so once i got the timing right i put the output into FW and i also put the output into a LM741 Op Amp on the inverted side and then put the output of the LM741 into BW so i was able to get the Motor controller to drive for the correct timing in both directions, this was simple based on my simple electronics work

I have had a very brief look at the product datasheet - in common with its breed it is not light reading.

Are you saying that you have built a system to make it work without using a microprocessor?

If so have you tried replacing all that hardware with a simple Arduino program? If not, that should be the first step. Then if it works for one motor driver there should be no problem extending it to 5.

The timing business will be straightforward with an Arduino - but leave that until you have the motor control working properly.

...R

Hi all

Maybe my post was confusing, the 555 Timing circuit was to work the one controller, this was my start point.

I'm looking to move to the Arduino unit as now i need to control 5 motor controllers, this means scrap the 555 circuits, the Arduino as the sole controller.

If i need to, i can run the Arduino outputs to relays to step up the current to operate the motor Controller.

Hopefully this crude sketch (Attached)helps to explain, the logic as per my 1st post.

Arduino Unit Relay Motor Contoller

Output 1 - 6 Seconds On 1 Motor Controller 1 FW Command
Output 2 - 8 Seconds On 2 Motor Controller 1 BW Command
Output 3 - 7 Seconds On 3 Motor Controller 2 FW Command
Output 4 - 5 Seconds On 4 Motor Controller 2 BW Command
Output 5 - 6 Seconds On 5 Motor Controller 3 FW Command
Output 6 - 9 Seconds On 6 Motor Controller 3 BW Command
Output 7 - 3 Seconds On 7 Motor Controller 4 FW Command
Output 8 - 9 Seconds On 8 Motor Controller 4 BW Command
Output 9 - 4 Seconds On 9 Motor Controller 5 FW Command
Output 10- 5 Seconds On 10 Motor Controller 5 BW Command

Each output needs to run before the other and loop for upto 100,000 Cycles i.e. Simultaneously.

I just wanted to know would this work

and what parts are unique to the Arduino i.e. connectors etc

Kind Regards

Lee

Attachment :slight_smile:

I ask again, do you need such a big fancy motor controller? It is very expensive and you don’t seem to be using any of the special features it offers.

It would seem that you can just connect the output of the Arduino directly to the controller without the need for relays.

You wil need some strips of 0.1” header pins to solder on to to plug into the Arduino’s connector.

The rest is “just” software.

and loop for upto 100,000 Cycles i.e. Simultaneously.

Don’t understand that bit.

The motor controller is needed yes as it has logic functions I'm using for Fan Control etc plus this is one application its needed in, there will be other applications hence this was the one i went with. On the layout i posted i really only showed the control side as this is where im working out how to do it with your help.

In regards to the quote, what i meant was, pardon my lack of knowledge of the product but if this was one sequence......

Output 1 - 6 Seconds On 1 Motor Controller 1 FW Command
Output 2 - 8 Seconds On 2 Motor Controller 1 BW Command
Output 3 - 7 Seconds On 3 Motor Controller 2 FW Command
Output 4 - 5 Seconds On 4 Motor Controller 2 BW Command
Output 5 - 6 Seconds On 5 Motor Controller 3 FW Command
Output 6 - 9 Seconds On 6 Motor Controller 3 BW Command
Output 7 - 3 Seconds On 7 Motor Controller 4 FW Command
Output 8 - 9 Seconds On 8 Motor Controller 4 BW Command
Output 9 - 4 Seconds On 9 Motor Controller 5 FW Command
Output 10- 5 Seconds On 10 Motor Controller 5 BW Command

Can i run this sequence 100,000 times with no interrupt or user input, i.e. constantly looping in effect for 100,000 cycles.

thanks for your feedback so far.

Lee

LMHEng:
Maybe my post was confusing, the 555 Timing circuit was to work the one controller, this was my start point.

I'm looking to move to the Arduino unit as now i need to control 5 motor controllers, this means scrap the 555 circuits, the Arduino as the sole controller.

That is what I envisaged in Reply #2.

But start with using the Arduino to control a single motor.

...R

Can i run this sequence 100,000 times with no interrupt or user input,

Yes very simply. However what do you want to do after this many times and what do you want to do to start another 100,000 cycles?

Thanks for the reply, your help has been much appreciated.

In regards to the cycles, it could be 5000, 10,000, 50,000 or 100,000 depending on what test im running but at the end of the test i would like it to simply stop.

If i can get good at it what id like is a pause switch where i can pause the test at say every 1000 to do an inspection then resume till the next 1000 upto the total i specify.

Lee

LMHEng:
In regards to the cycles, it could be 5000, 10,000, 50,000 or 100,000 depending on what test im running but at the end of the test i would like it to simply stop.

If i can get good at it what id like is a pause switch where i can pause the test at say every 1000 to do an inspection then resume till the next 1000 upto the total i specify.

That is all perfectly doable.

...R

sounds good, will be getting one ordered, just need to figure out the software side :confused:

One last point, it says upto 14 PWM outputs on the Arduino unit, do they have to be PWM or can i have just simple digital i.e. on/off voltage signals to drive the Motor Controller, may seem a stupid question but just asking.

Thanks for the feedback

Lee

LMHEng:
do they have to be PWM or can i have just simple digital i.e. on/off voltage signals to drive the Motor Controller, may seem a stupid question but just asking.

If you want to control the motor speed you need PWM. If you just want it to run at full speed, or stop then any I/O pin can be used.

Some motor controllers need separate PWM inputs for forward and for reverse. Others just need one PWM input and another I/O pin (or 2) for selecting the direction.

...R

Thanks for the feedback

The controller im using simply just needs a 'On' voltage/signal for whatever duration of time for either the FW command or BW command hence i wanted to know if i could simply set the 10 Outputs to be a 'On' signal so i can drive the FW and BW inputs on the controller.

By the sound of it i can do this.

Kind Regards

Lee

if i could simply set the 10 Outputs to be a 'On' signal so i can drive the FW and BW inputs on the controller.

If you do that then all the motors will be on at the same time. From the early information I thought you wanted a sequence.

Sorry, i thought i could have 10 Separate Outputs all controlled separately with different timings as per the logic i included.

In regards to the quote, what i meant was, pardon my lack of knowledge of the product but if this was one sequence......

Output 1 - 6 Seconds On 1 Motor Controller 1 FW Command
Output 2 - 8 Seconds On 2 Motor Controller 1 BW Command
Output 3 - 7 Seconds On 3 Motor Controller 2 FW Command
Output 4 - 5 Seconds On 4 Motor Controller 2 BW Command
Output 5 - 6 Seconds On 5 Motor Controller 3 FW Command
Output 6 - 9 Seconds On 6 Motor Controller 3 BW Command
Output 7 - 3 Seconds On 7 Motor Controller 4 FW Command
Output 8 - 9 Seconds On 8 Motor Controller 4 BW Command
Output 9 - 4 Seconds On 9 Motor Controller 5 FW Command
Output 10- 5 Seconds On 10 Motor Controller 5 BW Command

Can i run this sequence 100,000 times with no interrupt or user input, i.e. constantly looping in effect for 100,000 cycles.

Have i mis understood something?

Regards

Lee

LMHEng:
Sorry, i thought i could have 10 Separate Outputs all controlled separately with different timings as per the logic i included.

Yes you can.

Can i run this sequence 100,000 times with no interrupt or user input, i.e. constantly looping in effect for 100,000 cycles.

Yes.

...R

Are you trying to do all of that as one single sequence so each motor moves out then back in turn. Thus motor 1 essentially stops after reversing and does not resume again until after motor 5 has reversed for 10 seconds?

Or... are you trying to do each motor separately moving back and forth according to the times given, so that as soon as Motor 1 reverses for 8 seconds it instantly starts going forward for 6 seconds again and all the motors start at the same time and are going at the same time on different cycles?

Just Curious. At first I thought it was scenario #1 which is pretty simple. But later is seems maybe the second, motor independent timing scenario was what you are trying to do. Much as if you had just repeated your 555 circuit 4 more times. That independent code is a little bit more complex but not much. You could certainly loop indefinitely or to a predetermined count, and with timings pretty close or better than what you have now with discrete components. You seemed curious how the code might look so here are some examples. Scenario one would look something like...

const byte outputPins[10] = {2,3,4,5,6,7,8,9,10,11};  //Pin numbers for outputs 1-10  Motor1fw, Motor1bw,..., Motor5fw, Motor5bw
const int times[10] = {6000,8000,7000,5000,6000,9000,3000,9000,4000,5000}; //On times for output 1-10 in ms
unsigned long delayTime = 0;
byte outputNumber;

void setup() {
  for (outputNumber = 0; outputNumber<10; ++outputNumber) {
    pinMode(outputPins[outputNumber],OUTPUT);
  }
}

void loop() {
  for (outputNumber = 0; outputNumber < 10; ++outputNumber){
    if (millis()>delayTime) {
      digitalWrite(outputPins[(outputNumber+9)%10],LOW);  //Turn off old Direction Pin
      digitalWrite(outputPins[outputNumber], HIGH);       //Turn on new Direction Pin
      delayTime = millis()+times[outputNumber];           //Set new delay Time
    }
  }
}

Scenario 2 would be more like this, but in both scenarios the pairs of fw and bw are inverted such that both are briefly in a low state prior to the inversion. A delay between the digitalWrite statements could increase this pause if it is required.

const byte outputPins[10] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; //Pin numbers for outputs 1-10  Motor1fw, Motor1bw,..., Motor5fw, Motor5bw
const int times[10] = {6000, 8000, 7000, 5000, 6000, 9000, 3000, 9000, 4000, 5000}; //On times for output 1-10 in ms
unsigned long delayTimes[5] = {0, 0, 0, 0, 0};
unsigned long newTime, sec = 0;
byte motorNum, motorDir[5] = {1, 1, 1, 1, 1};
byte outputNumber;

void setup() {
  for (outputNumber = 0; outputNumber < 10; ++outputNumber) {
    pinMode(outputPins[outputNumber], OUTPUT);
  }
}

void loop() {
  newTime = millis() + 1000;
  for (motorNum = 0; motorNum < 5; ++motorNum) {
    if (millis() >= delayTimes[motorNum]) {
      digitalWrite(outputPins[(motorNum * 2) + 1 - motorDir[motorNum]], LOW);                                      //Turn off old Direction Pin
      digitalWrite(outputPins[(motorNum * 2) + motorDir[motorNum]], HIGH);                                         //Turn on new Direction Pin
      delayTimes[motorNum] = newTime + times[(motorNum * 2) + (motorDir[motorNum] = !motorDir[motorNum])] - 1000;  //Set new Motor Delay
    }
  }
  while (millis() < newTime);
}

From here you would add buttons to start or stop. Maybe add a rotary encoder and display with a menu to adjust total cycle times, motor direction times, pauses, etc. All of that and more is certainly possible. You could do it with an UNO but bigger will certainly allow for more expansion options in the future.