Help using arduino and motor driver

JimboZA:

Is there any way to make the motors run at the same time?

If both boards are enabled and hooked up, and you're sending the right signals to them, both motors will be able to run at the same time.

That's why I asked you to write a very small sketch that is easy for others to follow, where you do nothing but set the right values on your Arduino pins which then get the right values to INA (say, High) and INB (say, Low) on both boards and see if they run. There's too much clutter in that long code for me to wade through- do this simple test and see if it works or not. If it doesn't work, then we'll need to see what's wrong. If it does work, then add PWM to both and see if that works....

I'm not inclined to help if you don't say anything about whether or not you tried my suggestion but just asked exactly the same question 6 hours later.

thanks. will try that as soon as possible

ozgur84:

arjiii24:
please anyone help me.

how can i make the two motors run at the same time?

hi,

even though, I control only one stepper motor and trying to use L293D, I have current and heating realted issues and I am planing to use some mosfet arrays to protect the driver circuit. So, I have an idea which I asked in the forum and waiting for th replies from the experienced users. maybe you want to follow the topic too...

This is the beginning of my project http://arduino.cc/forum/index.php/topic,152747.new/topicseen.html#new
After having overheating I asked this question http://arduino.cc/forum/index.php/topic,153070.0.html

In my second topic I am trying to find some answers related to the mosfet array. If it is approved, I think you can use the same idea for your project. Since you are trying to use only one board, you can connect the output of your dirver circuit to the (4, 8 or 16) base of the mosftes and you supply the motor supply source to the mosfets. So the drive current flows over the mosfets instead of your circuit and, if something blows up, it will be the mosfets instead of your boards.... I also reckon that the mosfets must have high switching frequencies. I have 4 TIP3055 Auido grade mosfets and I will use them if I chactch a clue from somebody :slight_smile:

It would be great if somebody who has a better electronic experience could also contribute my idea. And if you decide to try by yourself, please let me know what the result is :slight_smile:

i'll be looking forward to this mate

I guess the problem lies with the commands sent through the arduino. Since the arduino I'm using is interfaced with Visual Basic on a laptop.
I guess the arduino can't act fast enough.
Everytime I press a button, a button w/ a key shortcut "W" for example (for forward), a character will be sent, which will be received and read by the arduino. .

a part of the VB code (for the "W" only. the button display codes are not included and others):

 Private Sub Main_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.W Then
            If sysActivated = True Then
                forwardControl()
            ElseIf sysActivated = False Then
                Voice.Speak("The Serial Port is closed! Make sure that the port is open before operating. Thank You ", SpFlags)
                MsgBox("The Serial Port is closed. . Make sure that the port is open before operating. Thank You ", MsgBoxStyle.Critical, "Error")

Private Sub forwardControl()
        GroupBox2.Enabled = True
        If RadioButton1.Checked = True Then
            SerialPort1.Write("5")
        ElseIf RadioButton2.Checked = True Then
            SerialPort1.Write("6")
        ElseIf RadioButton3.Checked = True Then
            SerialPort1.Write("7")
        Else
            SerialPort1.Write("1")
        End If

Private Sub Main_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
        If e.KeyCode = Keys.W Then
            btnForwardOn.Visible = False
            btnForwardOff.Visible = True
            stopControl()

Private Sub stopControl()
        SerialPort1.Write("0")

So in VB, while i'm pressing the "W" on keyboard, it will continually send a char (char because the code written in the Serial is enclosed in "", string form)("5" - for speed LOW; "6" - for Normal speed; and "7" for fast) through the Serial
and if the "W" key is released, a "0" code is sent for Stop command

In the arduino (not full):
under void loop(). .

while (Serial.available() == 0); 
int val = Serial.read() - '0'; 

//for stop
if (val == 0)
{
  
  digitalWrite(INAboard1, LOW);
  digitalWrite(INBboard1, LOW);
  digitalWrite(INAboard2, LOW);
  digitalWrite(INBboard2, LOW);
}

// val 5 to 7, speed control of forward
else if (val == 5)
{
  analogWrite(PWMboard1, 127);
  analogWrite(PWMboard2, 127);
  digitalWrite(INAboard1, HIGH);
  digitalWrite(INBboard1, LOW);
  digitalWrite(INAboard2, LOW);
  digitalWrite(INBboard2, HIGH);
}
else if (val == 6)
{
  analogWrite(PWMboard1, 191);
  analogWrite(PWMboard2, 191);
  digitalWrite(INAboard1, HIGH);
  digitalWrite(INBboard1, LOW);
  digitalWrite(INAboard1, LOW);
  digitalWrite(INBboard2, HIGH);
}
else if (val == 7)
{
  analogWrite(PWMboard1, 255);
  analogWrite(PWMboard2, 255);
  digitalWrite(INAboard1, HIGH);
  digitalWrite(INBboard1, LOW);
  digitalWrite(INAboard2, LOW);
  digitalWrite(INBboard2, HIGH);
}

by the way. the pins used are all defined already.

The problem is, if while i'm pressing the W button in VB, and LOW speed radiobutton is checked, only 1 motor will turn,, same with Normal speed,
on the HIGH speed, both motors will run but not at the same time.

hello anyone?

You said a while back, in response to my suggestions to write a really simple sketch:

thanks. will try that as soon as possible

So, did you try that? Do you yet have a simple code that at least proves to you that you can run the two motors at the same time under simple circumstances?