I'm new to electrical circuits and the Arduino board in general. I'm creating a simple project in which the Arduino board simply controls a 12v desktop case fan via a light sensor. If the amount of light is high, the fan speed is high, if it's low the fan speed is low or off. That's just the general overview of what I'm trying to accomplish, but my issue is not really related to that.
So currently in my circuit, I've got a light sensor, switch, two LED's, a CMOS Motor Driver - RFP30N06 which says its supporting 30A/60V, and either a 9v powersupply or a 12v powersupply.
The arduino board is connected via USB, and the fan is utilizing the external power supply of either 9v or 12v.
The light sensor, switch, and LED's are being powered from the Arduino board. The switch and light sensor are from the 5v's and LED's just from the digital inputs.
The fan and the cmos motor driver are both powered from the power supply, where the Fan is grounded to both the arduino and power supply, and the driver is grounded to only the power supply.
My issue is this; when the circuit is in the off position (the fan is not allowed to spin) my 12v power supply begins to heat up and the wires connected from the power supply to the breadboard start to overheat and melt. However, if the circuit is in the on position (the fan is spinning) then everything is fine and works as intended.
Also note, that this circuit runs fine with a 9v battery. I'm able to turn the fan off and on without and overheating issues, however the fans speed is much lower due to less power. Running on a 9v battery causes another issue achieving different speeds for my fan, as I noticed when I was attempting to control the fan (say I wanted half the speed), I would input some code, and instead of the fan spinning, a whining sound would occur as I guess the code was controlling the amount of volts going to the fan.
So, how would I prevent this 12v power supply from overheating... as I'm guessing the issue is that the power has no where to go and is just being held in the wires.