Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: strif on March 08, 2012, 11:12:45 AM

Title: Need Help and suggestion in electronics components
Post by: strif on March 08, 2012, 11:12:45 AM
Hi all ,

Thanks for spend time read my post and feel free giving suggestion / help in my project.
my project is a three fingers robotic gripper.
I am using
2 pcs of 12volt DC motor with gear 107rpm
1 pcs of 5 volt stepper motor 200 steps / rev , 4 wire bipolar . 1 A per phase.
3 limit switch as input , and 1 set of strain gauge on the finger as pressure input.

I am using 5volt single channel/pole  relays for my DC motor driver , 12 volt DC from battery ( 4500mhA )
3 relays as a set driver for a DC motor.
the concept as , A B C relays , A for the switch for 12 volt DC .
when no signal ( 5v ) from MCU , the NC ( normally close ) will not connect to any wire .
so it work as a ON/OFF 12 volt DC switch ,
when I giving 5 volt signal from MCU , the Common ( always connect with 12 volts DC battery ) will connect to NO ( normally open ) then I get 12 volt DC at NP at A relay

NP from A relay connect to Common at B relay , NC ( normally close ) connect to Red wire of DC motor , NO ( normally open ) connect to Black wire of DC motor .
GND from battery connect to Common at C relay , NC ( normally close ) connect to Black wire of DC motor , NO ( normally open ) connect to Red wire of DC motor .

MCU provide 2 signal to 3 relays (A, B, C) 00 01 10 11 . The first digit as the control for relay A , as On Off for DC motor .
second digit as the swap current , for the direction of DC motor . When 10 , the 12 volt DC will move from Red wire to Black wire of DC motor , when 11 , the 12 volt DC will move from Black wire to Red wire .

[ I know my way explain was messy , I hope all of you can understand , or just ask me for more details ]

I use L297 and L298 as my Stepper Motor driver , I want the function of  [ Enable , Direction , 2 phase full step ]


here is my question :
1) how I connect my MCU signal pin between relays ? ( I need transistor to pull up the voltage and current for those relays , right ? )

2 ) L297 and L298 can provide the power to drive my stepper motor ?

3 ) The limit switch have 3 wire ( common , NO , NC )  Can I provide 5 volt output pin from my Axon II and receive 2 signal from NO NP direct into my Axon II signal pin ?

4 ) How should I construct my Strain Gauge circuit ?

Thanks A lot


