-1

I'm trying to get PWM values from a 2-pin fan header on DuetWifi board (it is a 3D Printer Controller Board). Here is some info about the fan connection on that board.

From their forum, I got to know that fan output is open-drain and can operate with frequency up to 65535 Hz (frequency for each fan is configurable).

First of all, I connected Duet FAN- to Arduino D7 and tried that code:

int pin = 7;
unsigned long duration;

void setup() {
  Serial.begin(9600);
  pinMode(pin, INPUT_PULLUP);
}
 
void loop() {
  duration = pulseIn(pin, HIGH);
  Serial.println(duration);
}

But it shows constant readings between 6-7 in Serial Monitor:

7
6
7
7
7
7
7
6
6
7

Also, any fan speed adjustment in the Duet UI doesn't affect those readings as well.

After that, I have tried a lot of different libraries and codding approaches from Arduino forum to get suitable PWM readings from FAN- pin, but have no luck.

  • Please show us how you connected the Arduino to the fan. – VE7JRO Jul 9 at 21:30
1

Your picture shows that you have only connected one line to the Arduino. You do not have a common ground between the Arduino and the fan controller. You need to connect the grounds together.

Voltage is like height, it requires two points to measure. If I point at a hill and I say, "How high is that hill?" that seems like a pretty easy question to answer at first. But it becomes ambiguous quickly. Do we want to say how high it is compared to the ground around it? Or how high from sea level? Or how high from where we are standing? You simply can't say how high a hill is unless you agree on where to measure from.

It's the same with voltage. You can't measure a voltage unless you have a potential that you can consider the 0 point to measure from. That 0 point is the ground wire. And as you have drawn the circuit the two boards don't agree on where they will consider 0 volts.

| improve this answer | |
  • Thank you for such a detailed explanation. – uk25 Jul 10 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.