10k is too high. 50-100 ohms would probably be fine, MCUs just don't like driving into dead shorts (which the gate of a discharged mosfet is, at least initially).
Also, do you have the necessary freewheel diodes to prevent back-EMF from wreaking havoc on your controller?
Have you looked at the requirement for Vgs vs Id (Figure 3 in you first datasheet)?
That nonsense earlier in the datasheet about Vgs less than 4.0V only applies when the load is a mere 250 MICROamps!
At a minimum, you need a good solid 5V on the gate of the lower MOSFET.
It's pretty had to provide any kind of help without a schematic. We're just guessing...
Add a low value resistor (~100ohms) between the AVR outputs and Q3+Q4. This should limit the current during turn on/off and protect the pins from voltage transients.
But more important: Add a large value (>1000uF), low ESR electrolytic capacitor between +12V and GND!
Without any capacitor you will get large voltage spikes whenever you toggle the outputs.
I would use a dedicated mosfet driver, because increasing the gate voltage reduces the On resistance and therefore reduces the dissipated power -> smaller heatsink possible.
The n-channel mosfet should be designed for logic level switching tho? So said my teacher at least.
But resistors should save the arduino is what i hear? (My school buys the genuine arduinoes, and we are getting expensive hahah)
10k is too high. 50-100 ohms would probably be fine, MCUs just don't like driving into dead shorts (which the gate of a discharged mosfet is, at least initially).
Also, do you have the necessary freewheel diodes to prevent back-EMF from wreaking havoc on your controller?
Also, do you have the necessary freewheel diodes to prevent back-EMF from wreaking havoc on your controller?
emphasis is mine - do you have diodes in place to allow current to continuously flow through the motor?
Add a low value resistor (~100ohms) between the AVR outputs and Q3+Q4. This should limit the current during turn on/off and protect the pins from voltage transients.
But more important: Add a large value (>1000uF), low ESR electrolytic capacitor between +12V and GND!
Without any capacitor you will get large voltage spikes whenever you toggle the outputs.
I would use a dedicated mosfet driver, because increasing the gate voltage reduces the On resistance and therefore reduces the dissipated power -> smaller heatsink possible.
I would use an optoisolator and external protective diodes like everyone says.
http://www.next.gr/uploads/5/DRIVERMOSFET.jpg
The threshold voltage is the voltage when the part turns off, not when it is usefully conducting! If you don't open the transistor completely, it will be getting very hot very quickly and likely blow up with larger loads. Your FETs were "working" because IRF540n can pass 10A even at its threshold voltage, which was likely sufficient for the motor you had. But that is far from a good design.
A decent rule of thumb is you need to drive the gate to at least 2x Vgs(th). The IRF540n has a nominal Vgs(th) of around 3V, max of 4V. This means you should be driving the gate with at least 8V to guarantee it'll work well, but you might be able to go lower if you hand-pick a device out of a batch that has a threshold closer to nominal or min.