PDA

View Full Version : Microcontroller resets on motor operations.



danny99
01-09-2012, 04:37 PM
Hi

I am trying to make circuit to control four, 24VDC 3A motor in both directions, i am using DPDT relay driven by ULN2803.
problem is whenever i switch the direction, microcontroller resets. Uptill now i have damaged two arduino boards.
CB210 keeps resetting when ever motor operate forward or backward, Circuit is working fine but I want to get rid of resetting problem 88371 of CB210.
Any suggestion will be helpful.

Thank you

Mike2545
01-09-2012, 04:49 PM
I would check your power supply, see if you have enough amperage to operate the motors and the microcontroller.

erco
01-09-2012, 04:56 PM
Seperate power supplies for the micro & motors. And flyback diodes on your relay coils. And some caps on your micro power supply, 100 uF filter and 1 nF decoupling.

Any time a motor suddenly reverses, it's a dead short for a while and sucks current with wild abandon, which drops the supply voltage. You have 4 motors and 4 relays that require a lot of current. Either that voltage drop or the resulting noise on the power supply line is the probable cause of your micro resetting.

erco
01-09-2012, 05:26 PM
One other thought. You have an external voltage regulator taking 24V down to 9V to input to your micro, which presumably has its own onboard voltage regulator to take that down to 5V (or 3.3, whatever). You could try using a 12 or 15V regulator (the largest voltage your board will accept) with a nice big filter capacitor. That would give you a few more volts overhead and a small energy reserve which might be able to power your micro while the motors are reversing.

Mike2545 is right, in any case. You probably need a whopper of a power supply. Try two BIG 12V gel cells (7AH or bigger) in series instead of a wall wart.

GordonMcComb
01-09-2012, 05:31 PM
It sounds like you have two problems, though related. If this circuit is damaging your Arduinos there's something wrong that needs addressing. Your illustration shows flybacks on the relay coils, and the ULN2803 also has them internally. You should put this up under a scope to see what type of transients you're getting when the motors reverse directions. I can only imagine they're much larger than the filtering caps can handle.

Your Arduino can operate on its own supply, from a 9-volt battery as a test. It's hard to see from your drawing what you're connecting the 9V supply to. It should be through the barrel connector, which gives you the additional protection of a reverse polarity diode. Don't connect it to just the Vin input on the bottom of the Arduino.

Place dropping resistors between the Arduino and the ULN2803. That'll at least limit current pulled from the driver chip should it blow because of excess demand on the other side.

And, as Erco says, dropping 24V to 9V through a linear regulator is wasting tons of energy in the form of heat. Your regulators won't last long, especially if they're not on heat sinks.

-- Gordon

Phil Pilgrim (PhiPi)
01-09-2012, 05:34 PM
How and where are your logic ground and motor/relay return connected?

-Phil

kwinn
01-10-2012, 02:09 AM
First try putting a diode between the 24V power supply and the left most (47uF?) capacitor in your diagram. That keeps the capacitor from discharging back to the motors.

jmg
01-10-2012, 06:29 AM
Wow, I see you have relays flipping motor direction in a very brutal way.
Motors work as generators until they stop spinning, so when you flip direction, you are going to dump a > -20V supply, across your 24V,

Try a separate 24V supply, with some current limiting to ease the flip-over.
Relays are also a known reset scourge, as they can give sub-ns edges - if you must use them, separate the power supplies, and move them as far from sensitive electronics as is practical.
There are Motor Bridge ICs from companies Like Allegro ?

danny99
01-10-2012, 02:09 PM
Thanks Mike, Erco, Gordon, Phill, jmg and kwinn for your advices and comments.

To clarify more I am updating the schematic diagram plus i am adding more information related to the project.

I am designing a small window actuator control panel controlling 4 window actuator. HUWIN Linear Actuator

I am powering they system using MeanWell switch mode power supply AD155B - 5A, I have a linear regulator 7809 to power my CB210,

