Watch with a strobe effect

in light •  5 years ago  (edited)

Hey. For a very long time I wanted to make such a stray. The idea is this: on the engine from the CD / DVD drive, a vertical panel rotates with diodes that turn on at the right time. Thus, a figure is created - numbers. Still, I studied at the university, and it gave me a lot. (although I do not really like to admit it :) In general, I had some kind of understanding.

Yeah, and I want to note right away that my stepfather Oleg Viktorovich helped me a lot. For which many thanks to him.

I want to note right away that everything was done artificially and, most likely, incorrectly. But it still works :)

Accessories:

  • Arduino Nano board
  • drive CD / DVD
  • CD
  • glue
  • wires
  • 9V battery
  • power supply 9V 0.5A
  • soldering iron (solder, rosin)

At first I stuck the board on the CD (I believe that this is not entirely correct!).

СД.jpg

Then I cut out 6 diodes from the diode tape and stuck it on a plastic strip (taken from a DVD box). And the end of the plastic tape warmed up and bent. So that it stands upright on the disk. And also stuck to the disk :)

панель и клей.jpg

Then I soldered the digital inputs / outputs (D7-D12) with the diodes. I connected the battery to power the board (VIN and GND). By the way, the board will be powered by the battery. The battery stuck to the center of the disk.

батарея.jpg

And drive rotates from an external power supply.

блочок.jpg

Attention. Just do not think that everything is done so quickly. I moved very slowly. Constantly something was soldered off, fell off. And when I connected the board, for a very long time I figured out how to do the most primitive things.

In general, the finished product looks like this.

все в сборе.jpg

все в сборе1.jpg

все в сборе2.jpg

все в сборе3.jpg

By the way, at first I tried to make on the engine from HDD, but it did not work out. Viktorovich threw the drive from the DVD, and there the disk was set clearly in the center. Although there is an imbalance here.

And this is a slow motion.

And I tried to catch it with a camera

And this is just an atmospheric picture :)

атмос.jpg

By the way, and you noticed that in the first video the light of the diodes is blue. I glued the electrical tape)) Honestly, a bright light hit hard in the eyes.

изолента.jpg

If anyone is interested, I will lay out the program code. And you will see how bulky it is. And in general, I guess that somewhere there may be something wrong.

unsigned long time;
unsigned long tHours = 9;
unsigned long tMin = 33;
unsigned long timeNew = (tHours*3600 + tMin*60)*1000;


unsigned long tHours_tmp = 0;


// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  
}

void getTime() {
  tHours = (time+timeNew)/1000/3600-tHours_tmp;
  if(tHours==24) {tHours_tmp+=1;}
  
  tMin = (time+timeNew - tHours*3600*1000)/1000/60;
  if(tMin==60) tMin=0;
  
  
}





