We're working on a robotics project in which we're using the 5940 to drive some solenoid valves, so far everything works but we're having issues calculating the values for the TLC PWM Freq/GSCLK.
We would like to run the valves at 16Hz but we're having some issues understanding the equations provided by Alex Leone in the TLC lib:
/** Determines how long each PWM period should be, in clocks.
\f$\displaystyle f_{PWM} = \frac{f_{osc}}{2 * TLC\_PWM\_PERIOD} Hz \f$
\f$\displaystyle TLC\_PWM\_PERIOD = \frac{f_{osc}}{2 * f_{PWM}} \f$
This is related to TLC_GSCLK_PERIOD:
\f$\displaystyle TLC\_PWM\_PERIOD =
\frac{(TLC\_GSCLK\_PERIOD + 1) * 4096}{2} \f$
\note The default of 8192 means the PWM frequency is 976.5625Hz */
& GSCLK
/** Determines how long each period GSCLK is.
This is related to TLC_PWM_PERIOD:
\f$\displaystyle TLC\_GSCLK\_PERIOD =
\frac{2 * TLC\_PWM\_PERIOD}{4096} - 1 \f$
\note Default is 3 */
Any tips on demystifying the equation(s) would be greatly appreciated!
Thanks
The TLC requires two variables to be set to control the frequency, TLC_PWM_PERIOD and TLC_GSCLK_PERIOD. The library provides a set of equations but we're having some difficulties understanding/interpreting it and we were wondering if anyone could rewrite the equations provided to something a little bit more understandable.
Yeah, 16Hz is slightly too high, we ended up recalculating the frequency and decided that 10~12Hz would be better. The solenoids we have are rated at 20mS response time.
We're using solenoid valves to drive a fair number of air muscles for a robotic arm.
Bump, any help with understanding the equation or tips on changing the PWM frequency of TLC5940 would be greatly appreciated, this is for a uni project and we're getting extremely close to a dead line
After doing some more googling I found formulas that are a bit easier to read but we've now encountered an issue with one of the variables.
The equation calls for fosc(frequency of oscillation), is this something that needs to be calculated based on the Arduino or TLC chip? And if so, how can it be done?
Im not sure what you are trying to accomplish by running the solenoids at "10-12hz" That means it will cycle 10-12 times per second. What you should really be focusing on I would think is the % of time you want the solenoid to be open or closed per second. A little more background info would help.
:-[ Oooops, seems like the duty cycle is what we should have been after all along.
I take it to control the duty cycle we would need the change the Grayscale value in the Tlc.set(channel, grayscale), but it seems that the solenoid valve won't even fire off unless the value is >=3850.
Any tips/explanation on how to control the duty cycle of the valve would be greatly appreciated.