Go Down

### Topic: how to set LED frequency? (Read 1 time)previous topic - next topic

#### tobiwan123

##### Jul 02, 2020, 05:23 pm
I have 7 leds blinking simultaneously, where delay is 50ms, does it mean it blinks at frequency 20Hz?
What if delay would be 5ms it would mean that the leds would make 200 cycles per second, is it possible to see the blinking if it's so fast?

Code: [Select]
`void loop(){  setStrip(next_red);  if (next_red == 0) {    next_red = 255;  } else {    next_red = 0;  }  delay(50);}`

#### TheMemberFormerlyKnownAsAWOL

#1
##### Jul 02, 2020, 06:19 pm
I don't think anyone can see flashing beyond about 50 or 60 Hz
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

#### jremington

#2
##### Jul 02, 2020, 06:35 pmLast Edit: Jul 02, 2020, 06:41 pm by jremington
Movie frame rate was set at 24 per second (24 Hz) long, long ago, because people can't see the transitions.

Quote
where delay is 50ms, does it mean it blinks at frequency 20Hz?
No. The blink rate depends on the total time the loop takes to execute (not just the delay). Since the LED state alternates, the blink rate is 10 Hz or less.

#### tobiwan123

#3
##### Jul 02, 2020, 06:47 pm
Movie frame rate was set at 24 per second (24 Hz) long, long ago, because people can't see the transitions.
No. The blink rate depends on the total time the loop takes to execute (not just the delay). Since the LED state alternates, the blink rate is 10 Hz or less.
why less than 10hz? 50ms+50md, total cycle time of 100mS =10Hz. What is the margin of error?

#### DVDdoug

#4
##### Jul 02, 2020, 06:52 pm
Quote
where delay is 50ms, does it mean it blinks at frequency 20Hz?
No.   It's on for 50ms and off for 50ms so a complete cycle is 100ms = 10Hz.

It's actually slightly-slower because the code in-between delays takes some microseconds to execute.   The code/library used to address the LED strip could take a little longer.

Quote
Movie frame rate was set at 24 per second (24 Hz) long, long ago, because people can't see the transitions.
Each frame is shown twice for a "flicker rate" of 48Hz  (or sometimes 3 times).

Quote
it would mean that the leds would make 200 cycles per second, is it possible to see the blinking if it's so fast?
Why don't you try it?     Sometimes I can perceive flicker in my peripheral vision and then I can't see it when I look directly at the light source.  (That might be around 30Hz.)    You can also get a "strobe effect" if you move the LED or sometimes if you just move your head or eyes a little.

#### tobiwan123

#5
##### Jul 02, 2020, 06:56 pm
I don't think anyone can see flashing beyond about 50 or 60 Hz
https://youtu.be/opnn7VybOlI - this device can go even 300 cycles per second, and you can see the blinking, how to program it?

#### jremington

#6
##### Jul 02, 2020, 07:01 pmLast Edit: Jul 02, 2020, 07:01 pm by jremington
Don't be quick to believe anything you see on video.

#### TheMemberFormerlyKnownAsAWOL

#7
##### Jul 02, 2020, 07:06 pm
Quote
this device can go even 300 cycles per second, and you can see the blinking
How fast is the frame rate of the camera that shot the video?
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

#### tobiwan123

#8
##### Jul 02, 2020, 07:14 pm
How fast is the frame rate of the camera that shot the video?
I don't know, but of course camera can't catch it.

#### slipstick

#9
##### Jul 02, 2020, 07:17 pm
It's very easy to try it. Then you can tell us how fast a blink rate YOU can see.

Steve

#### tobiwan123

#10
##### Jul 02, 2020, 07:23 pm
It's very easy to try it. Then you can tell us how fast a blink rate YOU can see.

Steve
I set delay(13) so I get 38,5Hz, and this is the maximum that I can still see blinking instead of steady light.

So how that device https://youtu.be/opnn7VybOlI could go 300Hz per second?

#### TheMemberFormerlyKnownAsAWOL

#11
##### Jul 02, 2020, 07:25 pm
Quote
So how that device https://youtu.be/opnn7VybOlI could go 300Hz per second?
Maybe they used delayMicroseconds
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

#### DVDdoug

#12
##### Jul 02, 2020, 07:36 pm
Quote
https://youtu.be/opnn7VybOlI - this device can go even 300 cycles per second, and you can see the blinking
Of course the video isn't showing 300Hz...   The video frame rate can combine with the flash-rate and you can get some "strange results".

Have you ever seen an old Western movie where the wagon wheels appeared to be turning backwards? Have you ever played-around with a strobe light and a fan (or anything that rotates)?

#### tobiwan123

#13
##### Jul 02, 2020, 07:42 pmLast Edit: Jul 02, 2020, 07:42 pm by tobiwan123
Of course the video isn't showing 300Hz...   The video frame rate can combine with the flash-rate and you can get some "strange results".

Have you ever seen an old Western movie where the wagon wheels appeared to be turning backwards? Have you ever played-around with a strobe light and a fan (or anything that rotates)?
Yes, but technically it's possible

#### DVDdoug

#14
##### Jul 02, 2020, 10:16 pmLast Edit: Jul 02, 2020, 10:17 pm by DVDdoug
Quote
Yes, but technically it's possible
What's technically possible?   Of course it's easy to blink an LED faster than 300Hz but the video can't show 300 flashes per second with a frame rate around 30 frames per second.

Go Up