Feature Request, or Please, please, please with a cherry on top I can has?


 

M Miller

TVWBB Fan
lolcat.jpg


Bryan,

Can you insert some code to allow for user-definable high and low frequency PWM?

Something like:

define PID_dT (uDefClk/F_CPU)

where if uDefClk is defined low the value is 1600000 (10Hz) or high the value is 32000 (500Hz)

This would make using the HM for sous-vide or electric smokers perfect.

i-can-has-cheezburger%20(1).jpg
 
I can make a define but the problem is that the PWM frequency is not set as a number, it is set as 1/64th clock speed divided by 511. The largest divider is 1024, which would only give you 30.5Hz. Is 10Hz the magic number or what?
 
Now that explains a lot.

That altered code came from the Marlin Reprap firmware:

#define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine

It runs at 7.62 Hz, and controls my heated bed, which is run off of an SSR.

I just figured 10Hz sounded like a nice round number. :)

But if you modify that line to something like this:
#define PID_dT ((uDef)/(F_CPU / 125 / 125)) and limit uDef to be between 1 and 256 you can achieve frequencies between 1024Hz ~ 4Hz
 
Last edited:
We can probably add another output mode like servo mode except it is a PWM with a more user-definable frequency or something like that.
 

 

Back
Top