(http://i150.photobucket.com/albums/s98/LeongStrife/photo/project_1/DSC00312.jpg)

(http://i150.photobucket.com/albums/s98/LeongStrife/photo/project_1/DSC00015.jpg)

(http://i150.photobucket.com/albums/s98/LeongStrife/photo/project_1/DSC00338.jpg)

(http://i150.photobucket.com/albums/s98/LeongStrife/photo/project_1/DSC00337.jpg)

(http://i150.photobucket.com/albums/s98/LeongStrife/photo/project_1/DSC00027.jpg)

(http://i150.photobucket.com/albums/s98/LeongStrife/photo/project_1/DSC00031.jpg)

Title: Re: Need Help and suggestion in electronics components
Post by: definitionofis on March 09, 2012, 08:04:37 AM
I have two L298s. I destroyed one with too much current.  If you stall your motors I wonder how much current they draw.
I put a current limiter in the circuit to protect my second L298 from destruction.  I think the specification says 2A maximum.
Title: Re: Need Help and suggestion in electronics components
Post by: Admin on March 09, 2012, 08:22:12 AM
1) how I connect my MCU signal pin between relays ? ( I need transistor to pull up the voltage and current for those relays , right ? )
I strongly recommend buying a motor driver instead.

You can use relays arranged as H-bridges that are connected to your mcu by MOSFETs, but that's a huge messy circuit that won't save you much money. Plus, relays can't do PWM.


Quote
2 ) L297 and L298 can provide the power to drive my stepper motor ?
Again, I recommend buying a pre-made stepper motor driver.

To know if any driver can power it, you need to look at the stepper motor datasheet to determine voltage and current, then look at the L29x datasheet to see what the chip is rated for.


Quote
3 ) The limit switch have 3 wire ( common , NO , NC )  Can I provide 5 volt output pin from my Axon II and receive 2 signal from NO NP direct into my Axon II signal pin ?
What you do is connect common to ground, and the NO to a digital input pin on the Axon. You want the internal pull up resistor on that digital IO pin turned on. WebbotLib Project Designer can do this for you in a jiffy, and even show you the circuit and example source code.


Quote
4 ) How should I construct my Strain Gauge circuit ?
Use google to look up the circuit, then imitate it  :P

Below is what I found in 3 seconds typing it into google . . . you can find more details by reading up on it ;D

(http://hades.mech.northwestern.edu/images/7/7c/Simple_strain_guage_circuit.jpg)
Title: Re: Need Help and suggestion in electronics components
Post by: strif on March 09, 2012, 09:04:52 AM
Dear Admin,

Thanks ! I will look up those driver  :)
Title: Re: Need Help and suggestion in electronics components
Post by: strif on March 09, 2012, 09:06:30 AM
Dear Definitionofis,

L298 will provide unlimited current to the stepper motor until it burned it self ?
how you protect the circuit ? can you Please show me diagram ? Thanks a lot ~
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 09, 2012, 10:13:54 AM
Hi,

L298 will provide unlimited current to the stepper motor until it burned it self ?
how you protect the circuit ? can you Please show me diagram ? Thanks a lot ~
It is shown in the datasheet.
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 09, 2012, 10:42:40 AM
Hi,

You can use relays arranged as H-bridges that are connected to your mcu by MOSFETs, but that's a huge messy circuit that won't save you much money. Plus, relays can't do PWM.
There's no need for MOSFETs to drive a relay and for using PWM with relays, I'll repost this link to a motor driver with relay and PWM (http://That.Homepage.dk/PDF/PWM+Relay_4_Motor_Ctrl.pdf). What do you find huge and messy about it? :)


Changed the link once more, tested after modify and it works. If it gets weird again, perhaps there's something wrong in the forum software.
Title: Re: Need Help and suggestion in electronics components
Post by: Admin on March 09, 2012, 11:01:40 AM
You can use relays arranged as H-bridges that are connected to your mcu by MOSFETs, but that's a huge messy circuit that won't save you much money. Plus, relays can't do PWM.
There's no need for MOSFETs to drive a relay and for using PWM with relays, I'll repost this PWM+relay circuit (http://). What do you find huge and messy about it? :)
Well, I was implying that he couldn't run relays directly from an mcu I/O pin, and that relays can't do PWM for motors (at least not high speed PWM). Whether he used MOSFETs or regular transistors to drive the relays is another issue of which isn't really relevant - I'd say use neither and go the motor driver route :P

btw, your posted link is dead :P

Whats messy is that two motors would require 8 relays and 8 transistors. That's a ton of wiring and board space!

By comparison, a motor driver would only need three wires: ground, power, and a signal line
(note: some may require more depending on how it's designed)

And yea, in most cases there is no need to even have relays if MOSFETs are used. :P
Title: Re: Need Help and suggestion in electronics components
Post by: strif on March 09, 2012, 11:34:21 AM
Understand ~

I will try on use those IC chip motor driver to control my DC motor direction and enable .
Thanks a lot !
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 09, 2012, 01:15:00 PM
Hi,

btw, your posted link is dead :P
Strange, it must have vanished after I posted it (I always check my links), but it should be OK now.


Whats messy is that two motors would require 8 relays and 8 transistors. That's a ton of wiring and board space!
Take a look at the circuit - for each motor you only need a single relay, a single power MOSFET for the PWM and 3 bipolars for each motor
Using 4 relays for a single motor would be misunderstanding the concept of relays.


By comparison, a motor driver would only need three wires: ground, power, and a signal line
(note: some may require more depending on how it's designed)
Yes, my solution takes one extra wire (ground, power, speed and direction), but won't need any extra wires under any circumstances.


And yea, in most cases there is no need to even have relays if MOSFETs are used. :P
For a newbie, a relay is usually easier to understand and less MOSFETs means less change of ruining components - MOSFETs are easy to kill by ESD.
Title: Re: Need Help and suggestion in electronics components
Post by: jkerns on March 09, 2012, 01:52:13 PM
link was weird. But this worked: http://that.homepage.dk/PDF/PWM+Relay_4_Motor_Ctrl.pdf (http://that.homepage.dk/PDF/PWM+Relay_4_Motor_Ctrl.pdf)

Title: Re: Need Help and suggestion in electronics components
Post by: definitionofis on March 09, 2012, 03:08:41 PM
Dear Definitionofis,

L298 will provide unlimited current to the stepper motor until it burned it self ?
how you protect the circuit ? can you Please show me diagram ? Thanks a lot ~

Admin said buy a motor driver. However, I think he didn't realise that L298 is a bidirectional motor driver.

I added a LM317 in current limiting mode to power the L298 so it could never go over 2A.

LM317 current mode: http://forum.allaboutcircuits.com/showthread.php?t=57873 (http://forum.allaboutcircuits.com/showthread.php?t=57873)
Also maybe LM1117 is more efficient: http://laserpointerforums.com/attachments/f67/34771d1317703421-lm1117-driver-build-questions-l1117.jpg (http://laserpointerforums.com/attachments/f67/34771d1317703421-lm1117-driver-build-questions-l1117.jpg)

Check how many amps they can handle.

Maybe a fuse or a resettable fuse like a poly-switch would be a better idea because they do not waste watts as heat.
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 09, 2012, 05:27:25 PM
Hi,

link was weird. But this worked: http://that.homepage.dk/PDF/PWM+Relay_4_Motor_Ctrl.pdf (http://that.homepage.dk/PDF/PWM+Relay_4_Motor_Ctrl.pdf)
Yes, thanks a lot :)

I remade the link once more (and checked after posting), very strange, but I hope it stays OK.

Thanks!
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 09, 2012, 05:37:09 PM
Hi,

Admin said buy a motor driver. However, I think he didn't realise that L298 is a bidirectional motor driver.
The L298 is for the stepper, the motor driver mentioned was for the DC motors.


I added a LM317 in current limiting mode to power the L298 so it could never go over 2A.
That's completely unnecessary, as the L298 can do this perfectly well, much better than an LM317 - that's what the sense resistors are for and they limit through current chopping.


Maybe a fuse or a resettable fuse like a poly-switch would be a better idea because they do not waste watts as heat.
Neither does the chopper in the L298 and it only limits as needed - no fuse to reset or change, it just chops more or less, until the over-current condition is remedied.
Title: Re: Need Help and suggestion in electronics components
Post by: definitionofis on March 09, 2012, 06:06:58 PM
Thanks for that, re: L298.  I saw those sense resistors today and suspected I was missing something but I didn't wake up and absorb their purpose.
Title: Re: Need Help and suggestion in electronics components
Post by: Admin on March 11, 2012, 03:25:58 AM
errrr sorry for the misunderstanding . . . the L298 is a motor driver chip, yes. But I meant a full fledged motor driver that requires no soldering, ie everything is already built in including capacitors, voltage regulator, etc. Just one example: http://dimensionengineering.com/Sabertooth2X5.htm (http://dimensionengineering.com/Sabertooth2X5.htm)


The link that Soeren posted has quite a lot of components, and still requires two relays (the four pin type) . . . I'm generally against anything that requires a lot of wiring because it adds more opportunities for something to go wrong. And you won't be able to get high speed PWM with relays . . .
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 11, 2012, 12:38:53 PM
Hi,

The link that Soeren posted has quite a lot of coponents,
Not counting the cap on the motor (which is needed on any motor, no matter the controller) there's 16 components driving one relay.
Any circuit with that few components I'll call real simple to make.

If you're just after the finished result, buying a complete 'bot is the way to go, but if you're in it to build, pre-assembled modules takes away from the experience and make it into color-by-numbers - and you can't really say you did it all ;D


and still requires two relays (the four pin type)
That's an strange argument - a single DPDT relay, as shown in the schematic, is all that's needed for one motor.
It's like if I argued that you may get a couple of defect modules, so you'd need at least 7 of them.


. . . I'm generally against anything that requires a lot of wiring because it adds more opportunities for something to go wrong.
I'm generally against any ready-made modules, as you have no knowledge of, nor any control over the inside stuff - building from single components also mean that you can repair
anything that should break (plus you can make it so it don't :)).

Buy a module and if the company you bought it from goes bust as well as the module, you're royally screwed.


And you won't be able to get high speed PWM with relays . . .
You obviously didn't read at the schematic, where a MOSFET takes care of the PWM, before you wrote this - what kind of debating is that?
Title: Re: Need Help and suggestion in electronics components
Post by: Admin on March 12, 2012, 04:11:38 AM
Soeren, you and I keep hijacking threads lol . . .

Quote
If you're just after the finished result, buying a complete 'bot is the way to go, but if you're in it to build, pre-assembled modules takes away from the experience and make it into color-by-numbers - and you can't really say you did it all
This is the 'build a robot from scratch' argument. You could go out into the forest and mine/smelt some metal, build your own capacitors and resistors, chop down trees to make wheels, etc. All that done with a handmade flint axe, of course. :P

The point I'm making is, if your goal is to build a motor driver, go out and buy the capacitors and resistors. If your goal is to make a robot, buy the motor driver and microcontroller. If your goal is to learn how mcu's work, buy the individual components and read the entire 600 page manual. If you want to learn how a robot works, buy the mcu already made.

Anything store bought is likely to be more reliable and more functional, at the expense of not quite knowing how it works. It's like a programmer using a pre-written library, versus writing his own library from scratch.

It really depends strif's goal of his project.

Which brings me to my next point . . .
Quote
I'm generally against any ready-made modules, as you have no knowledge of, nor any control over the inside stuff - building from single components also mean that you can repair
I built a motor driver once. It was nice and educational. But I don't want to spend days making one again - the time (for me) is better spent building the robot. And you can still repair store-bought drivers by swapping out damaged components. :P

I only build my own stuff when no one is selling what I need, or what they sell is too expensive or lacks features.

Quote
Quote
And you won't be able to get high speed PWM with relays . . .
You obviously didn't read at the schematic, where a MOSFET takes care of the PWM
hmmmmm I don't understand the point of the relay if there is a MOSFET doing the switching . . . if I were to do it using individual components, I would use four MOSFETs arranged as an H-bridge, with a diode on each MOSFET to protect it. I would only use relays if the MOSFETs couldn't handle my required voltage/current.
Title: Re: Need Help and suggestion in electronics components
Post by: strif on March 15, 2012, 03:52:19 AM
I spend 2 days on the L297 L298 stepper motor drive .
signal pin out from Axon _  step_clock, half/Full step, direction, enable and reset.
I get the voltage output from A B C D of L298.
but the voltage won't have much changing ( 4.5 + - 0.3 volt )
my stepper motor won't move at all .

Before I use L297+L298N circuit. I had tired on L293D motor driver.
It can drive my stepper motor but I dunno how to change the direction on the programming code
(Project_Designer show on Coil A, B, C, D, Enable, and half/Full step. How to make it move in CW and CCW ? )

Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 15, 2012, 06:04:50 PM
Hi,

I spend 2 days on the L297 L298 stepper motor drive .
signal pin out from Axon _  step_clock, half/Full step, direction, enable and reset.
I get the voltage output from A B C D of L298.
but the voltage won't have much changing ( 4.5 + - 0.3 volt )
my stepper motor won't move at all .
What is connected to pins 1 and 15 of the L298?
And when you answer "nothing", I'll tell you to ask your mother to spank you red and blue ;D
Then, standing up, you connect the sense resistors, if you want to use the chopper current limiter, or connect the pins (a and 15) directly to ground, if you don't want the current limiter to keep motor and driver in a good shape.


Before I use L297+L298N circuit. I had tired on L293D motor driver.
It can drive my stepper motor but I dunno how to change the direction on the programming code
(Project_Designer show on Coil A, B, C, D, Enable, and half/Full step. How to make it move in CW and CCW ? )
If CW is eg. A, B, C, D, then CCW is the reverse/opposite (D, C, B, A. in this example).
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 15, 2012, 06:47:21 PM
[...] And you can still repair store-bought drivers by swapping out damaged components. :P
If you have the schematics (unless it's a simple circuits), the ability to troubleshoot other peoples circuit designs and are able to get the correct replacements (which may be hard in some instances - I've had to completely redesign circuits less than 5 years old as components went out of production). And that is assuming it ain't glass-epoxy-potted.


I only build my own stuff when no one is selling what I need, or what they sell is too expensive or lacks features.
Well, with your arguments, you really should be buying ready built robots, rather than getting filthy hands :P ;)
And I'm sure you could hire somebody to play with them for next to nothing, then it's completely out of your hair ;D


hmmmmm I don't understand the point of the relay if there is a MOSFET doing the switching . . . if I were to do it using individual components, I would use four MOSFETs arranged as an H-bridge, with a diode on each MOSFET to protect it. I would only use relays if the MOSFETs couldn't handle my required voltage/current.
That's because I consider that, what's put on the web, should be usable for people all over the world, as far as it's humanly possible, rather than just be made for middle class incomes and up (or people who builds on tax payers money ;))

I use 4 x MOSFETs myself, most of the time (particularly when currents are high), but when I design for the web, I try (most of the time, at least) to put myself in the place of third world people and kids with very low budgets.

To make a proper MOSFET H, you need 2 identical sets of complementary MOSFETs and that is hard to find for free, but a single MOSFET and a DPDT-relay is easy to pick up for free - both can be found in lots of defunct media electronics (TVs/radios/etc.)

In most applications, the relay+MOSFET will perform just as well as (in some instances even better than) the 4xMOSFET.
Title: Re: Need Help and suggestion in electronics components
Post by: strif on March 15, 2012, 11:04:45 PM
Hi,

I spend 2 days on the L297 L298 stepper motor drive .
signal pin out from Axon _  step_clock, half/Full step, direction, enable and reset.
I get the voltage output from A B C D of L298.
but the voltage won't have much changing ( 4.5 + - 0.3 volt )
my stepper motor won't move at all .
What is connected to pins 1 and 15 of the L298?
And when you answer "nothing", I'll tell you to ask your mother to spank you red and blue ;D
Then, standing up, you connect the sense resistors, if you want to use the chopper current limiter, or connect the pins (a and 15) directly to ground, if you don't want the current limiter to keep motor and driver in a good shape.


Before I use L297+L298N circuit. I had tired on L293D motor driver.
It can drive my stepper motor but I dunno how to change the direction on the programming code
(Project_Designer show on Coil A, B, C, D, Enable, and half/Full step. How to make it move in CW and CCW ? )
If CW is eg. A, B, C, D, then CCW is the reverse/opposite (D, C, B, A. in this example).


Thanks Soeren,

I connect pin 1 and 15 to the L297 follow this diagram
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000063.pdf (http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000063.pdf)


I means control the L293D change the direction of my stepper motor in software.

Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 21, 2012, 08:02:47 PM
Hi,

I connect pin 1 and 15 to the L297 follow this diagram
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000063.pdf (http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000063.pdf)
OK, what value was your sense resistors?


I means control the L293D change the direction of my stepper motor in software.
Yes, I got that. You do it as I told you, by reversing the order of the coil energizing.
Title: Re: Need Help and suggestion in electronics components
Post by: Admin on March 22, 2012, 05:51:31 AM
I only build my own stuff when no one is selling what I need, or what they sell is too expensive or lacks features.
Well, with your arguments, you really should be buying ready built robots, rather than getting filthy hands :P ;)
And I'm sure you could hire somebody to play with them for next to nothing, then it's completely out of your hair ;D
My argument: if you want to build a robot, buy the microcontroller. If you want to build a microcontroller, buy the capacitors and resistors. If you want to make a capacitor, buy electrolytic chemicals to make it. If you want to make electrolytic chemicals, break out your chemistry set. Point being: if you want to make a robot, don't break out your chemistry set. The 'make a robot from scratch' concept is a myth - one must start somewhere, and avoid distractions which take time away from your final goal.


Quote
hmmmmm I don't understand the point of the relay if there is a MOSFET doing the switching . . . if I were to do it using individual components, I would use four MOSFETs arranged as an H-bridge, with a diode on each MOSFET to protect it. I would only use relays if the MOSFETs couldn't handle my required voltage/current.
That's because I consider that, what's put on the web, should be usable for people all over the world, as far as it's humanly possible, rather than just be made for middle class incomes and up (or people who builds on tax payers money ;))
I consider time to have financial value. Students seem to have no issue spending an extra 5 hours to save $10  :P

That comes down to earning $2/hour . . . :o

MOSFETS today are very cheap, like $1 each. The savings isn't that big compared to using free relays scrapped from old electronics . . .
Title: Re: Need Help and suggestion in electronics components
Post by: strif on March 22, 2012, 05:35:51 PM
Hi,

I connect pin 1 and 15 to the L297 follow this diagram
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000063.pdf (http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000063.pdf)
OK, what value was your sense resistors?



I can't get 0.5Ohm , I replace it as 10 Ohm  :P
Title: Re: Need Help and suggestion in electronics components
Post by: Soeren on March 22, 2012, 08:10:06 PM
Hi,

I can't get 0.5Ohm , I replace it as 10 Ohm  :P
No wonder it didn't work then! It's close to not connecting the sense pins at all.

If you set the Vref for eg. 1V, the motors would see a current of 100mA.
And if you calculated the current for eg. 1A, the sense resistors would "steal" 10V of the available motor voltage.

Had you just connected the pins directly to ground instead, the motor would have run (without current limiting though).