Maker Pro
Maker Pro

Fast, high current switching

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
You're right, that mosfet only has a 10V VGS(max)

I'd actually recommend you connect the gate directly to the arduino output (via that 270 ohm resistor). I'm not sure what the motivation was to suggest you use an optocoupler. If you do this, you don't need D3, but keep R3. You can reduce R5 to 180 ohms.

As you have the circuit right now, the 270 ohm resistor is in the wrong place. It needs to be before D3, and preferably also before R3 (that means if R5 fails, the mosfet will turn off).

Your power supply shows a choke in series with a zener diode. That will cause both components to fail. You need a resistor in series with the inductor. I'd recommend maybe 270 ohms (1W) and use a 1W zener.

I would also recommend you consider using the internal clock for the ATMega328. It only runs at 8MHz, and isn't as accurate as a crystal, but it reduces the component count considerably. You need another bootloader for this, but it should be pretty easy to find. (If not, ask me and I'll dig it up for you)

It will be VERY important that the ground for the arduino is very well bonded to the source of the mosfet. Don't have them widely separated or connected to the car (bike, whatever) chassis at different points or you'll be sorry....
 
I made the suggested changes on the right side of my circuit (after the Arduino).

Fuel-Pump-snip1.jpg


I believe those are the proper changes there.

I am a little confused by the power supply though. I was following this diagram for the power supply:

PowerSupply.JPG


