Arduino resets

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello.

 

I've made a driver for ignition coils from Arduino Nano clone. Here's the schematics:

 

 

Just there is ignition coil instead of motor, just Proteus don't have a component for it. Input to MOSFET's gate is from Arduino digital port. The pin is driven high for 4 ms, then low. When it gets low, spark flashes. The pin is then kept low for some time (simulating different RPM of the real car engine), then everything is repeated. The schematics is exactly the same, I've found on the Internet here: http://christian.liljedahl.dk/gu....

 

Everything works OK, until I connect the real coil. Then Arduino works for a couple of seconds, and then either freezes, or resets. I've taken oscillograms from the MOSFET's drain:

Can this spike cause (somehow) arduino to reset? Gate oscillogram doesn't show any spikes. Here's the picture from the power supply (I use CPS3205):

 

 

We can see voltage drop from 13 to 10 volts each time coil is being charged, but Arduino is powered through on-board AMS1117 regulator, I guess it doesn't matter if it has 13 or 10V on the input?

 

So I have 2 questions:

1) What are possible reasons of unstable behavior and

2) How to avoid it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you have the spark plug connected to the ignition coil? 

 

The large back EMF spike from the ignition coil when the circuit opens needs a place to go, it may help to place a reverse biased diode across your coil input terminals and see if that helps. 

 

Jim

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The IRL540 has at least an avalanche rating for a single pulse and will limit the drain voltage to somewhere above  100V.

But with such fast & high voltage transients nearby it becomes increasingly hard to not let the Vcc of a lowy 5v uC get out of spec.

 

Just an AMS1117 and some decoupling caps are grossly inadequate in these conditions.

Think of heavy filtering of the power supply and carefully designed ground planes and a sealed metal box for the AVR.

Placement of wiring is also important, etc.

Every elecrical connection into and out of the box has to be given some brain waves and carefull design energy.

 

Tip:

Just last week I've been experimenting a bit with metal boxes for my uC circuits.

You can quite easily cut out a flat layout out of a soda can with a normal scissors and then fold it into a box.

Then you can put some staples through the aluminium to strengthen the corners.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

Last Edited: Thu. Sep 7, 2017 - 06:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or use an Altoids tin!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Do you have the spark plug connected to the ignition coil? 

Of course! Or else the coil will melt laugh

 

ki0bk wrote:
The large back EMF spike from the ignition coil when the circuit opens needs a place to go, it may help to place a reverse biased diode across your coil input terminals and see if that helps. 

You mean like that?

 

Paulvdh wrote:
The IRL540 has at least an avalanche rating for a single pulse and will limit the drain voltage to somewhere above  100V. But with such fast & high voltage transients nearby it becomes increasingly hard to not let the Vcc of a lowy 5v uC get out of spec.

Not sure that I've understood this... The input at the Arduino VIN pin never drops below 10V. Why should output from AMS1117 to the MCU get below 5V?

 

Paulvdh wrote:
Think of heavy filtering of the power supply and carefully designed ground planes and a sealed metal box for the AVR.

The power supply is filtered OK, I guess. It's a laboratory PSU, Gophert CPS-3205, it has quite good reputation. The voltage drop is caused by over-current protection, because at the initial time coil consumes 7-10 amps. What if I connect a car 12V battery in parallel to the PSU, can it help? I don't have a spare one, and don't want to buy if it is not necessary.

Wrapping MCU in metal shield has nothing to do with power, I guess. You think, that problems might be caused by EMF from the spark? But why then my laptop, my cheap oscilloscope (based on ARM MCUs) and my smartphone work correctly?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You probably want to use a device designed specifically for ignition systems. Your mosfet won't last too long.
Ignition systems are basically a flyback converter - you need to have the primary hit around 400V and clamp it so it 'pushes' the energy out the secondary. If you go to websites like megasquirt, you'll find examples that have a much getter chance of working reliably.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
You probably want to use a device designed specifically for ignition systems. Your mosfet won't last too long. Ignition systems are basically a flyback converter - you need to have the primary hit around 400V and clamp it so it 'pushes' the energy out the secondary. If you go to websites like megasquirt, you'll find examples that have a much getter chance of working reliably.

 

I'm not creating my own ignition. I'm making a coil tester, it should run from time to time for 5-10 seconds, in order to test a coil. So I think under such conditions mosfet would work enough.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your choice. If it fails, then you can't complain!
Another factoid you should be aware of is different coils will saturate at different pulse widths. Basically, you apply current, the current rises due to the coil's inductance and keeps rising until the core saturates. At this point the current increases significantly. So you might want to build in some hardware current limiting. This might be the reason your Arduino resets.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try replacing the spark plug with a 1M resistor and see if it still resets. 

 

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Your choice. If it fails, then you can't complain! Another factoid you should be aware of is different coils will saturate at different pulse widths. Basically, you apply current, the current rises due to the coil's inductance and keeps rising until the core saturates. At this point the current increases significantly. So you might want to build in some hardware current limiting. This might be the reason your Arduino resets.

