I made a mini 3D POV (Persistence of Vision) Display to enhance the Christmas spirit.
ConstitutionThe LEDs are arranged three-dimensionally and rotated to display an image with an afterimage. I used a compact ATOM Lite as a microcomputer.
The photo reflector sensor QTR-1A detects rotation.
Power is supplied to the rotating part by the wireless charge module.
The housing was made with a 3D printer.
LED 5 cells are arranged in a 10-stage spiral.
I used the following SPI input LED Dotstar library.https://github.com/adafruit/Adafruit_DotStar
One lap is displayed in 20 divisions.
#include <Adafruit_DotStar.h>
#include <SPI.h>
#define NUMPIXELS 50
#define Div 20
#define Bright 20
#define itrPin 22
int num = 0;
int num2 = 0;
int numRot = 0;
int numDiv = 0;
int stateRot = 0;
int stateDiv = 0;
int UpDown = 0;
unsigned long rotTime, timeOld, timeNow;
uint32_t colorNum[] = {
0xFF0000,
0xFFFF00,
0x00FF00,
0x00FFFF,
0x0000FF
};
#define DATAPIN 25
#define CLOCKPIN 21
Adafruit_DotStar strip(NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BGR);
void setup() {
Serial.begin(115200);
strip.begin();
strip.setBrightness(Bright);
strip.show();
pinMode(itrPin, INPUT);
delay(500);
attachInterrupt(digitalPinToInterrupt(itrPin), RotCount, RISING );
}
void loop() {
if(stateDiv == 1 &µs() - timeOld > rotTime / Div * (numDiv)){
stateDiv = 0;
}
if(stateDiv == 0 && micros() - timeOld < rotTime / Div * (numDiv + 1)){
stateDiv = 1;
strip.clear();
for(int i=0;i<5; i++){
strip.setPixelColor(i + (numRot/2) * 5, 0xFF0000);
}
strip.show();
numDiv++;
if(numDiv >= Div ) numDiv = 0;
num++;
if(num >= 5 ) num = 0;
}
}
void RotCount() {
timeNow = micros();
rotTime = timeNow - timeOld;
timeOld = timeNow;
if(UpDown == 0){
numRot++;
if(numRot == 19 ) {
UpDown = 1;
}
}else{
numRot--;
if(numRot <= 0 ) {
UpDown = 0;
}
}
Serial.println("int");
}
Christmas Tree
Comments