Hi all, I have a question; I have connected a fan with 4 wires to an Arduino Due.
Wiring on the fan should be like this:
Pin 1 - Ground - Black
Pin 2 - 12v - Yellow
Pin 3 - Sense - Green
Pin 4 - Control - Blue
I attached the yellow to the 5V of the board and the black to the GND of the board.
The fan starts and is ok.
What I need is to be able from the Arduino to switch on/off the fan based on temperature.
The only way I managed to do it is using the Blue wire and connecting to the Digital pins (like 22) or PWM pin (like 3) and giving HIGH to start and LOW to stop.
But doing like this even if I set the control to LOW, at every Arduino loop, even if I do not change any pin, I got the fan to move a little (like 3 times and then stops as it should)...
And I do not know why.
I tried to put the yellow directly to the digital or pwm pins but it will not start.
Thank you if You can help me more.UPDATE1: I think I understood why the fan works only powered by the 5V pin; because every other pin on the Arduino Due can output 3.3V MAX; so 5V seems to power it up but 3.3V is too low. I still do not understand why setting the control to LOW every loop() start it gives a current peak to the fan that makes it turn 2 or 3 times.
This is the source code:
#define TEMPERATURE_PIN 2
#define FAN_PIN 22
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
// Pass our oneWire reference to Dallas Temperature.
int myspeed = 0;
int countmsecs = 0;
pinMode(FAN_PIN, OUTPUT); // sets the pin as output
countmsecs = 0;
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.print("Temperature for Device 1 is: ");
// Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
float temp = sensors.getTempCByIndex(0); // from 27.34 to 273
myspeed = 255;
myspeed = 0;