Arduino Forum

Using Arduino => Motors, Mechanics, and Power => Topic started by: tlestak on Aug 23, 2019, 12:26 am

Title: Controlling DC Motor with L293
Post by: tlestak on Aug 23, 2019, 12:26 am
Hello,
     I am attempting to control a 24VDC, 1A motor using an Arduino Uno and L293 H Bridge.  I have been struggling with this as the motor has 3 ports to use, which I want all to be connected at once.  To spin ClockWise it needs +24 on 1 and -24 on 2.  To spin CounterClockWise, it needs -24 on 1 and +24 on 3.  The issue I have is with having Port 1 being connected to + and - at the same time, as this just grounds the circuit.  I am looking to remedy this issue with the L293 H Bridge and was wondering if the below set up and code will work or fry my components/ board (which I have already done once).  Thank you!
Title: Re: Controlling DC Motor with L293
Post by: slipstick on Aug 23, 2019, 10:26 am
Please provide a link to a datasheet/specification of that motor. I have a feeling you may be misinterpreting something in there.

And a hand drawn circuit diagram might be more useful than that strange Fritzy thing.

Steve
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 23, 2019, 06:13 pm
@slipstick

Here is a link for the DC wiring diagram:
     https://assuredautomation.com/literature/IM/AA_R_Manual.pdf

I have attached a hand drawn circuit diagram.
Title: Re: Controlling DC Motor with L293
Post by: TomGeorge on Aug 24, 2019, 05:06 pm
Hi,
You are trying to control a valve actuator.

