• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

PWM frequency below 1Hz

Q&A Forum › Category: ESP32 › PWM frequency below 1Hz
0 Vote Up Vote Down
NUR AZLIN AIRUL AZLIN MOHAMED ZOHDI asked 4 years ago

Hi Rui & Sara,
I am trying to control my solid state relay using PWM, such that the relay stays ON for 5sec and OFF for 1sec but it seems that ESP32 LEDC function doesn’t allow for frequency below 1Hz.  
I have tried using millis() to time the ON and OFF, but that is not as accurate as using PWM.
any idea?

Question Tags: PWM
6 Answers
0 Vote Up Vote Down
Best Answer
Steve Mercer answered 4 years ago

Have you looked into using hardware timers with interrupt?

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
I think this discussion answers your question: https://forum.arduino.cc/t/esp32-what-is-the-minimum-pwm-frequency/671077/4
Regards,
Sara

0 Vote Up Vote Down
NUR AZLIN AIRUL AZLIN MOHAMED ZOHDI answered 4 years ago

Tried that already before I posted my question here.  Not working either.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Have you tried using delay() to control the relay on and off for a determined number of seconds?
In some scenarios, you can use delay() if it doesn’t compromise the rest of the code.
Regards,
Sara

0 Vote Up Vote Down
NUR AZLIN AIRUL AZLIN MOHAMED ZOHDI answered 4 years ago

Hi.
Delay() is blocking function, just to many limitation by using it.  Using millis() is much better approach, but that does not solve my problem either.
Anyway, based on my experimentation, frequency below 1Hz is possible by setting the resolution to 16-bit.
Testing it now. hopefully this is the solution to my problem
 
 

0 Vote Up Vote Down
NUR AZLIN AIRUL AZLIN MOHAMED ZOHDI answered 4 years ago

Thanks Steve Mercer  for the info and link.  Could be a solution to my problem also.  Appreciate it.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.