Hey everyone,
I'm starting to dig around and have been fooling with the ledc module, but I don't think it will fulfill my requirements completely. I need to generate a very slow pwm signal, somewhere in the order of having a period of 10 to 20 minutes. The duty will be fixed
Is there anyone I can generate this signal using the esp32?
Any help will really be appreciated!
very very slow pwm singal generation
Re: very very slow pwm singal generation
Use a timer. How accurate does it have to be?
Re: very very slow pwm singal generation
Hi WiFive,
This was the other option I was thinking of doing.
I was hoping that maybe the ledc module could do this.
I'd say if the timer has a period of 20 mins with a 10% duty, then a variation of 5% or less would be preferred.
I'm not too familiar with the esp32's timers. How would I go about setting the duty cycle?
Thanks for the help! appreciate it!
This was the other option I was thinking of doing.
I was hoping that maybe the ledc module could do this.
I'd say if the timer has a period of 20 mins with a 10% duty, then a variation of 5% or less would be preferred.
I'm not too familiar with the esp32's timers. How would I go about setting the duty cycle?
Thanks for the help! appreciate it!
-
- Posts: 23
- Joined: Wed Dec 09, 2015 8:11 pm
Re: very very slow pwm singal generation
Just use a timer interrupt
Ian777 wrote: ↑Tue Jul 23, 2019 6:59 amHi WiFive,
This was the other option I was thinking of doing.
I was hoping that maybe the ledc module could do this.
I'd say if the timer has a period of 20 mins with a 10% duty, then a variation of 5% or less would be preferred.
I'm not too familiar with the esp32's timers. How would I go about setting the duty cycle?
Thanks for the help! appreciate it!
Re: very very slow pwm singal generation
That's what I ended up on doing, Only issue is I need three of these triggering at different times (with an interrupt triggering the respective timer and switching the others off)Just use a timer interrupt
Although this code works perfectly to start the timer:
Code: Select all
gpio_set_level(32, 0);
gpio_output_disable(GPIO_NUM_32);
gpio_set_level(27, 0);
gpio_output_disable(GPIO_NUM_27);
gpio_output_enable(GPIO_NUM_13);
restoff_args.callback = Rest_toggle_timer;
restoff_args.dispatch_method = ESP_TIMER_TASK;
restoff_args.name = "Restontimer";
esp_timer_create(&restoff_args,&restoffhandle);
esp_timer_start_once(restoffhandle,reston*1000000);
Code: Select all
esp_timer_stop(dischargeonhandle);
err=esp_timer_stop(chargeonhandle);
gpio_set_level(32, 0);
gpio_output_disable(GPIO_NUM_32);
gpio_set_level(27, 0);
gpio_output_disable(GPIO_NUM_27);
gpio_output_enable(GPIO_NUM_13);
restoff_args.callback = Rest_toggle_timer;
restoff_args.dispatch_method = ESP_TIMER_TASK;
restoff_args.name = "Restontimer";
esp_timer_create(&restoff_args,&restoffhandle);
esp_timer_start_once(restoffhandle,reston*1000000);
Who is online
Users browsing this forum: No registered users and 41 guests