Introduction: Stroboscopic Effect

The following project was carried out by Jennifer Barbosa Galeano and Damariz Llanes Michel in the subject of Creative Electronics of the School of Telecommunications Engineering, Malaga.


The aim of the project was to build a device that shows the stroboscopic effect using a water pump.


The project is inspired by an original project called "Antigravity Clock". A potentiometer has been added to regulate the frequency. The original project can be found at the following link.

Supplies

-Water pump.

-Electromagnet of 12V.

-LED strip white 12V.

-Driver L298N.

-Arduino One.

-12V power supply.

- 4 Aluminum tubes.

-Hose for the water pump

-Piece of metal saw

Step 1:

Test each component to see that it works properly.

-Led strip

-Electro Magnet

-Water pump

Tip: when you test the water pump, the container has to be filled with water before starting the pump, otherwise the pump will not work.

Also, electromagnet performance can be tested directly with the test code for this proyect. The image gives an idea of how you can connect it for checking.


Paste the LEDs into the spaces of the block above. And bypass them. It is important that Led lights are not RGB but basic lights as RGB lights do not illuminate enough to see the strobe effect properly.

Step 2:

Assemble the circuit by gluing the saw piece and the other parts of the circuit on the top.

Make sure that the saw piece is not very hard but flexible so that it can vibrate without difficulty.

You’ll need a glue gun to fix the components.

Step 3:

Fill the bottom water and test the correct operation of the circuit.

We have included a variable resistor to vary the frequency. The code below includes this resistor.

You can also do this project without using the resistance, the code is in the introduction link.

CODE:

#define DRV_1 6

#define DRV_2 7

#define DRV_LEDS 5

#define poten A0


#define EXPO 600

#define PERIOD 50000

#define DEF_OFFSET 250  //Entre 100 y 250

//Variable donde almacenaremos el valor del potenciometro

long valor;



boolean flashState, motorState;

uint8_t valColor;

uint16_t flashDelay, lightTimer;

uint32_t lightPrev, motorPrev;

//map 


void setup() {

  //Inicializamos la comunicación serial

 Serial.begin(9600);

  

 //Escribimos por el monitor serie mensaje de inicio

 Serial.println("Inicio de sketch - valores del potenciometro");

 pinMode(DRV_1, OUTPUT);

 pinMode(DRV_2, OUTPUT);

 pinMode(DRV_LEDS, OUTPUT);

 pinMode(poten, OUTPUT);

 delay(500);

 bitWrite(PORTD, DRV_LEDS, 1);

   

   // leemos del pin A0 valor

 // valor = analogRead(poten);

 // valor = map(valor, 0, 1023, 100 , 250);

 //flashDelay = PERIOD * 2 + DEF_OFFSET;

 // flashDelay = PERIOD * 2 + valor;

 delay( 3000 ); // power-up safety delay

}


void loop() {


  // leemos del pin A0 valor

  valor = analogRead(poten);

  valor = map(valor, 0, 1023, 100 , 250);

  flashDelay = PERIOD * 2 + valor;


 if (micros() - lightPrev >= lightTimer) {

  lightPrev = micros();

  flashState = !flashState;

  bitWrite(PORTD, DRV_LEDS, flashState);

  if (flashState) lightTimer = EXPO;

  else lightTimer = flashDelay - EXPO;

 } 


 if (micros() - motorPrev >= PERIOD){

  motorPrev = micros();

  motorState = !motorState;


  bitWrite(PORTD, DRV_1, motorState);

  bitWrite(PORTD, DRV_2, !motorState);

 }

}


////

In the first part of the code we have declared the pins that we will use as outputs to control the LED strip(5), the electro magnet(6 and 7) through a bridge in H and finally the analog input A0 is connected to a potentiometer that regulates the frequency of the system.

In the second part we have a series of global variables that we will use in the code.


Functionon setup: we configure the input/output pins, and put the LEDs on.


Loop function:  

part 1: in this section what is done is to read the potentiometer and put it in a range of 100-250 (it is to the frequency where the stroboscopic effect can be) and this value is added to the varibale flashDelay that is used to turn LEDs on and off.

parte_2 : it is the one that controls the ignition and paid of the LEDs to the determined frequency, using the variable flashstate.

part 3: which controls the activation and shutdown of the electromagnet after a period, using the varibale motorState.