EMC2101 Arduino Leonardo 25kHz pwm

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
philipp17
 
Posts: 1
Joined: Mon May 02, 2022 4:17 am

EMC2101 Arduino Leonardo 25kHz pwm

Post by philipp17 »

Hi Adafruit forum,

I want to control the pwm of an Noctua A12x25pwm via an arduino Leonardo and an EMC2101 with the correct pwm frequency. The pwm frequency for the noctua fan should be 25kHz.
The whole setup is working. but I am getting 5,2kHz measured with a oscilloscop and the pwm control 0-100% is working. When I change the PWM frequency in the code i get the pwm up 23.2kHz/26,9kHz by try and error but then i can´t control it with the duty circle % / or it changes the pwm when i go under 5%pwm, the rest of the time it is running 100%.
Hopefully someone can help me. Thanks in advance.

Here is my code out of the Ardiono IDE:

#include <Adafruit_EMC2101.h>

Adafruit_EMC2101 emc2101;

void setup() {
Serial.begin(115200);
Serial.setTimeout(1);
if (!emc2101.begin()) {
//Serial.println("Failed to find EMC2101 chip");
while (1) { delay(10); }
}
//Serial.println("EMC2101 Found!");
switch (emc2101.getDataRate()) {
case EMC2101_RATE_1_16_HZ:; break;
case EMC2101_RATE_1_8_HZ: ; break;
case EMC2101_RATE_1_4_HZ: ; break;
case EMC2101_RATE_1_2_HZ: ; break;
case EMC2101_RATE_1_HZ: ; break;
case EMC2101_RATE_2_HZ: ; break;
case EMC2101_RATE_4_HZ: ; break;
case EMC2101_RATE_8_HZ: ; break;
case EMC2101_RATE_16_HZ: ; break;
case EMC2101_RATE_32_HZ: ; break;
}
//emc2101.enableTachInput(true);

//


emc2101.enableTachInput(true);
emc2101.invertFanSpeed(false);
emc2101.configPWMClock(false,true);
emc2101.DACOutEnabled(false); // output PWM mode by default
emc2101.LUTEnabled(false);
//emc2101.setPWMFrequency(25000);
emc2101.setPWMDivisor(0);
}

void loop() {
VALUE2=analogRead(0);
while (!Serial.available());
VALUE1 = Serial.readString().toInt();
emc2101.setDutyCycle(VALUE1);
Serial.print(VALUE1);
Serial.print(("% , "));
Serial.print(emc2101.getFanRPM());
Serial.println("RPM , ");
Serial.print(emc2101.getPWMFrequency());
}

User avatar
socratease
 
Posts: 7
Joined: Wed Apr 09, 2014 1:15 am

Re: EMC2101 Arduino Leonardo 25kHz pwm

Post by socratease »

I can get a PWM frequency of about 23.9kHz with the PWM Frequency Register set to 0x07 (CLK_SEL=0, CLK_OVR=0) but it reduces the resolution of the Fan Setting Register to only about 15 steps for the full range. I get the best resolution (63 steps) with PWM_F set to 0x1F, but the output frequency drops to 5.4kHz. Using CLK_OVR=1 and the PWM_D register doesn't improve that any. Fortunately, my NF-A6x25 PWM doesn't seem to mind the low frequency.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”