Arduino freezes in real world test

So i made a fuel controller for motorcar that works perfectly fine on the bench, even left to run overnight. The moment it goes into the car it begins to randomly lock up, hangs and without watchdog timer it would continue to do so.

I'm thinking I haven't prepared my input pins properly enough for this harsh environment.
I currently have 2 zeners in reverse mode to GND for those input pins.

Any pointers? Here is my circuit

Thanks for the schematic, it's helpful. But in this circumstance, a photo of the implementation would be equally or more useful.

Thanks. Edit ^^

So i disconnected the trace that leads to the MAF signal and so far the arduino didn't hang. So i am sure it's something coming in on that pin that's causing the issue.

donperry:
Thanks. Edit ^^

No, no, no. I mean a photo of the actual hardware.

lol, here goes

Thanks. That's encouraging. The interconnections with the rest of the world will be the thing to focus on, as you had trouble when in the car. Can you show me a photo "in situ"?

Also, I'm curious about the power supply chain. Can you describe how the power is distributed, and what the zeners do?

Oh not right now, but i have regular cat5 cables connected to the car's ECU.
If the car's ignition is on (Dashboard lighted up) it runs and runs but once it has started up it hangs the arduino whenever it chooses to. I had watchdog timer on it but thats just a bandaid.

OK. Power comes in through the ECU Jack. IT is also sent through the Trunk Jack as a remote power for a relay around the trunk. No pump is connected though.

the Power is also sent to an isolated power supply module (In 36V max -> 5V 3A stable). I have an 18V zener up the top part of the diagram to "protect" that isolated power supply module. Not sure what protection it would give but maybe good for redundancy.

On the input pins the Zener 5.1 is supposed to do some clamping for me.

Ok, thanks. Protection from EMI is a classic problem. There have been similar threads recently, auto applications. These attract some good expertise, but please allow for the time difference as forum members live all over the world.

Thanks. Really need to get this going, only one roadblock and it's this :slight_smile:

OK, the problem is in the wiring, and conditioning on all the input pins.

Basically, what you want is to have all power, signal and control lines paired, with grounds only connected together on the Arduino itself.

This may be difficult as you are obtaining signals from sensors already mounted in the car and frequently connected to different "grounds".

You may need to consider optical isolation of as many inputs (and outputs) as possible, and serious conditioning on your power input including a choke and multiple capacitors. The power supply circuitry needs to be laid out as "tight" as possible.

There are a lot of factors to consider; this is a very complex design field.

OK one more thing, guys, when compiling my sketch it says "Memory low, stability issues may occur"
or something like that. Do you think this has anything to do with it knowing it worked well on the bench?

Hi,
The two diodes you have across the relay coil, 1N4001, are not zener diodes and don't need to be zeners
The problem is you only need one diode, that is fitted so it is reverse biased when the coil is active, the second diode in your schematic is defeating the purpose of the other.

Where ever you have two diodes in series, anode to anode, you only need one, again the one that is going to be reverse biased when that circuit is active. at the moment they protect nothing.

Your FETs should have the 4k7 resistors between the gate and source, not the arduino side of the gate resistor and source.
What type are the FETs, are they logic level MOSFETs?
Where are you getting the 12V supply for your injector from, this can produce a very inductive current/voltage combination.
There are specific MOSFET modules designed to control injectors because of the type of load they are.

Tom.... :slight_smile:
PS, What is the engine/car you are connecting this to and how many injectors are you switching with the one FET?

TomGeorge:
Your FETs should have the 4k7 resistors between the gate and source, not the Arduino side of the gate resistor and source.

No, the Arduino side of the gate resistor is exactly where the pull-down resistor should be.

Have a little think about it.

TomGeorge:
Hi,
The two diodes you have across the relay coil, 1N4001, are not zener diodes and don't need to be zeners
The problem is you only need one diode, that is fitted so it is reverse biased when the coil is active, the second diode in your schematic is defeating the purpose of the other.

Where ever you have two diodes in series, anode to anode, you only need one, again the one that is going to be reverse biased when that circuit is active. at the moment they protect nothing.

They are zeners, even though the symbol doesn't say so on the diagram, that was a diagram error. In implementation they are zeners. I followed this recommendation to do that. Tell me what you think about it.

http://www.electronics-tutorials.ws/transistor/tran_7.html

Your FETs should have the 4k7 resistors between the gate and source, not the arduino side of the gate resistor and source.

I'm not sure the other way would be voltage divider. Or is it?

What type are the FETs, are they logic level MOSFETs?
[/

Yes, some surface mount 310 something something, can't find the part number at this time.

Where are you getting the 12V supply for your injector from, this can produce a very inductive current/voltage combination.
There are specific MOSFET modules designed to control injectors because of the type of load they are.

From the car's power

Tom.... :slight_smile:
PS, What is the engine/car you are connecting this to and how many injectors are you switching with the one FET?

Subaru legacy GT,
I'm pulsing one injector, but a secondary smaller one is also in the mix.

Hi,

Note; where R2 is, it should be 10K not 4k7, it is to make sure that the gate is never open circuit. In your circuit your 4k7 is between TLL output and source. Rg is about 470R or 220R.

The snubbers are for a motor not a solenoid. in your case, different sort of load.
See this section of your link.
Flywheel.jpg

Tom.... :slight_smile:

Hi,
How much current does your injector pass when switched ON?
I mean't with respect to 12V, are you supplying the 12V supply to the injector from your board or direct from the battery via the ignition switch.
The reason is, injectors are highlyinductive, they need a decent supply to perform correctly and if supply wiring is to light in gauge then you will not get any decent performance from it, copper track width on your PCB has to be wider for the amount of current it will be conducting.
If you can look at the inside of an ECU you will see how they layout the components and power tracks. MOSFETs are mounted to heatsinks and at the edge of the PCB next to the plug/socket that connects to the injector.

You are using SMD MOSFETs, what are they rated at, and is it sufficient for your injector.
A good earth plane and connection is also important to prevent earth loops during injector actuation.

Tom.... :slight_smile:
PS. Passing injector current through those RJ connectors is far from ideal, I must say its a nice attempt at an add-on injector system, just needs some hardware refinement.

thanks for continuing the discussion, Tom.

I have that concern too, but it seems they are handling just well. The FET seems to be enough for the solenoid, as it's a 15A FET.

If i'm to build it over I'd use wider tracks for the power lines. It gets it's 12V from the battery via a relay on ignition, also fused at the battery and at the relay.

I'm wondering if the memory issue could be causing it to freeze, even though it doesn't freeze on the bench.

donperry:
I'm wondering if the memory issue could be causing it to freeze, even though it doesn't freeze on the bench.

Post your code, in code tags, and we'll have a look.