The PWM signal is generated by pin D6, and I managed the PWM frecuency from 1024 prescaler to 1. In all frecuency values I can listen a noise, depending the frecuency the noise is like a whistle (1khz and higher) or like a "clap-clap" (less than 1khz).
At the moment the best performance for D6 pin is with a 60hz PWM (I still can listen a "clap-clap" little noise). I need to test at 30hz with another pin/timer. I also need to test a 30Khz PWM.
I have read that a CAP should help to eliminate the audible noise...
Where I should put the CAP, in the load side (Between FAN pins) , at the mosfets gate or at the optocouplers base?
Does anyone know if exists any another techniques that can help me to avoid the noise?
@TomGeorge , thanks a lot! So the problem is the fan technology, I didn´t know about these "inteligent" low consumption fans.
Please, anyone can explain me what means:
TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM01) | _BV(WGM00); // Used to reduce motor harmonics
TCCR0B = _BV(CS01); // Used to reduce motor harmonics from PWM
OCR0A = 180; // Used to reduce motor harmonics from PWM
OCR0B = 180; // Used to reduce motor harmonics from PWM
but I can´t see a clear relation between code and the link information, I don´t understand the low programing code
Here is how I am doing to set PWM frecuency for timer0 (I can´t use other pins because I am using other libraries like IRremote and AltSoftwareSerial), I also don´t understand very well how this works, it´s very low programming for me:
There are TWO types of BLDC motor.
For all intents and purposes the one you are using can be treated as a regular DC motor in many regards.
One caveat is that they may exhibit noise unless the pwm timing is within acceptable parameters.
This is where the changes to the timer come in useful.
However that change can also come with a small cost in that the use of a standard DELAY command could be shorter or longer than you might expect.
You can either account for that or use MILLIS instead.
The project I linked you to treats computer fans as DC motors and does not need a library.
It has been running here for a few years now unchanged at all in terms of hardware OR software.
Think of the timer as a regular household clock but with an option to select how long the seconds as we know them actually take to complete. Such clocks actually do exist BTW.
Most MCU's have the ability at a lower level to change some parameters and this is just a small example of that. I had no idea what I was doing when I needed to change the harmonic noise on my fans, with each being slightly different due to manufacturer etc.. This was a learning curve for me but by playing with the timers I was able to completely eliminate the noise.
Not only that I learned a new skill with Arduino.
If you want I can move this topic to PROGRAMMING where you may get a better explanation ?
If you want I can move this topic to PROGRAMMING where you may get a better explanation ?
Yes, please. I´ll like to know what I am doing exactly in the timer registres, I know each timer has two registers but I am not able to see the relation between my code and this registers.
@TomGeorge finally I test with another fan type (big fans) and it works perfect. I think that the problem was the little fan, this little fan, with low speed emits a noise, clap-clap, and I think it was produced because the fan bearings or some similar mechanical noise. With the big fans, all works as expected.