That's I know. Actually, user can choose coil dwell time from 2.5 to 7 ms with 0.1 ms step. I've tried different dwell times, arduino keeps on resetting/freezing no matter what. What do you mean by hardware current limiting? My power supply already have a current limiting function.

 

DAFlippers wrote:
Try replacing the spark plug with a 1M resistor and see if it still resets.

It won't hurt the coil?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It will more likely hurt the resistor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Take a look at your schematic above, when the mosfet is on, many amps flow though your coil to ground, what happens if the ground connection is not very low R?

A voltage develops at the base of the FET, feeding back through R2 and R1 to the micro (through it's port protection diodes to VCC/GND)

Now, what happens when that back EMF pulse (negative) follows the same path?

You may need to isolate the high current ground path from the micro to prevent this ground shift (not sure the correct term for this, but some of our analog and RF gurus know what I mean).

 

Jim

 

edit: spelling

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just a couple of thoughts. I just managed to get a simulator working, and I had some odd problems along the way. I used some bipolars hooked up as darlingtons, which seemed to work OK. I was originally driving it with a 555, but whatever I did, they would either false trigger or actually blow up (quite violently). I ended up using an Eccles Jordan astable multivibrator made with 2n2222s. Must have been a noise immunity issue.

 

**Some thoughts -- no expertise implied**

Your circuit might be OK, the waveform looks about right. But, there are things that you could try.

  - Use an actual battery - garden tractor or automotive. They will keep the 12 v quite solid. (Auto batteries have a lot of stored energy -- be careful if you use one.

      - maybe power your arduino from your power supply.

 - Use a low value (1 ohm or thereabouts ) in series with the coil power lead. (These are sometimes used in actual ignitions in 'run')

 - Use a capacitor between the fet output and ground. Get one used with the point system on a garden tractor or the like. Shouldn't really be required, but I used one.

 - Try some of the noise immunity suggestions that others have made. You could have radiated noise getting into the reset line or other input causing your Arduino to quit.

 

Good Luck,

 

hj

 

 

 

-

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In addition to previous suggestions, consider an opto-isolator between the controller pin and the switching FET.  Then also use separate power supplies with separate ground paths for the coil and controller.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ccrause wrote:
In addition to previous suggestions, consider an opto-isolator between the controller pin and the switching FET.  Then also use separate power supplies with separate ground paths for the coil and controller.

 

It should be unnecessary to do such things. If the circuit is properly wired, it should work reliably. My suspicion is the ignition coil is saturating and dragging down the supply momentarily. The solution here would be:

a) use a current limiting circuit - better solution would be to use a Bosch coil driver module.

b) use a series diode and a large electrolytic capacitor for the Arduino supply. If the supply dips, the electro cap hopefully has enough charge to keep the Arduino happy. Around 1000uF would be a start.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Zhenek wrote:
Wrapping MCU in metal shield has nothing to do with power, I guess. You think, that problems might be caused by EMF from the spark? But why then my laptop, my cheap oscilloscope (based on ARM MCUs) and my smartphone work correctly?

 

Not only the EMF from the spark. The primary coil also has high dU/dt stuff going on.

Arduino nano suggests breadboard. I am also quite fond of my own gophert power supply, but the wires from the gophert to your breadboard (circuit) can pick up enough noise to wreack havoc on your circuit.

Laptop's have heavy filtering inside, metal / metallized case etc. Your scope Yaetech? has at least a ground plane and is connected only through relative high impedance (scope probe) to the circuit.

 

Look up the Avalanche rating of your FET. Make sure you understand why it is important.

 

 

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Zhenek wrote:

You mean like that?

 

Yeah.  Like that.  But keep in mind you want a FAST diode.  Your average garden-gnome diode 1N4001 might well not be fast enough
(or big enough).  See if you can rustle up a UF5401.  Note that simulators have a nasty habit of assuming perfect components (e.g. here, an infinitely fast diode).

 

Many commenters have worried about ground bounce, which is a major problem here too.  That's a wicked inductive flyback spike on your oscillographs.  The diode should clip that.

 

You need to pay attention to power as well as ground.  Where does the power for the Arduino come from?  Through a regulator?  Ha.  No.  Get a completely discrete power supply for the arduino, and don't connect them together any closer than the wall plug.  You will need a common ground somewhere - connect it very close to the power supply for the coil and very far away (a couple meters of thick wire would be nice) on the Arduino.

 

Note that power spikes much faster than your 'scope can measure can still reset the Arduino.  Unless you have a seriously magnificent (say, 5GHz(!)) scope...

 

A few big caps (10,000uF or more) might help on the Arduino power input side.  Overrate their voltage by about 2x or they might go bang too, given voltage spikes.  Yes, I know a 10,000uF @ 24V cap is a big thing.

 

Just some ideas.

 

S.

 

Edited to clarify technobabble.  S.

Last Edited: Tue. Sep 12, 2017 - 09:46 AM