# LED Strobe - Precise Frequency Setting - Digital display

Hello,

I am wanting to create a little LED Strobe, however, really need to be able to precisely set it.

My intention is using it to tune the tension of a ribbon for a ribbon microphone.

I was thinking maybe up and down buttons to increase/decrease the frequency.

And a digital display (like a small LCD)

I know how to program the outputs using a delay, can wire in a MOSFET or driver transistor for the LEDS (I really don't need many LEDS) and could sort out reading the buttons to decrease/increase the delay. But how do I turn this into Hz and then display it on the LCD panel?

I only need a range between 10 and 30Hz

Is the arduinio a good candidate for this type of project.

Could anyone provide some guidance on where I could get some help.

Thanks Tons.

Michael

1/freq = time required.

1/10 = 100ms = 100000us
1/30 = ~33ms =33330us

Hiya Michael,

Here is a quick and dirty demo of the time/frequency conversion math that Larry showed above. It uses the built-in led, a trim pot with one end grounded and the wiper on pin A2, and it reports the frequency via the serial monitor:

``````#define ledPin 13  // built-in led
#define dial A2  // pin  -->  10K ohm pot  >  gnd

unsigned long startPulseMicros = micros();
long pulseInterval = 106000L; // 9.4Hz

int frequency = 10;
boolean ledOn = false;

void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(dial, INPUT_PULLUP);
Serial.begin(115200);
}

void loop() {
if (micros() - startPulseMicros >= pulseInterval) {
startPulseMicros += pulseInterval;
ledOn = !ledOn;
digitalWrite(ledPin, ledOn);

frequency = map (analogRead(dial), 0, 227, 5, 50);  // trial and error calibration
pulseInterval = 500000L / frequency;  // each interval is 1/2 the period

Serial.println(frequency);
}
}
``````

ChrisTenone:

``````int frequency = 10;
``````

Why an int?

``````    frequency = map (analogRead(dial), 0, 227, 5, 50);  // trial and error calibration
``````

Why map()? The arithmetic is not that hard.

odometer:
Why an int?

It's the reflexive use of int. Superfluous and lamentable, but hardly unique around here.

odometer:
Why map()? The arithmetic is not that hard.

The guy's putting something out there.
If you have a better idea, post it.

Less words, more figures.

``````frequency = 5.0 + (analogRead(dial) * 0.1982);
``````