In the thread I linked earlier (http://forum.arduino.cc/index.php?PHPSESSID=bpe2d44k3g290ra9mdrprcdos6&topic=7497.msg59812#msg59812) in which someone else used this circuit to power a car project he stated that you can remove everything to the right of C3 (including C3). Is that wrong, or do I just have the wrong component for L1?

In addition to that I was following this guide here http://arduino.cc/en/Tutorial/ArduinoToBreadboard to setup the standalone ATMega. It does have an explanation below on how to handle doing it with minimal components (using the internal 8MHz clock). I presume that would still work?

To address the final issue with the ground. I planned to have all of this on one board. The only inputs coming into the circuit would be the switched 12v (ignition) and ground. Then I will have an output for the solenoid. The Arduino and the mosfet will both be grounded on the same board within inches of each other.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Your arduino wants 5V, so keep everything -- with some changes specified below.

That circuit is fine, however I would still add a resistor in series with L1 that will drop about 2 volts or so a the typical maximum current your circuit will draw (that's in total, so it includes the voltage regulator itself. Let's say that's 50mA. Your series resistor should be 2/0.05 = 80 ohms (call it 82 ohms to round it to the nearest value). This resistor will help protect L1 and D2 in the case of a sustained high voltage or a reversed voltage.

I'd probably add an extra output capacitance of 10uF to 100uF to the regulator as well.

Your driving of the mosfet is fine.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Oh, I forgot the arduino question. Yep, that's one of the major pages I used when learning how to get the ATMega328 working without a crystal. I think I have a few other links to places that filled in some more details. If you have problems, please ask and I'll try to dig them up.
 
Ok, that all makes sense now. I will keep the entire power circuit (including the 7805) and will add the 82 ohm resister along with an additional capacitor to the output. Should I be looking at electrolytic vs ceramic for this additional capacitor?
 
So here is what I have come up with:



I have one question regarding the minimal Arduino setup (minus the crystal and extra components). Do I lose any functionality by removing these components?
 
The internal clock will be less accurate than the crystal, but unless you need precise timing of your solenoid pulses that won't matter.

Is the Arduino doing anything other than supplying a signal to the solenoid? Is it varying the frequency based on certain inputs? Is it providing outputs to anything else?

My only other suggestion would be to use an automotive-grade LDO regulator instead of a 7805, but it isn't super critical, especially with the filtering you're already including. Load dumps/spikes could kill a 7805 if they make it past the filtering components.
 
Well the plan is to have a set frequency of pulses. Probably every 300ms or so. I have not come up with the exact frequency yet. In the future I might want to be able to vary the pulse rate either by RPM or just a user set value.

To answer your question though yes, this is only going to output a signal to the solenoid.

I mean we are talking about a $0.36 crystal (http://www.digikey.com/product-detail/en/ATS16B/CTX1085-ND/2640031) and 2x $0.03 capactors (http://www.digikey.com/product-detail/en/K220J15C0GF5TH5/BC1034TR-ND/286488). If it could potentially improve performance then it might just be worth including right?

Also I am thinking if the spikes make it past the existing filtering I might have more problems than just the regulator. I will look at the price difference between the two (7805 vs auto grade) and if the price isn't much different I will go with the auto grade one.
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
In this instance the main issue is ruggedness, not cost. The crystal is a relatively fragile device (it is essentially mechanical) and removing it removes a potential source of failure. If you have some sort of feedback (fuel pressure?) then a wide variance in clock speed would be of little concern. Even without a sensor, a variation of +/- 10% due to variation in clock speed is also unlikely to be significant (in this case the variation in fuel demand would be responsible for more variation that from the clock speed variation).
 
It seems like every time you post a reply, Steve, things start to just make sense haha. I never even thought about the crystal being a sensitive component in the circuit. It makes perfect sense. I will eliminate it from the circuit.
 
I am almost certain no one wants to go through my component list here and verify that I have the proper items for my schematic above (minus the clock components and reset resistor for the ATMEGA clock), but just in case someone is bored and has the time I will post it here anyway.

---- Resistors ----
1x 82 ohm 1Watt ($0.37) - http://www.digikey.com/product-detail/en/PR01000108209JR500/PPC82W-1CT-ND/597302
1x 180 ohm ($0.08) - http://www.digikey.com/product-detail/en/CF14JT180R/CF14JT180RCT-ND/1830332
1x 10k ohm ($0.08) - http://www.digikey.com/product-detail/en/CF14JT10K0/CF14JT10K0CT-ND/1830374
1x 470 ohm ($0.08) - http://www.digikey.com/product-detail/en/CF14JT470R/CF14JT470RCT-ND/1830342

---- Capacitors Ceramic ----
1x 0.33µF($0.32) - http://www.digikey.com/product-detail/en/FK24X7R1H334K/445-5263-ND/2256743
2x 0.1µF ($0.29) - http://www.digikey.com/product-detail/en/FK18X7R1H104K/445-5303-ND/2256783

---- Capacitors Electrolytic ----
1x 220µF ($0.30) - http://www.digikey.com/product-detail/en/ECA-1CHG221/P5530-ND/245129
1x 10µF ($0.20) - http://www.digikey.com/product-detail/en/ECA-1HM100/P5178-ND/245037

---- Diode Zener ----
1x 15v 1W ($0.23) - http://www.digikey.com/product-detail/en/1N4744A/1N4744A-ND/977267

---- Diodes ----
2x 200v 1A ($0.11) - http://www.digikey.com/product-detail/en/1N4003-TP/1N4003-TPMSCT-ND/773690

---- Inductor ----
1x 40µH 2A ($1.69) - http://www.digikey.com/product-detail/en/B82111EC23/495-5591-1-ND/4245907

---- Microcontroller ATMEGA328 ----
1x 8bit ($3.41) - http://www.digikey.com/product-detail/en/ATMEGA328-PU/ATMEGA328-PU-ND/2271026

---- Mosfet ----
1x IRLZ24 ($1.22) - http://www.digikey.com/product-detail/en/IRLZ24PBF/IRLZ24PBF-ND/811767

---- Voltage Regulator ----
1x 7805 ($0.46) - http://www.digikey.com/product-detail/en/NCP7805TG/NCP7805TGOS-ND/2271529

If someone does go through this I just want to say Thank You in advance.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
The only issues are that the ATMega chip won't have a bootloader (can you program that?) and I'd go for a 35V 220uF capacitor.

In retrospect the 15V zener might be more safely changed to 18V or so. Probably not a huge issue, but all you want to do is keep the input voltage to the regulator under about 35V.

Everything else looks fine.
 
So I went ahead and changed out the components you mentioned above. Here is what I have now:


I guess I will order all this up tonight and get started later this week. Once this is complete I do intend on getting boards made, so I guess that will be my next adventure.

Thanks again Steve!!
 
So I am knee deep into this. The switching circuit works great. The mosfet doesn't even care. It doesn't get warm or anything. I have only run it for a minute at the most though so time will tell on that part. I have been able to burn the bootloader to the ATMEGA. It was a little rough since I eliminated the external clock. I was also able to create a quick dirty program to run the pump around every 200ms.

The next issue I face is this. Everything I have is all well and good, but I cannot allow the pump to run when the ignition is on but the motor isn't running. So what I plan to do is read the signal from the stator pickup wire. This wire read a voltage when the motor is running. It is often used to measure RPM. From what I have read it outputs a .2 - .5v AC. I have also read that the ATMEGA does not do well with AC.

I have read a few threads about people using an op-amp to handle this. My main thing is this. I do not care about the voltage per-se. I just care that it exists. So I do not need to read the negative voltage I just care that anything is happening. If the motor is not running there is no output on the wire. If the motor is running I should see up to .5v AC.

So the question is this. Should I be creating some sort of rectifier before I attempt to read this voltage in? Or am I able to just read the positive portion of the AC to determine if the motor is running?

Thanks once again to everyone who has helped me thus far.
 
Top