ESP32-E DFR0654 and PWM

userHead neo888 2023-03-06 10:00:54 604 Views4 Replies

Hi,

I would like to know if DFR0654 can use pwm signal?

I want to drive a fan pwm with dht22 but it's not working with :

 

#define fanChannel 0
#define fanResolution 8 
#define fanFrequency 12000 
#define fanPin 14 //D6
int pwm = 0; 

void setup(){
ledcSetup(fanChannel, fanFrequency, fanResolution); 
ledcAttachPin(fanPin, fanChannel); 
}

void loop(){
for(pwm=0;pwm<256;pwm++) {
ledcWrite(fanChannel,pwm);
delay(250);
};
}
 

2023-03-12 03:29:42

Hi, I found my problem : not the same ground between fan and esp32. now it's working good!

userHeadPic neo888
xingzhao.zhu wrote:

Hello,

Good to hear that your project is working well!

 

We have also tested the board with your code, and we have successfully turned on the fun with our board too. If you feel that the 3.7V power supplied by the board is a little bit underpowered, you can also connect the fun's VCC and GND to an external battery, or give the fun a little push to get it started. 

 

Also, If you wish to explore more about this board, there are some good information and example codes on: https://wiki.dfrobot.com/FireBeetle_Board_ESP32_E_SKU_DFR0654

 

 

Regards,

2023-04-25 19:33:34
1 Replies
2023-03-07 12:37:34

Hi,

thanks for your answer.But for the moment  it's not working (is the same with all digital pin D2/D9 and all). I don't see why! the mofset working good but normally, when pwm>30 fan must turn slowly, and it turn fast.

for example : 

#define fanChannel 0             

#define fanResolution 8   

#define fanFrequency 10000   

#define fanPin 2                           //D9  

int pwm = 0;

 

void setup(){

Serial.begin(921600);

ledcSetup(fanChannel, fanFrequency, fanResolution);

ledcAttachPin(fanPin, fanChannel);

   

pinMode(12,OUTPUT);   // fan power with mofset on the pin12

digitalWrite(12, LOW);

}

 

void loop(){

digitalWrite(12, HIGH);

for(pwm = 0; pwm <= 255; pwm++){  

Serial.println(pwm);

 ledcWrite(fanChannel, pwm);

 delay(250);

  }

 

 digitalWrite(12, LOW);

 delay(5000);

}

 

I tested with 2 fans : noctua NF-A12x15pwm and NF-P14r redux-1500pwm

 

userHeadPic neo888
2023-03-06 22:50:39

Hi

Yes. FireBeetle 2 ESP32-E IoT development board(SKU: DFR0654) can enable PWM signal on pins from D2-D9.

Hope it can help.

userHeadPic NeloKin