I am using DPDT relays to switch the directions of the window actuators, when I use separate supplies system tends to be stable but if I try to use same supplies to power motors and cb210, resetting problems occurs.

Unfortunately design requirements is to have one supply for everything.

Thank U , any help to sort the problem will be appreciated.

88414

T Chap
01-10-2012, 03:21 PM
How is one relay allowing the motor to
a. move direction A
b. move direction B
c. STOP

Does the motor have a built in limit switch that kills power so you do not need a power off mode on the relay?


You should have a large cap both in front of the 7809 and after it. ie.2200uf on the input (rated at >25V), similar on the output. This will mask any momentary drop out.

I would recommend using P and N channel mosfets and an H bridge mosfet driver. This has some benefits over relays:
1. Possible relay failure over time ( mechanical failure )
2. With mosfets, you can use PWM to ramp the motors on and avoid hard starts
3. Easier current limiting to the motors with an Hbridge driver.

If you are damaging your processor, then you may need to further isolate the IC with a buffer. A cheap simple buffer you may have on hand would be a 4050 ( or two 4049 gates in series ). Drive the 2003 from a buffer.

Mike Green
01-10-2012, 03:31 PM
You still have to protect the microcontroller from the voltage surges caused by suddenly reversing the motors. The schematic doesn't show the physical layout and the way you connect the microcontroller to the power supply may be contributing to the problem. There needs to be a separate power lead and ground lead from the microcontroller to the power supply where the motor power leads from each of the motors connects. You should also have additional filtering on the 7809 regulator. Don't be surprised if your relays wear out quickly from arcing from the rapid reversal of the high current. This (http://en.wikipedia.org/wiki/Snubber) article on "snubbers" is a starting point for trying to prevent this. An RC network or the back-to-back Zener diodes mentioned could be a starting point. You may also be transiently shorting out the power supply with the high peak currents from suddenly reversing the motors. You may need to add extra relays to turn off the motors briefly as they're reversed (turn off - reverse connections - turn on).

danny99
01-10-2012, 03:43 PM
Few things i have came accross that might help to reduce reduce voltage spike.

As DPDT was sparking alot, i have used extra SPST relay to switch over when DPDT relay contacts are in place, making sure contacts doesnt get shorted.

88416

Will see if it works.

if not I am thinking of putting power mosfet in place of SPST any suggesstions. ?


thank u .

danny99
01-10-2012, 03:54 PM
I agree with you, thanks for the help. System has improved i have connected the supply using following supply, it has improved the voltage supply line,
I am going to properly filter the supplies and will have another go if its reliable enough to go into the final design.

Now Snubber circuit, does anyone have any information or article to help me build a snubber for the bi directional motor control.

Thank u for your help mark.
http://www.williamson-labs.com/images/7805-protected.gif

Mike Green
01-10-2012, 03:57 PM
You need at least two SPST relays, possibly one for each motor, to satisfy your own criteria (only two motors on at a time). How about using H-Bridges after all instead of all the relays and the Darlington array? Look at this (http://en.wikipedia.org/wiki/H_bridge) and that (http://www.bobblick.com/techref/projects/hbridge/hbridge.html). Note that, for on/off/reversing, a pair of relays (DPDT & SPST) works fine. You do need snubbers to prevent the arcing and prevent these voltage / power surges from propagating back to the power source (and any other circuitry).

danny99
01-10-2012, 04:41 PM
You need at least two SPST relays, possibly one for each motor, to satisfy your own criteria (only two motors on at a time). How about using H-Bridges after all instead of all the relays and the Darlington array? Look at this (http://en.wikipedia.org/wiki/H_bridge) and that (http://www.bobblick.com/techref/projects/hbridge/hbridge.html). Note that, for on/off/reversing, a pair of relays (DPDT & SPST) works fine. You do need snubbers to prevent the arcing and prevent these voltage / power surges from propagating back to the power source (and any other circuitry).

I think i will try MOSFET H BRIDGE using opto isolator.

do u have information on snubber circuit, struggling to find some ideas to protect relays.

thank u

Mike Green
01-10-2012, 05:19 PM
If you're using an SPST relay on each motor (preferably in the +24V lead, not the ground lead), you can use a reverse connected diode just like for the relays. This would be between the SPST relay contacts and the DPDT relay, between power and ground. You can also put a capacitor across the motor windings, something on the order of 0.1uF to 0.47uF with at least a 100V rating. The idea is that you turn off the power using the SPST relay, the diode absorbs the turn-off spikes, then (after a short pause ... a few milliseconds), you change the DPDT relay setting, then turn on the power with the SPST relay.

danny99
01-11-2012, 04:44 PM
thanks for the suggestion,

please have a look on the schematic. due to resolution picture are not coming clear from software. sorry
88451
88450s

Mike Green
01-11-2012, 06:34 PM
The new diode anodes have to be connected to ground. Remember that the DPDT relays don't change position until the back-EMF has a chance to die down (after turning off the power with the SPST relays). There should be no arcing at the DPDT contacts and these new diodes help prevent arcing at the SPST relay contacts. You will also need capacitors across the motor windings as I mentioned in post #16.

danny99
01-13-2012, 11:33 AM
88536

I am using an H bridge mosfet motor driver, when i connect manually the ground pins to ground circuit works fine.
but when micro is used to control motor via opto coupler motor some time work as desire and some time doesnt responds.
could any one help me. why mosfet are not working properly with optocoupler.
Iam using PC817 optocoupler.

thank u

T Chap
01-13-2012, 02:14 PM
Hi. I am curious where you go that schematic? That schematic shows that the opto would turn off both the high side and low side at the same time on one side of the motor, and have both the high side and low side turned on on the other side of the motor. That shorts 24 almost to GND. Is that exactly what you have built?

The mosfet configuration should allow the high side to be ON on one side of the motor only when the LOW side is ON on the other side, and vice versa. Also, I have not used those mosfets but in some cases, the voltage to the gate of the high side mosfet needs to be some amount higher that the 24v. This is often achieved by a mosfet driver IC.

kwinn
01-13-2012, 07:25 PM
@T Chap,

Unless I am mistaken one transistor is a P channel and the other is an N channel so both will not be on at the same time except when switching. Unfortunately that may cause a large current spike while switching, particularly if the optoisolators are not high speed units. Better to use an H bridge driver for this.

T Chap
01-13-2012, 07:43 PM
Is 10k enough to turn on the low side?

kwinn
01-13-2012, 07:47 PM
danny99, I would suggest the following:

Power the micro from the 24V supply using a diode and large capacitor as in post 13.

Use a switching regulator instead of the 7805.

Use an H bridge driver to drive the transistors or a complete H bridge chip/module.

Allow time for the motors to stop before reversing direction.

Turn motors on one at a time and wait at least 100mSec before turning on the next motor.


The circuit in post 19 may work initially but the large spikes caused by both transistors being on during the transition period will eventually cause them to fail. An H bridge driver chip turns one transistor off before turning the other one on to avoid this problem.

danny99
01-16-2012, 03:31 PM
thanks Kewin, for the suggestion i will order some new components to drive as u said,
@tchap yes it does work, but optocoupler are not able to work correctly with them resulting so many burnout mosfets.

i will update the post with the final solutions soon

thanks all for the help.


danny99, I would suggest the following:

Power the micro from the 24V supply using a diode and large capacitor as in post 13.

Use a switching regulator instead of the 7805.

Use an H bridge driver to drive the transistors or a complete H bridge chip/module.

Allow time for the motors to stop before reversing direction.

Turn motors on one at a time and wait at least 100mSec before turning on the next motor.


The circuit in post 19 may work initially but the large spikes caused by both transistors being on during the transition period will eventually cause them to fail. An H bridge driver chip turns one transistor off before turning the other one on to avoid this problem.

T Chap
01-16-2012, 04:07 PM
If the opto is not fully turning on or off, then both mosfets could be partially on. If you are burning up parts, then you should look for where the problem is happening. For example, you could disconnect the gate to the PNP, then put a volt meter on the in to the opto, see what the voltages are for each state. If the opto is ON, the voltage should be close to 0V, when off it will be 24v. Post what the voltage is. You may need a smaller resistor controlling the opto to force the voltage closer to GND.

I never like concepts that switch both the PNP and NPN at the same time, because there is a potential for both to be on during the transition. There is also the potential for both mosfets to be partially on if the opto is not fully turning on(pulling the gate V to gnd). The other option is to independently control each gate with the Propeller, I would control it via a buffer(even as simple as a 4050 or 4049, not opto). But, the problem again with independent switching is that if there is a state where both can be on, things burn up. On boot up, when the pins are in input on the Prop, you would need to define the states of the gates with pullups or pulldowns until the Prop takes over. Then hope there is no case for a hangup on the Prop. That is why an Hbridge controller is best of all options. Choose an Hbridge driver based on voltages, amps required per motor. Then you can feed the controller direction and speed( DAC) straight off the Prop, and let the driver worry about the transitions. I spent a lot of time watching mosfets burn up to learn this the hard way. You can get this to work with the Prop alone, but it will take effort to make sure there is a dead time between transitions. A scope is best to watch the control lines to be sure that you are not overlapping gate controls. If you are wanting to use PWM, then you do not want to be switching both PNP and NPN off the same pin, that is like getting in car and slamming the gas down then slamming the brake, back and forth as fast as possible, this is assuming you have only one side of an Hbridge.

Beau Schwabe
01-16-2012, 04:45 PM
I suspect that the Opto is turning on just fine ... One thing I see as mentioned is that the 10k is not providing enough pull-up current to the NMOS transistors.

Another note: Unless you have adequate current to drive the gates, tying the NMOS and PMOS gates together like this can cause high current spikes... enough to reset a micro controller, this is why applying a brute force 'direct' connection will work, and it will fail when powered from the micro. Even if the NMOS and PMOS transistors are exactly matched ... i.e. complementary ... there is a certain amount of overlap during the transition from On to Off where BOTH transistors will be ON. This is due to the gate capacitance of the transistors. This is also why you see the gate drive split between an NMOS (low-side) and PMOS (high-side) driver. Other than supplying the correct gate voltage, high-side and low-side driver chips also introduce a small delay between turning one transistor OFF and turning the other transistor ON.

If the Opto is capable of delivering an adequate gate current (many times they are only a few milli-amps.), I would go ahead and leave the 10k resistors there, but I would also split the gates. This means putting 10k resistors on the NMOS transistors to ground as well as leaving the 10k resistord from the PMOS transistors to the supply voltage. This way all of the transistors are off during power-up and micro controller initialization. This also means that an Opto is connected, not only to the NMOS, but also to the PMOS transistors.

Another Note: the indicator LEDs that you have in series with the Opto might work with a 5V micro controller, but it will fail with a 3.3V micro controller... it's better to run your indicator lines from a separate parallel circuit rather than a series circuit.

T Chap
01-16-2012, 05:48 PM
One way to avoid part of the guesswork is to actually determine what the mosfets are doing without the motor connected. For example, remove the motor and disconnect the PNP from the NPN from each other. Set the pin to a state( high or low ), read the resistance on both mosfets, change the pin state again and read the resistance again. When the mosfet is open, it should read very high(meg ohms), when it is closed (and depending on gate drive factors), it should read very low ohms. In some cases a mosfet is already damaged and you are still testing, and things are not behaving logically, so it is a good idea to test the mosfets as you go to confirm that the circuit is acting like a switch, and not hanging around in some in-between state. In the beginning stages of learning mosfets, this practice of experimenting with 'seeing' and understanding the mosfet as a switch is valuable. If you consider that a mosfet is not necessarily full on or full off, but can be partially conducting, then you can better plan your control voltages.

Regarding using independent control of both the PNP and NPN with separate opto's, you cannot use a pullup or pulldown resistor on the input to the opto. But, you can insert a gate in front of the opto, and put a pullup or pulldown in front of the gate to serve the purpose of setting an initial boot up state for the gates until the Prop takes over.

danny99
01-25-2012, 10:17 AM
Hi all there,

thank you for your suggestions and comments. really kwin and tchap have very good knowledge on mosfets and electronics.
the scheme i m using was not good becos mosfet were not able driven properly by the opto n resulted all my mosfets burned in doing this test.

now i am trying to use relays again with a delay. Its working but i cannot address the spark ( arc ) in relays.

One spst is providing 24v supply line to 4 DPDT motor relays, when i have to switch the direction of the motor i break the circuit by opening SPST then give a delay and then switch DPDT motor relays.

this is not restting the micro now but, on scope i can see noise in supply plus spike in the supply lines on reversing the motors.

Regards

thank you .

kwinn
01-26-2012, 04:11 AM
You might try running each motor with two solid state zero crossing relays and diodes directly connected to the AC voltage. One relay allows the positive half cycle to run a motor in one direction, the negative half cycle runs it in the other direction.
Again, a short delay before reversing direction is recommended. Solid state zero crossing relays will avoid a lot of noise problems since they only turn power on or off when the AC voltage is crossing 0V.

frank freedman
01-26-2012, 05:20 AM
Hi all there,

thank you for your suggestions and comments. really kwin and tchap have very good knowledge on mosfets and electronics.
the scheme i m using was not good becos mosfet were not able driven properly by the opto n resulted all my mosfets burned in doing this test.

now i am trying to use relays again with a delay. Its working but i cannot address the spark ( arc ) in relays.

One spst is providing 24v supply line to 4 DPDT motor relays, when i have to switch the direction of the motor i break the circuit by opening SPST then give a delay and then switch DPDT motor relays.

this is not restting the micro now but, on scope i can see noise in supply plus spike in the supply lines on reversing the motors.

Regards

thank you .

Recommend RC snubber across the motor connections at the relay. Also, are you letting the motors stop prior to reversing them? If not, your going to have an additional time of high current. You also want to cure this arcing otherwise, you will have a relay contact weld shut bad news, the motor will not stop, or alternatively, the contact points will become charred and pitted resulting in a resistive or no contact at all. The worst of these being the resistive contact as it will heat up and eventually melt together of burn.

Frank


+

amps
01-17-2013, 04:34 AM
Dear sir,
I wanna ask you few question on above circuit. I tried with SPDT relay not with DPDT
1)Whether above circuit has been successed
2) The above circuit dont have back emf protection. SO whenever it changes direction we assume freewheeling diode will take back emf current. But some time it wil try to move lease gnd path so that why arduino might get damage
3) it dont have short circuit protection.
4) Assume that you connected linear actuator to relay. What will happen if all relay drive get turn on
5) assume that you checked status of pin @ programming , but @ arduino get power all pins will be high , You can test your code with powering arduino




Thanks Mike, Erco, Gordon, Phill, jmg and kwinn for your advices and comments.

To clarify more I am updating the schematic diagram plus i am adding more information related to the project.

I am designing a small window actuator control panel controlling 4 window actuator. HUWIN Linear Actuator

I am powering they system using MeanWell switch mode power supply AD155B - 5A, I have a linear regulator 7809 to power my CB210,

I am using DPDT relays to switch the directions of the window actuators, when I use separate supplies system tends to be stable but if I try to use same supplies to power motors and cb210, resetting problems occurs.

Unfortunately design requirements is to have one supply for everything.

Thank U , any help to sort the problem will be appreciated.

88414