Albert Einstein He developed the general theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics).

The first integrated circuit invented by the engeneer Jack S. Kilby1 (1923-2005) contained only a few transistors. Texas Instruments.
Gearbest Creality3D CR - 10 3D Desktop DIY Printer
Creality3D CR - 10 3D Desktop DIY Printer only $426.23

Gearbest FuriBee DarkMax para anuncio bara lateral Webpage
Amazing 6S FuriBee DarkMax FPV 140€

Gearbest HawKeye Firefly 8S 4K Sports Camera No Distortion Version
HawKeye Firefly 8S 4K Sports Camera No Distortion Version only $141.99
Gearbest Oscilloscope
OWON XDS3102 Oscilloscope
Gearbest Flykul 8 120kg
Flykul 8 120kg
Gearbest BAYANGTOYS X21 Brushless RC Quadcopter
BAYANGTOYS X21 Brushless RC Quadcopter

Arduino Persistance Of vision Clock

POV arduino clock

4. The code - Analog clock

Now let’s look over the code that you could also download from a link below. Make sure you’ll read all the comments in the code in order to understand it. This is the POV clock code. You also have the POV text display code later below but I’ll only explain this one. Ok, so first read the first part where we define the variables that we need such as the counters, time constants and so on.

POV analog clock code here:

/* Electronoobs POV dsiplay (Persistance of vision)
 * Subscribe: http://www.youtube.com/c/ELECTRONOOBS
 * Tutorial: http://www.electronoobs.com/eng_arduino_tut21.php */

//Variables for real time count
unsigned long Real_time_millis = 0;
unsigned long Previous_real_time_millis = 0;
float SEC;
float MIN= 45;
float HOUR = 2;
float dots_marker = 0; //Variable used for the 4 red dots

//POV clock cariables
unsigned long currentMillis, elapsed_loop_counter, previousMillis;
unsigned long counter_1, current_count;

//Interruption varaibles to count rotation speed
//We create 4 variables to store the previous value of the input signal (if LOW or HIGH)
byte last_IN_state;               //Here we store the previous state on digital pin 13
float one_rot_time=0;             //Here we store the full rotation time
float time_per_deg=0;             //Here we store the time it takes to make one degree rotation

In the Setup.void we set the registers needed to activate the pin state interruption on digital pin D13 which is on port D of the Arduino that uses the ATMEGA328p chip. Alos set the registers for pins D2 to D12 to be set as OUTPUTS and set them to a LOW value.

void setup() {
  PCICR |= (1 << PCIE0);    //enable PCMSK0 scan  
  PCMSK0 |= (1 << PCINT5);  //Enable pin state interruption on pin D13
  //Output pins register configuration
  /* D2 = Blue LED
   * D3 = Red 1 LED
   * D4 = Red 2 LED
   * D5 = Green 1 LED
   * D6 = Green 2 LED
   * D7 = Green 3 LED
   * D8 = Green 4 LED
   * D9 = Green 5 LED
   * D10 = Green 6 LED
   * D11 = Green 7 LED
   * D12 = Green 8 LED
  DDRD |= B11111100;      //2 to 7 as output  
  DDRB |= B00011111;      //8 to 12 as output
  DDRB &= B11011111;      //13 input
  PORTD &= B00000011;     //2 to 7 LOW
  PORTB &= B11100000;     //8 to 12 LOW

Now in the void loope we count seconds, minutes and hours and decide at which degree create the bar of LEDs for each of this using "if" statements. In this void loop we alos count the elapsed time on each rotation in order to know when to turn ON or OFF the LEDS. The blue LED connected on D2 will be always on creating the clock perimeter. The two red LEDs will turn on each 5 seconds or each hour on the clock design.

That's it. Download the code and upload it to the Arduino NANO. Turn the Arduino on using the slide switch, make sure the magnet is close enough of the hall sensor while spinning and turn on the DC motor that will spin the propeller. We are done. We created our POV clock. In the link below you will find a code for the text display as well.

Text POV display code

By the way, there is no battery charging included in the schematic. Probably that will be a future upgrade. For now, just unplug the battery for external recharge and you’re good to go. If you like this kind of projects, check my Patreon page and support my workshop thru there. I would really, really, appreciate that guys since I spend a lot of time and money for each project Also use my Q&A forum and create new question there so me or any other member could answer it.

arduino POV display homemade tutorial

I hope that you’ve enjoyed this tutorial on POV display. If you have any question about this tutorial or any other, just leave it on my Q&A page. Also, don’t forget to subscribe and watch all of my other great tutorials. Remember, if you consider helping my projects check my Patreon page as well. Thanks again and see you later guys.