void everyoff() {
  delay(1);
  digitalWrite(12, LOW);   // turn the LED on (HIGH is the voltage level) 
  digitalWrite(11, LOW);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(10, LOW);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(9, LOW);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(8, LOW);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(7, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(1);
}

void doubledot() {
  digitalWrite(12, LOW);   // turn the LED on (HIGH is the voltage level) 
  digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(10, LOW);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(9, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(8, LOW);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(7, LOW);   // turn the LED on (HIGH is the voltage level)
}

void num1() {
  PORTB = B00000000;
  PORTD = B00000000;
  everyoff();

  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00000000;
  PORTD = B00000000;
  everyoff();  
  
}

void num2() {
  PORTB = B00011001;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010100;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010111;
  PORTD = B10000000;
  everyoff();  
  
}


void num3() {
  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010100;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010100;
  PORTD = B10000000;
  everyoff();  
  
}


void num4() {
  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00000100;
  PORTD = B00000000;
  everyoff();

  PORTB = B00011100;
  PORTD = B00000000;
  everyoff();  
  
}

void num5() {
  PORTB = B00010111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010100;
  PORTD = B10000000;
  everyoff();

  PORTB = B00011100;
  PORTD = B10000000;
  everyoff();  
  
}

void num6() {
  PORTB = B00010111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010100;
  PORTD = B10000000;
  everyoff();

  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();  
  
}

void num7() {
  PORTB = B00011100;
  PORTD = B00000000;
  everyoff();

  PORTB = B00010010;
  PORTD = B00000000;
  everyoff();

  PORTB = B00010001;
  PORTD = B10000000;
  everyoff();  
  
}

void num8() {
  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010100;
  PORTD = B10000000;
  everyoff();

  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();  
  
}

void num9() {
  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010100;
  PORTD = B10000000;
  everyoff();

  PORTB = B00011100;
  PORTD = B10000000;
  everyoff();  
  
}

void num0() {
  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();

  PORTB = B00010000;
  PORTD = B10000000;
  everyoff();

  PORTB = B00011111;
  PORTD = B10000000;
  everyoff();  
  
}

void getHours() {
    if(tHours==0) {num0();  delay(3); num0();}
    if(tHours==1) {num1();  delay(3); num0();}
    if(tHours==2) {num2();  delay(3); num0();}
    if(tHours==3) {num3();  delay(3); num0();}
    if(tHours==4) {num4();  delay(3); num0();}
    if(tHours==5) {num5();  delay(3); num0();}
    if(tHours==6) {num6();  delay(3); num0();}
    if(tHours==7) {num7();  delay(3); num0();}
    if(tHours==8) {num8();  delay(3); num0();}
    if(tHours==9) {num9();  delay(3); num0();}
    if(tHours==10) {num0();  delay(3); num1();}
    
    if(tHours==11) {num1();  delay(3); num1();}
    if(tHours==12) {num2();  delay(3); num1();}
    if(tHours==13) {num3();  delay(3); num1();}
    if(tHours==14) {num4();  delay(3); num1();}
    if(tHours==15) {num5();  delay(3); num1();}
    if(tHours==16) {num5();  delay(3); num1();}
    if(tHours==17) {num7();  delay(3); num1();}
    if(tHours==18) {num8();  delay(3); num1();}
    if(tHours==19) {num9();  delay(3); num1();}
    if(tHours==20) {num0();  delay(3); num2();}
    if(tHours==21) {num1();  delay(3); num2();}
    if(tHours==22) {num2();  delay(3); num2();}
    if(tHours==23) {num3();  delay(3); num2();}

}

void getMinutes() {
    if(tMin==0) {num0();  delay(3); num0();}
    if(tMin==1) {num1();  delay(3); num0();}
    if(tMin==2) {num2();  delay(3); num0();}
    if(tMin==3) {num3();  delay(3); num0();}
    if(tMin==4) {num4();  delay(3); num0();}
    if(tMin==5) {num5();  delay(3); num0();}
    if(tMin==6) {num6();  delay(3); num0();}
    if(tMin==7) {num7();  delay(3); num0();}
    if(tMin==8) {num8();  delay(3); num0();}
    if(tMin==9) {num9();  delay(3); num0();}
    if(tMin==10) {num0();  delay(3); num1();}
    
    if(tMin==11) {num1();  delay(3); num1();}
    if(tMin==12) {num2();  delay(3); num1();}
    if(tMin==13) {num3();  delay(3); num1();}
    if(tMin==14) {num4();  delay(3); num1();}
    if(tMin==15) {num5();  delay(3); num1();}
    if(tMin==16) {num6();  delay(3); num1();}
    if(tMin==17) {num7();  delay(3); num1();}
    if(tMin==18) {num8();  delay(3); num1();}
    if(tMin==19) {num9();  delay(3); num1();}
    if(tMin==20) {num0();  delay(3); num2();}
    
    if(tMin==21) {num1();  delay(3); num2();}
    if(tMin==22) {num2();  delay(3); num2();}
    if(tMin==23) {num3();  delay(3); num2();}
    if(tMin==24) {num4();  delay(3); num2();}
    if(tMin==25) {num5();  delay(3); num2();}
    if(tMin==26) {num6();  delay(3); num2();}
    if(tMin==27) {num7();  delay(3); num2();}
    if(tMin==28) {num8();  delay(3); num2();}
    if(tMin==29) {num9();  delay(3); num2();}
    if(tMin==30) {num0();  delay(3); num3();}   

    if(tMin==31) {num1();  delay(3); num3();}
    if(tMin==32) {num2();  delay(3); num3();}
    if(tMin==33) {num3();  delay(3); num3();}
    if(tMin==34) {num4();  delay(3); num3();}
    if(tMin==35) {num5();  delay(3); num3();}
    if(tMin==36) {num6();  delay(3); num3();}
    if(tMin==37) {num7();  delay(3); num3();}
    if(tMin==38) {num8();  delay(3); num3();}
    if(tMin==39) {num9();  delay(3); num3();}
    if(tMin==40) {num0();  delay(3); num4();}    

    if(tMin==41) {num1();  delay(3); num4();}
    if(tMin==42) {num2();  delay(3); num4();}
    if(tMin==43) {num3();  delay(3); num4();}
    if(tMin==44) {num4();  delay(3); num4();}
    if(tMin==45) {num5();  delay(3); num4();}
    if(tMin==46) {num6();  delay(3); num4();}
    if(tMin==47) {num7();  delay(3); num4();}
    if(tMin==48) {num8();  delay(3); num4();}
    if(tMin==49) {num9();  delay(3); num4();}
    if(tMin==50) {num0();  delay(3); num5();}      

    if(tMin==51) {num1();  delay(3); num5();}
    if(tMin==52) {num2();  delay(3); num5();}
    if(tMin==53) {num3();  delay(3); num5();}
    if(tMin==54) {num4();  delay(3); num5();}
    if(tMin==55) {num5();  delay(3); num5();}
    if(tMin==56) {num6();  delay(3); num5();}
    if(tMin==57) {num7();  delay(3); num5();}
    if(tMin==58) {num8();  delay(3); num5();}
    if(tMin==59) {num9();  delay(3); num5();}


}

void setNumb() {
//PORTB = B01111111;
//PORTD = B10000000;  
 
  getMinutes();
  
   delay(5);
   doubledot();
   delay(1);
   everyoff();
   delay(5);

   getHours();

}
// the loop function runs over and over again forever
void loop() {

  time = millis();
  getTime();
  setNumb();
  delay(32);
}

I want to note that there are a lot of subtleties in the code. So, for example, a figure needs to be displayed backwards. I guess this is because of the direction of rotation of the spindle. And by the way, the frequency also cheats. By poking, I set the delay to 32 milliseconds. And somehow it works. And I would like everything to be stationary. Anyway.

In general, if you have questions about the code, ask. I will try to help)

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

It's genius idea!!!

Posted using Partiko Android

Thanks, man!

This is really cool buddy! You should post here often! Cant wait what you have to offer us next!