How can i control the duty cycle for pwm using touch slider ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 I want to control 4 computer fans using touch slider 

   

How can i connect the pwm to touch slider ?

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Duty cycle of a pwm is controlled by the compare value. Duty cycle = (Period + 1)/(Compare + 1) * 100%

   

So you just read the slider position and set the compare value accordingly.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Using A/D, that tells you slider position, essentially.

   

 

   

Then using a loop, or DMA, you feed that value to compare register of PWM.

   

When PWM finishes its current cycle it will update the comparison

   

used to new value. In case of PWM immeadiate update occurs.

   

 

   

Regards, Dana.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

@dana: no need to use the ADC for the touch slider, there is a nice API for that 🙂

0 Likes