How fast can the PMW pins on the Photon switch between off and on?

Fast can the PMW pins on the Photon switch between off and on? How many milliseconds does it take?

The frequency of the PWM signal is approximately 500 Hz
analogwrite

I just assume that your question was “at what rate does the PWM run”. rather than “how long does it take an output pin to switch from off to on”. I may be mistaken.

@rpiswag, the firmware defined PWM pins have a variable duty-cycle and a fixed frequency of 500Hz.

If you are asking about how long it takes to enable or disable the PWM output then I would say it take less than 1ms and most likely less than 500us.

Wow! That is a lot faster that what I was thinking!

What were you thinking?

0.5 to 2 ms.

If I am on track here, a duty cycle would take 2ms. Just in the area you were thinking. does that sound right for 500 hz ?

I was referring to the part about how long it takes for the Photon to change the state of the pmw pins from on to off and vice versa.

@Jack, the timer re-configuration will occur very fast but what I don’t know is what state the GPIO pin will be in when PWM is disabled.

I believe, that sending the command to turn PWM on, instructs the processor to START a sequence of turning the state of the pin on, and off, so the state on the pin will be changing at 500 hz, until it stops.
Maybe, you are asking how quickly will the pin start its 500 hz switching, once you call the PWM ?

Thats a good question, I don’t know either. In many case it may not really matter, but in some cases it may be important to know.

Hi @rpiswag

If you mean the switching time from HIGH to LOW or vice versa, it is very fast. The Photon datasheet does not say exactly but less than 5 nanoseconds (ns) would be a safe limit. This can affected by what you connect to an I/O pin but the pin switching itself is so fast as to be negligible.

Maybe if you could explain to us why you want this number, we could help more.

I was thinking of doing a project with a relay connected to the particle that is connected to an high powered led light bulb and I need the bulb to blink at a minimum of once every 10 milliseconds.

Ok. PWM will be good to use, if you want to vary the light level with PWM, BUT, not a relay.unless it is a semiconductor relay. Mechanical will not work well.

Just in my opinion, others may have a different opinion, which is more than welcome.

Is this to dim the light, or make a strobe effect, or otherwise ?

These led bulbs are DC, or AC ?

It is for different purposes but one of them is a strobe. This is not to dim the light.

The photon will be more than fast enough for what you seem to be wanting (you probably will have to slow it down).
For your strobe project, have you decided at what frequency you want your strobe? The human eye has its limits, I am not sure at what frequency tho.