Quote
To spin ClockWise it needs +24 on 1 and -24 on 2.  To spin CounterClockWise, it needs -24 on 1 and +24 on 3.
The link you provided, the DC motor version has no pin 2 connection.
Although your schematic shows the correct pins.
(https://forum.arduino.cc/index.php?action=dlattach;topic=632760.0;attach=321723)
(https://forum.arduino.cc/index.php?action=dlattach;topic=632760.0;attach=321725)
The switches are on cams located inside the actuator housing.
Have you applied 24V directy to the terminals to prove that it does work CW and CCW?

Tom... :)
Title: Re: Controlling DC Motor with L293
Post by: TomGeorge on Aug 24, 2019, 05:14 pm
Hi,
OPs Circuit;
(https://forum.arduino.cc/index.php?action=dlattach;topic=632760.0;attach=321581)
The L293 is only rated at 1A, I would be using something a bit heavier in current capacity.
Tom.. :)
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 24, 2019, 08:55 pm
Apologies... In my original post I meant pins 1,3,4.  And yes I have been able to rotate the motor CW and CCW with the pins and by applying voltage directly across the motor.  However, I would like to use the pin wiring in my design to make use of the switches so I do not over rotate the valve.  I have yet to test out the L293 yet, but the motor only pulls 1A so I was thinking it should be okay.
Title: Re: Controlling DC Motor with L293
Post by: MarkT on Aug 25, 2019, 09:12 pm
Some of these 24V valve motors stall at _1.9A_, not 1A, so you might need to parallel both channels of the L293D

By the way please give full details of the hardware, i.e. the precise model number, so we don't have to guess if
its the R-150, R-300, R-600.   Links to datasheet are good too.  https://assuredautomation.com/literature/R_actuators_datasheet.pdf (https://assuredautomation.com/literature/R_actuators_datasheet.pdf)
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 26, 2019, 08:35 pm
@MarkT

The model number is R600B and the schematic can be found in my second post.
Title: Re: Controlling DC Motor with L293
Post by: MarkT on Aug 27, 2019, 08:07 pm
As the datasheet shows the 600 model 24Vdc requires 1.9A, not 1.0A.
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 27, 2019, 10:43 pm
@MarkT

I believe the L293NE should be able to handle this as the output and peak output are 1A and 2A respectively.

http://www.ti.com/lit/ds/symlink/l293.pdf
Title: Re: Controlling DC Motor with L293
Post by: jremington on Aug 27, 2019, 11:32 pm
Quote
I believe the L293NE should be able to handle this
Lots of people have similar beliefs initially, and end up buying a modern, much more efficient and capable motor driver, like one of these (https://www.pololu.com/category/11/brushed-dc-motor-drivers).

Unlike most other suppliers, Pololu engineers do not inflate the device ratings, and actively support their products.
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 27, 2019, 11:53 pm
@jremington it seems as if you both are correct.  I set up my circuit as I have described above and am getting correct outputs with nothing hooked up.  However, as soon as I hook up the motor, I will only get an output of about .5V, no matter the input voltage.  I assume this is due to limits of the L293?
Title: Re: Controlling DC Motor with L293
Post by: jremington on Aug 28, 2019, 12:26 am
I don't understand your post. Where are you making this measurement?

Are you sure you have the L293 and not the L293D? If the L293, then external inductive kick diodes are required. As they are not shown in the posted diagram, you may have destroyed the chip.

(https://forum.arduino.cc/index.php?action=dlattach;topic=632760.0;attach=322194)

Another reason to switch to a modern motor driver.
Title: Re: Controlling DC Motor with L293
Post by: TomGeorge on Aug 28, 2019, 09:06 am
Hi,
What code are you using to control your motor?
Can you post it please?

Thanks.. Tom.. :)
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 29, 2019, 05:37 am
@jremington I was taking these measurements across the outputs of the L293NE where the leads to the motor would be connected (i.e. 1+ 3-).  When I take these measurements without the motor, I am getting the correct output.  However, when I attach the leads to the motor, the voltage drops due to the current draw being too high (I believe).  And I am sure that I have the L293NE.  I had not seen any documentation regarding diodes to I will look into that...

@TomGeorge the code I am using is in my original post.  It is named Motor_Driver_Test.ino
Title: Re: Controlling DC Motor with L293
Post by: TomGeorge on Aug 29, 2019, 01:30 pm
Hi,
Below is a simplified diagram of your schematic, using a L293 will not do the job you need.
(https://forum.arduino.cc/index.php?action=dlattach;topic=632760.0;attach=322426)

The problem is the Enable pins.
When enabled the outputs follow the inputs.
When not enabled the outputs are open circuit.
L293 has tri-state outputs.
But the enables control a pair of outputs.

If motorpin 1 and motorpin 3 need to be HIGH and LOW, both enable pins will need to be HIGH, however this means motorpin 4 is connected to an enabled output, not an open circuit that your motor will need.

I hope that makes sense.

Tom... :)
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 29, 2019, 08:45 pm
@TomGeorge

Thank you for the explanation.  Any suggestions on how to run the motor?  I have tried various options (op amps, motor drivers, MOSFETs, solid state relays) and seem to have the same issue regardless of the hardware.
Title: Re: Controlling DC Motor with L293
Post by: jremington on Aug 29, 2019, 09:10 pm
The first thing you need to do is figure out how to wire the motor such that it works properly with a simple, two wire connection to a battery or power supply.

That is the connection you will use for the two outputs of the motor driver.

Then select an appropriate motor driver. Don't bother with the L293.
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Aug 29, 2019, 09:34 pm
@jremington I can not have a 2 wire output with the motor configuration (1+/3- and 4+/1-).  I think a two output (one output for 1/3 and the other for 4/1) motor driver with the proper current/ voltage capabilities may be the solution.
Title: Re: Controlling DC Motor with L293
Post by: jremington on Aug 30, 2019, 12:34 am
Looking at that motor wiring diagram, it appears that you have no option but to use the limit switches. In that case, for bidirectional control you need to add two diodes, as done here:

(https://i.stack.imgur.com/pKpiM.png)

The idea is that when one switch opens up at the end of travel, the diode allows you to reverse the current flow so that the motor can be backed away from that end. You will have to experiment to see which switches are activated, and which way to place the diodes (they MUST oppose each other).

Most likely you will use pins 1 and 6 as the power leads, and connect the diodes to some combination of 3,4, and 5. And what are the "auxiliary limit switches"?

As it is, I don't completely believe the diagram posted previously and below, as the NO (normally open) terminal associated with switch 3 is shown as closed.
(https://forum.arduino.cc/index.php?action=dlattach;topic=632760.0;attach=321723)
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Sep 03, 2019, 04:32 am
@jremington

It seems that the diode idea would work.  I have yet to attempt it in a lab setting so I will give it a try and let you know.

I am not sure about using pins 2, 5, 6 as they are just linked back to 4 or 3 so I think I have to make it work with the input ports available.

It seems that auxiliary switches are additional switches the manufacturer can add on for additional stopping points of the valve.  Here is the description from the website:
"2 Extra SPDT Switches
The R4 Actuators come with 2 SPDT switches that are activated by cams that are pre-set to full clockwise and full counter clockwise. These are typically used to enegize indicator lamps to indicate the open and closed position of the valve being operated. The 2 extra SPDT switches operate using of 2 independent common voltages, and have adjustable cams to set the contact points at whatever rotation you want."
Title: Re: Controlling DC Motor with L293
Post by: jremington on Sep 03, 2019, 05:10 am
First figure out what the switches attached to pins 3, 4, 5 and 6 actually do at the ends of travel, and make a circuit that looks like the one with diodes (if possible). I suspect that the manufacturer's diagram is wrong, and the NO and NC labels associated with pin 3 need to be reversed.

It is very important that somewhere in the middle of the travel, both switches are closed (NC) as shown in the diode diagram. That way the motor can be moved both ways by simply reversing the current flow.

If you can open up the casing and get access to the "hidden" motor terminal, problem solved!
Title: Re: Controlling DC Motor with L293
Post by: MarkT on Sep 04, 2019, 02:08 am
@MarkT

I believe the L293NE should be able to handle this as the output and peak output are 1A and 2A respectively.

http://www.ti.com/lit/ds/symlink/l293.pdf
Take that risk if you want, I'm advising you not to because living on the edge of spec's usually ends in disappointment - its false economy anyway as you have a dual H-bridge and one motor, naturally you'd
parallel them up for better speed and lower losses anyway.
Title: Re: Controlling DC Motor with L293
Post by: TomGeorge on Sep 04, 2019, 02:18 am
Hi,
@MarkT  see post #15.

Tom.. :)
Title: Re: Controlling DC Motor with L293
Post by: tlestak on Sep 05, 2019, 07:46 am
Hello,
     So I have discovered a solution using 2 relays and an Arduino.  This circuit would work with a single DPDT relay, however I did not have one that could handle the 24V of the motor and still be actuated by the 5V of the Arduino.  So, I have a Solid State Relay that is activated by the Arduino, which then powers the coil of the DPDT relay and drives the motor.  I have attached a schematic of my set up.  Thank you everybody for the input!