My solenoid won't work.

I have an arduino starter kit and i’m on project 9(

My ingredients are (as described in my projects book that came with my Arduino kit)
-10 KILOHM Resistor
-DIODE 1N4007
-IRF520N Mosfet
-Standard 9V battery

My project works just fine with the motor. But when i try to connect my solenoid ( it doesn’t move at all.

My questions are:

  1. Is it that the amps of the battery are not enough for the solenoid?
  2. Should i put a smaller resistor (e.g. a 1KILOHM)?
  3. Why does the project requires a 10 KILOHM resistor in the first place?.

The thing is that when i connect my solenoid to the battery directly it works just fine.

Any ideas on how i could make the solenoid work?

A "standard 9V battery" is essentially useless for that type of circuitry. A 6xAA battery pack should work, but will not be able to activate the solenoid for long periods.

The 10K resistor is required for that type of button circuit, to force a LOW signal on the input pin when the button is not pressed.

You should also have a 220R to 1K resistor between the output pin and the gate of the MOSFET, to protect the output pin from overcurrent damage.

If you have a multimeter, measure the voltage across the battery and the voltage across the solenoid (when the solenoid is supposed to be activated). ...If you don't have a multimeter, get one if you want to be an electronics hobbyist! (And if cost is an issue, a cheap $20 meter is better than no meter.)

The solenoid takes a lot of current (for a little 9V battery) and I'm guessing that the 9V battery isn't putting-out 9V with the solenoid connected. And, maybe there is just-enough additional voltage drop across the MOSFET that the solenoid doesn't activate. Or, maybe you drained the battery... it's not going to last long with that kind of load... Have you tried connecting it directly to the solenoid again?

The solenoid is rated for 5V at 1.1 Amps. If you've studied Ohm's Law you know that if you apply 9V you're going to get about 2 Amps through the solenoid. It should activate, but it will overheat (but in reality, the 9V battery will probably die before you kill the solenoid).

3) Why does the project requires a 10 KILOHM resistor in the first place?.

With nothing connected to an Arduino input, the input "floats". It's state is undefined and it may read high or low, or it might read high one minute and low the next minute.

If you connect a button/switch and the switch is off/open, the input is still open and undefined. When you push the button, it will read high but when you release the button it's undefined again.

The resistor is a "pull down" resistor and it holds the input low when the button is not pressed. When you press the button the input is pulled high, "overpowering" the resistor (and current flows through the resistor).

If you were to simply ground the input directly instead of using a resistor, the switch would create a short between +5V and ground which would cause excess current to flow and "kill" the 5V power supply.

There is an optional pull-up resistor inside the ATmega chip that you can activate in software. If you wire your switch to ground and reverse your software logic, you can eliminate the external resistor.

I would have thought the MOSFET should have been an IRL520N, for Logic Level applications.

the MOSFET should have been an IRL520N,

(Or similar). Good point.

Yet another example of a terrible on-line tutorial, guaranteed to disappoint beginners.