Con Arduino puede variarse esta frecuencia a través de la lectura analógica de un potenciómetro.
Este es un proyecto sencillo que saque del siguiente sitio:
http://superawesomebook.com/strobe/
sólo que se me ocurrió agregarle un control de velocidad a un motor de DC de manera que al iluminarlo con la luz estroboscópica lograra verse detenido.
Detalles para su construcción
Reciclé una linterna de leds de 9 leds alimentados con una fuente externa de 4,5volts. Para controlarlos con Arduino agregar un transistor BC547b.
Esquema de conexión
Video
Sketch
/***************************************************************************
Luz estroboscopica con Motor DC
Led en pin 13
Motor en pin PWM 9
Potenciometro Led en A2
potenciometro en A1
marzo 2016
****************************************************************************/
int analogPin = 2; // entrada analógica para la frecuencia de parpadeo del Led
int velMotor = 1 // entrada analógica para la velocidad del motor
int ledPin = 13; // Salida para Led
int motor =9; // Salida PWM para motor
// How much time should the light stay on between delays, in Microseconds (millionths of a second)?
/* Big number = more blur, more perceived brightness
* Small number = less blur, less perceived brightness */
long onTime = 250;
// What should the minimum delay be in milliseconds (thousandths of a second)?
// This sets the bottom delay range of the strobe, as a delay of 0 doesn't actually flash =P
// The strobe starts with this as the "fastest" mode, and goes slower from there, adding to the delay
int minDelay = 1; // 1 is the lowest we can actually do without a better delay function
// What should the maximum delay be in milliseconds?
// This is the longest time that the biggest potentiometer value will be mapped to, and longest
// time between strobe flashes.
int maxDelay = 100;
// Initialize the number to hold our strobe delay. Isn't used till we get to the main loop
long strobeDelay = 0;
void setup() {
pinMode(ledPin, OUTPUT); // Setup ledPin as an output.
pinMode(motor,OUTPUT);
}
void loop() {
// To make the math easier, we use map(value, fromMin, fromMax, toMin, toMax) to convert the
// 0 to 1023 range we get from analogRead, into our strobe delay range of 1 to 100 :D
strobeDelay = map(analogRead(analogPin), 0, 1023, minDelay, maxDelay);
digitalWrite (ledPin, HIGH); // Switch the ledPin to HIGH, turn it on!
delay Microseconds(onTime); // Delay while on, for the given onTime.
digitalWrite(ledPin, LOW); // Switch the ledPin to LOW, turn if off!
delay (strobeDelay); // Delay while off, for given strobeDelay.
int vel=analogRead(A1);
analogWrite (motor,vel);
}
Luz estroboscopica con Motor DC
Led en pin 13
Motor en pin PWM 9
Potenciometro Led en A2
potenciometro en A1
marzo 2016
****************************************************************************/
int analogPin = 2; // entrada analógica para la frecuencia de parpadeo del Led
int velMotor = 1 // entrada analógica para la velocidad del motor
int ledPin = 13; // Salida para Led
int motor =9; // Salida PWM para motor
// How much time should the light stay on between delays, in Microseconds (millionths of a second)?
/* Big number = more blur, more perceived brightness
* Small number = less blur, less perceived brightness */
long onTime = 250;
// What should the minimum delay be in milliseconds (thousandths of a second)?
// This sets the bottom delay range of the strobe, as a delay of 0 doesn't actually flash =P
// The strobe starts with this as the "fastest" mode, and goes slower from there, adding to the delay
int minDelay = 1; // 1 is the lowest we can actually do without a better delay function
// What should the maximum delay be in milliseconds?
// This is the longest time that the biggest potentiometer value will be mapped to, and longest
// time between strobe flashes.
int maxDelay = 100;
// Initialize the number to hold our strobe delay. Isn't used till we get to the main loop
long strobeDelay = 0;
void setup() {
pinMode(ledPin, OUTPUT); // Setup ledPin as an output.
pinMode(motor,OUTPUT);
}
void loop() {
// To make the math easier, we use map(value, fromMin, fromMax, toMin, toMax) to convert the
// 0 to 1023 range we get from analogRead, into our strobe delay range of 1 to 100 :D
strobeDelay = map(analogRead(analogPin), 0, 1023, minDelay, maxDelay);
digitalWrite (ledPin, HIGH); // Switch the ledPin to HIGH, turn it on!
delay Microseconds(onTime); // Delay while on, for the given onTime.
digitalWrite(ledPin, LOW); // Switch the ledPin to LOW, turn if off!
delay (strobeDelay); // Delay while off, for given strobeDelay.
int vel=analogRead(A1);
analogWrite (motor,vel);
}