# Merry Christmas Blynk

Hello blynk’s freinds
I always wished to make the POV GLOBE and start collecting parts and start working with it but I specially choiced green led so I can give it as a gift for blynk community and coz the symbol of blynk is green and white .

The project is in progress and I was also thinking to integrate it with blynk so I can change the words and pictures am working on it .

The camera am using is with my I phone 7 plus the video not clean coz the rate frame is fast but In reality it’s very nice and clear I took some pics also .

Finally I wanna thank blynk the IOT of things for doing every things and making our life easy and nice
I really learned lot from it
Also thanks for the ppl who are volunteers to answeres our qs wen we need

Merry Christmas blynk and my dear fellows all
God bless

the code

``````/////////////////////////////////////////////////////////////////
// POV Globe
// Ulli Schmerold
// 8/2016
// implemented with Serial Peripheral Interface (SPI)
/////////////////////////////////////////////////////////////////

// SPI Pins Arduino Nano: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK).
// DATA_IN 12  ==> not used
#define DATA_PIN  11
#define CLOCK_PIN 13
#define LATCH_PIN 10
#define Hall_PIN 2

long circulation_time;   // Time of one circulation as processor cycles
byte segment_time;       // Length of one segment as processor cycles
int current_segment=0;   // The curent segment
int rotation = 0;        // Count the rotations (for slower image rotation)
int actual_position=0;   // The actual position of the image
boolean update=false;    // To start the data transmission

// The data for the Globe are produced with the programm POV Globe Calculator
// and stored in a two dimensional array
// Each number (byte) drives 8 LEDs
byte registers = 8;    // Number of registers

byte segments = 200;   // Number of segments per rotation

byte byte_register [8][140] = {
{0 , 0 , 0 , 0 , 0 , 1 , 3 , 7 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 14 , 14 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 7 , 3 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 3 , 7 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 7 , 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0},
{0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 223 , 207 , 231 , 243 , 249 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 15 , 15 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 251 , 243 , 231 , 207 , 159 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 207 , 207 , 192 , 192 , 207 , 207 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 224 , 192 , 207 , 207 , 207 , 192 , 224 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 207 , 207 , 207 , 192 , 192 , 207 , 207 , 207 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0},
{0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 192 , 192 , 192 , 207 , 207 , 207 , 207 , 207 , 207 , 207 , 207 , 224 , 248 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 252 , 252 , 0 , 0 , 252 , 252 , 255 , 255 , 255 , 255 , 252 , 252 , 255 , 255 , 255 , 255 , 3 , 0 , 252 , 252 , 252 , 0 , 3 , 255 , 255 , 255 , 255 , 252 , 252 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0},
{0 , 0 , 0 , 0 , 0 , 255 , 255 , 207 , 207 , 207 , 207 , 207 , 207 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 243 , 243 , 243 , 243 , 243 , 243 , 243 , 243 , 12 , 30 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 207 , 207 , 207 , 207 , 207 , 207 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 248 , 240 , 243 , 243 , 243 , 240 , 248 , 255 , 255 , 255 , 255 , 255 , 240 , 240 , 243 , 243 , 243 , 243 , 243 , 243 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0},
{0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 1 , 1 , 1 , 249 , 249 , 249 , 249 , 249 , 249 , 249 , 249 , 3 , 7 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 255 , 255 , 255 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 159 , 159 , 159 , 159 , 159 , 159 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0},
{0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 252 , 249 , 243 , 231 , 239 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 248 , 248 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 239 , 231 , 243 , 249 , 252 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 249 , 249 , 249 , 249 , 248 , 248 , 249 , 249 , 121 , 57 , 63 , 63 , 63 , 56 , 120 , 255 , 255 , 255 , 255 , 248 , 56 , 63 , 255 , 255 , 249 , 249 , 248 , 248 , 249 , 249 , 255 , 255 , 255 , 248 , 248 , 252 , 255 , 255 , 255 , 255 , 255 , 248 , 248 , 255 , 255 , 255 , 248 , 248 , 249 , 249 , 249 , 249 , 249 , 249 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0},
{0 , 0 , 0 , 0 , 0 , 224 , 240 , 248 , 248 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 28 , 28 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 252 , 248 , 240 , 224 , 0 , 0 , 0 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 207 , 207 , 207 , 207 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 127 , 31 , 207 , 227 , 248 , 254 , 0 , 0 , 255 , 255 , 255 , 0 , 0 , 255 , 255 , 243 , 243 , 240 , 240 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0},
{0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 128 , 192 , 224 , 224 , 224 , 224 , 224 , 224 , 224 , 32 , 32 , 224 , 224 , 224 , 224 , 224 , 224 , 224 , 32 , 32 , 224 , 224 , 224 , 224 , 32 , 32 , 224 , 224 , 224 , 32 , 32 , 32 , 32 , 32 , 32 , 224 , 224 , 224 , 32 , 32 , 224 , 224 , 224 , 224 , 224 , 96 , 32 , 32 , 224 , 224 , 224 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 224 , 192 , 128 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}

};

