I have the following circuit
It has a simple dc motor that is OFF, and switches ON once a day for 2 seconds.
I use MOSFET IRF540N as a switch
I use L7805CV as a voltage regulator
I would like to have a review and to ask whether it is safe to connect this circuit to a 9v 1A (center+) DC wall plug.
I have measured the dc motor and it takes 60 mA when it is on with 5V.
3 Answers 3
The "Arduino" part of your schematic looks OK. 9 VDC to VIN on the Uno is OK. Connecting the MOSFET directly to the Arduino is OK.
Personally, I would connect a 1000 ohm resistor in series between the Arduino pin and the gate of the MOSFET. If you like to live dangerously like I do, and change wiring connections with power supplied to your Arduino, then a 1k resistor will limit the maximum current flow to around 5 mA. This is not going to "fry" anything if you inadvertently connect an output to power or ground.
The question about the L7805CV is off-topic, but a quick look at the datasheet suggests an input and output capacitor should be used.
I’m sorry to be the bearer of bad news, but the IRF540N is a poor choice as a MOSFET to use with a micro-controller. While it’s true that you are only drawing 60 mA, the VGS specified for this MOSFET is at 10 VDC, not the 5 VDC supplied by the Uno. A "logic level" MOSFET would be better suited for your application.
For more information regarding MOSFETs, please read: How to control a 12V solenoid valve with a mosfet?
In general your circuit is fine, but the parts are pretty overpowered. If there is a reasonable voltage drop at the IRF540N you better choose a mosfet with a lower gate-source threshold voltage, if it works I'd say it's fine.
You should not use a "naked" L7805CV. That voltage regulator requires a couple of capacitors in order to build a functioning voltage regulator out of it. You should be able to find instructions online for how to build one. Search on "L7805CV circuit" and you should find quite a few sample circuits.
That said, 9V is a good unregulated voltage to provide to the Vin line on the Arduino. Its built-in voltage regulator should be able to regulate that to 5V quite well, even with "bobble" caused by motor. (The built-in voltage regulator is able to handle input voltages from 7.5V to 12V, although if you feed it 12V and draw a lot of current out of the 5V line you may have overheating problems.)
You should also use a "logic level" MOSFET that can be driven with a 5V gate voltage.
Explore related questions
See similar questions with these tags.