This works for roughly 10 sec before the arduino starts overheating, this causes the fan to periodically spin faster and slower when the potentiometer is set to, e.g., half speed.
My solution was to use a voltage transformer to power the arduino and the potentiometer with 5V instead:
Sadly, the control will not work like this. The fan spins at full speed, no matter how the potentiometer is set. For the sake of completeness, this is the code I use, largely copied from here:
I suspect this to be a problem because the arduino is on the 5V circuit and the fan is on the 12V circuit. But as I am a beginner in working with arduino and microcontrollers I have no idea how to fix this. I hope someone can help me make my circuit work.
It does not have a dedicated 5V pin, only VIN. Before I VIN it to feed 12V.
It has a dedicated 5V pin, but using it instead does not make a difference.
Looking at your diagram, it appears that you may be feeding 12V to the Nano analog in!
It would be better to have the positive end of the pot connected to the Nano 5V out, This way, you will be sure not to exceed the max input voltage to the analog pin
Hi,
If you haven't burned your nano yet, forget about this option.
By moving the potentiometer to 12V, you will inject 12V into the A2 of the nano, and maybe say goodbye to this port or the nano.
Yes, the first diagram. And leave the ground of the potentiometer connected to the ground of the Nano.
Basically, the potentiometer is a fixed resistor from one end terminal to the other. Often you will find this is 10k resistance. But that number will vary depending on the model you choose.
The wiper arm will then pick up the voltage that will depend on the position of the arm. If the arm is at the ground end of the pot, it should read 0, and at the other end, it will read 5V, provided that end is being fed 5V.
If it is connected to 12V, then the Nano analog input will see 12V, and as ruilviana said above, it will probably fry the port and possibly the whole chip.
The only way for you to know for sure is to try and see if it still works.
Problem is that the third wire of a 3-pin fan is not a PWM input, but a tach output.
A 4-pin fan is needed for speed control (supply, ground, tach, PWM).
Or a bunch of external parts (resistors, transistors, etc.)
Not soldering the pins of a Nano also won't work.
Leo..