void setup() {
pinMode(LATCH_PIN,OUTPUT);       // LATCH_PIN (pin 12 of  74HC595)
pinMode(DATA_PIN,OUTPUT);        // DATA_PIN  (pin 14 of  74HC595)
pinMode(CLOCK_PIN,OUTPUT);       // CLOCK_PIN (pin 11 of  74HC595)
pinMode(Hall_PIN,INPUT_PULLUP);  // internal PULUP for the hallsensor-pin

setup_hardware_spi();            // SPI configuration
configure_interrupts();          // Interrupt configuration
}

void loop() {
if (update==true)
{
update=false;
if (current_segment++ >= (segments-1)) current_segment = 0; // for turning the POV-image
next_element(current_segment);
}
}

void next_element(int Element){
digitalWrite(LATCH_PIN, LOW); //to start the data transmision we set the latchPin  LOW
for (int i=0 ; i < registers ; i++)
spi_shiftOut(byte_register[i][Element]); //now we are transmitting the data to 74HC595
digitalWrite(LATCH_PIN, HIGH); // at least we set the latchPin  HIGH

}

//----------------------------------------------------------------
//                           Interrupts
//----------------------------------------------------------------

// macro to set bits
#define bitset(var,bitno) ((var) |= (1 << (bitno)))

// configure timer und interrupts
void configure_interrupts(void)
{
cli();    // disable interrupts

//  timer0 - (8 bit timer)
//  for timing the LED's
TCCR0A = 0;
TCCR0B = 0;
bitset(TCCR0A, WGM01);   // CTC mode
bitset(TCCR0B, CS01);    // prescaler clk / 64
bitset(TCCR0B, CS00);    // prescaler clk / 64
bitset(TIMSK0, OCIE0A);  // compare interrupt

//  timer1 - (16 bit timer)
//  to get the processor cycles for one turn of the POV globe
TCCR1B = 0;
TCCR1A = 0;
bitset(TCCR1B, CS11);   // prescaler clk / 64
bitset(TCCR1B, CS10);   // prescaler clk / 64
bitset(TIMSK1, TOIE1);  // overflow interrupt

// configure the hallsensor pin (Arduino Pin 2)
EICRA = _BV(ISC01);    // Interrupt is triggered by falling edge
EIMSK |= _BV(INT0);    // enable hardware interrupt

sei();  // enable all interrupts
}

// This interrupt is triggert from each rotation
// Here both timers are set to 0
ISR(INT0_vect)
{
// How many processor cycles have been passed since the last round?
segment_time=(TCNT1 / segments);
// To ensure a smoother image
// the interval for Timer 0 for every tiny speed deviation
// Dadurch wird der Globus ruhiger
if ( ((OCR0A-segment_time)>1) || ((segment_time-OCR0A)>2)) OCR0A=segment_time;

// set 16 bit Timer to 0  (timer1)
TCNT1 = 0;
// set 8 bit Timer to 0  (timer0)
TCNT0 = 0;

// after 3 rotations move one sector (to rotate the image)
if (rotation++ >=3)
{
rotation=0;
if (actual_position-- <=0) actual_position = segments-1; // Clockwise rotation
}
current_segment=actual_position;
update=true;

}

// This interrupt is triggered by timer0
// The timer interval is calculated after each triggering of the hallsensor
// and set to the OCROA - register
ISR(TIMER0_COMPA_vect) {
// start the SPA data transmision
update=true;
}

``````
10 Likes

Anything worth doing is worth overdoing! Got to love it!

Marry Christmas all!

1 Like

Wow… just wow! Thank you for this!!.. lots of reading and dreaming to do

1 Like

Brilliant!

1 Like

Merry Christmas!
This is an amazing gift! Thank you

1 Like

Thank u all

Thank you! Merry Christmas!

1 Like

Wow! Cool! So much work and how tricky! Thank you for the festive mood.

1 Like

lots of work with the hw, nicely done!

1 Like

Yes lot of soldering and checking the shift register
Coz when I was flipping the board to solder the pins was reversed
And each has 16 pins so yea lol
Thank u merry Christmas

2 Likes