//RGB torch driver..for 4x 3Watt RGB leds soldered direct on lot of 1.5mm2 NYM cooper wire //batterie/supply build in 5x18650 2200mAh = 11.000mAh capacity charged by 2 parralel TP4056 Li-ion module, driving 2x 5V2A constand output boost step-up //but build in some additiona tantal and total 2800yf elektrolyt on 5Voutput/Li-ioncells also glued spet ups together with charger on aluminium heatsink for get more power :3 //the hole thing is cooler bei the rear rotormodul from a dualrotor turbine, vacuming air from rear trough li-ion cells stepup and charger and blow it out against the ledswith cooper wire //turbine is regulated by 10k themperatursensor (GPIO PA0 is groundet with 10k resistor 10k sensor is connectet to 3V so 0°C should be value 2000?maybe but 2030 is deffinetly not 30°C^^ fansensivity adjustable over display //requied 12V voltage/power for turbine comes from on 5V connectet 2A to 12V setted boost stepup (not connected to Li-ion caused need 12V stable) //buildet in nokia 5510SPI 48x84pixel dotmatrixdisplay (contrast adjustable) also manuel mode RGB color and brighteness can be chosen //build in 5 taster, switching 3V3 to 470Rgroundet GPIO doing this: 1.taster ON, 2.taster OFF 3.taster changing rectagleposition on display, 4.taster counting up variable in recttagle, 5.taster counting it down. //awesome with the soldered cooper and 33yF tantal capacitor parralel to LEDs i can switch the 5V directly over transistors to leds so more brightness than factory saying.. /* pictures: * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_V2cooper.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_displaytest.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_fortoday.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_batterietest.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_circuitprohress.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_test2.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_heateensor.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_powermodul_1.jpg * https://marderchen.lima-city.de/NEU+/high-preformance_RGBspot_powermodul_2.jpg * https://marderchen.lima-city.de/NEU+/high_preformance_RGBspot_casing.jpg * https://marderchen.lima-city.de/NEU+/high_preformance_RGBspot_whitetest.jpg * https://marderchen.lima-city.de/NEU+/high_preformance_RGBspot_caseword.jpg * https://marderchen.lima-city.de/NEU+/high_preformance_RGBspot_tasterinterface.jpg */ //project by marderchen use idea or code(parts) is usefull have fun :3 #include #include #include //thanks to adafruit für cute working NOKIA5510 library // Software SPI (slower updates, more flexible pin options): // pin 7 - Serial clock out (SCLK) // pin 6 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 4 - LCD chip select (CS) // pin 3 - LCD reset (RST) Adafruit_PCD8544 display = Adafruit_PCD8544(PA5, PA7, PA4, PA6, PB0); //have played little with testing for using GPIOs near together //Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, int8_t CS, int8_t RST); // 1-> PB0 -- 2->PA6 -- 3->PA4 -- 4->PA7 -- 5->PA5 -- 6->3V3 -- 7->3V3 -- 8->GND (NOKIA 5510 PCB board)//number from displaypin > STM32F103C8T6 GPIO maping maybe connect led backlight to GPIO for switching it off and save powder.. const unsigned char PROGMEM monstercat []=//cute bootpicture :3 { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0x7F, 0xFF, 0x7F, 0xFF, 0xF0, // ############################################## ############### ################### 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x3F, 0xFE, 0xFF, 0xFF, 0xC0, // ############################################# # ############# ################## 0xC3, 0x87, 0xFF, 0xFE, 0xFF, 0xFB, 0xBF, 0xFD, 0xFF, 0xFF, 0x30, // ## ### ################## ############# ### ############ ################# ## 0xDD, 0x77, 0xFF, 0xFD, 0x3F, 0x9B, 0xDF, 0xFB, 0xFF, 0xF8, 0xF0, // ## ### # ### ################# # ####### ## #### ########## ############### #### 0xDE, 0xF7, 0xFF, 0xFD, 0xD0, 0x67, 0xDF, 0xFB, 0xFF, 0xE7, 0xF0, // ## #### #### ################# ### # ## ##### ########## ############# ####### 0xDF, 0xF7, 0xFF, 0xFD, 0xEF, 0xFF, 0xEF, 0xF7, 0xFE, 0x1F, 0xF0, // ## ######### ################# #### ############### ######## ########## ######### 0xDB, 0xB7, 0xFF, 0xFD, 0xFC, 0x07, 0xF7, 0xFF, 0xF1, 0xFF, 0xF0, // ## ## ### ## ################# ####### ####### ############### ############# 0xD9, 0x37, 0xCF, 0xFD, 0xF0, 0x1F, 0xFB, 0xFF, 0xCF, 0xFF, 0xF0, // ## ## # ## ##### ########## ##### ########## ############ ################ 0xDA, 0xB7, 0xF3, 0xFD, 0xFF, 0xFF, 0xFD, 0xFF, 0x3F, 0xFF, 0xF0, // ## ## # # ## ####### ######## ####################### ######### ################## 0xC3, 0x87, 0xFC, 0xFB, 0xFF, 0xFF, 0xE5, 0xFF, 0xFF, 0xFF, 0xF0, // ## ### ######### ##### ##################### # ############################# 0xFF, 0xFF, 0xFF, 0xF7, 0xFF, 0xFF, 0xF4, 0xFF, 0xFF, 0xFF, 0xF0, // ############################ ####################### # ############################ 0xFF, 0xFF, 0xFF, 0xED, 0xFF, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0xF0, // ########################### ## ######################### ########################## 0xC0, 0x07, 0xFF, 0xE9, 0xFF, 0xFF, 0xFF, 0x9F, 0x00, 0x00, 0x00, // ## ############## # ########################## ##### 0xDF, 0xF7, 0xFF, 0xEB, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xF0, // ## ######### ############## # ############################ ######################## 0xDF, 0xF7, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xF0, // ## ######### ############# ############################### ######################## 0xD8, 0x07, 0x01, 0xDF, 0xFF, 0xE3, 0x1F, 0xDF, 0xFF, 0xFF, 0xF0, // ## ## ### ### ################ ## ####### ######################### 0xDB, 0xFF, 0xFF, 0xDF, 0xFE, 0x01, 0x0F, 0xBF, 0xF3, 0xFF, 0xF0, // ## ## #################### ############ # ##### ########## ############## 0xD8, 0x3F, 0xFF, 0xDF, 0xF2, 0x00, 0x0F, 0x7F, 0x7C, 0x1F, 0xF0, // ## ## ################ ######### # #### ####### ##### ######### 0xDF, 0xBF, 0xFF, 0xEF, 0xE0, 0x00, 0x0C, 0xC0, 0xFF, 0xE0, 0x70, // ## ###### ################# ####### ## ## ########### ### 0xD8, 0x3F, 0xF8, 0x77, 0xE0, 0x00, 0x0C, 0x1E, 0x7F, 0xFF, 0x80, // ## ## ########### ### ###### ## #### ################ 0xDB, 0xFF, 0xE7, 0xF8, 0xF0, 0x00, 0x8C, 0xFF, 0x7F, 0xFF, 0xF0, // ## ## ############# ######## #### # ## ######## ################### 0xD8, 0x07, 0x9F, 0xFF, 0x78, 0x43, 0xFB, 0xFF, 0x7F, 0xFF, 0xF0, // ## ## #### ############# #### # ####### ########## ################### 0xDF, 0xF7, 0x7F, 0xFF, 0xBC, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xF0, // ## ######### ### ################ #### ####################### ################### 0xDF, 0xF6, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFE, 0x7F, 0xFF, 0xF0, // ## ######### ## ################## ########################### ################### 0xC0, 0x07, 0xFF, 0xC0, 0x07, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xF0, // ## ############# ######################### #################### 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xC0, 0xFF, 0xFF, 0xF0, // ######################### ################################ #################### 0xC0, 0x07, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0xF0, // ## ########### ############################### ######################## 0xDF, 0xF7, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xF0, // ## ######### ########## ################################# ######################### 0xDF, 0xF7, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xF0, // ## ######### ########## ################################## ######################### 0xD8, 0x37, 0xFF, 0x7F, 0x3F, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xF0, // ## ## ## ########### ####### ######################## ######################### 0xDB, 0xB7, 0xFF, 0x80, 0x1F, 0xE7, 0x1F, 0xDF, 0xFF, 0xFF, 0xF0, // ## ## ### ## ############ ######## ### ####### ######################### 0xDB, 0xB7, 0xFE, 0x00, 0x3F, 0xC7, 0xDF, 0xD1, 0xFF, 0xFF, 0xF0, // ## ## ### ## ########## ######## ##### ####### # ##################### 0xD8, 0x37, 0xFC, 0xFC, 0x7F, 0x87, 0xCF, 0x88, 0x3F, 0xFF, 0xF0, // ## ## ## ######### ###### ######## ##### ##### # ################## 0xDF, 0xF7, 0xF9, 0xFF, 0xFF, 0xBF, 0xEF, 0x8F, 0xBF, 0xFF, 0xF0, // ## ######### ######## ################## ######### ##### ##### ################## 0xDF, 0xF7, 0xFB, 0xC0, 0xFF, 0xBF, 0xEF, 0xFF, 0x9F, 0xFF, 0xF0, // ## ######### ######## #### ######### ######### ############# ################# 0xC0, 0x07, 0xFB, 0x9F, 0x7F, 0xBF, 0xEF, 0xFF, 0x9F, 0xFF, 0xF0, // ## ######## ### ##### ######## ######### ############# ################# 0xFF, 0xFF, 0xF8, 0x1F, 0x7F, 0xBF, 0xCF, 0xFF, 0xBF, 0xFF, 0xF0, // ##################### ##### ######## ######## ############# ################## 0xFF, 0xFF, 0xFC, 0x3F, 0x3F, 0x9F, 0xDF, 0xFF, 0x3F, 0xFF, 0xF0, // ###################### ###### ####### ####### ############# ################## 0xC3, 0x87, 0xFF, 0x3F, 0xBF, 0xDF, 0xDF, 0xF8, 0x7F, 0xFC, 0xF0, // ## ### ########### ####### ######## ####### ########## ############# #### 0xDB, 0xB7, 0xFF, 0xFF, 0xDF, 0xCF, 0xC0, 0x03, 0xFF, 0x9F, 0x70, // ## ## ### ## ##################### ####### ###### ########### ##### ### 0xDA, 0xB7, 0xFF, 0xF8, 0x0F, 0xEF, 0xFF, 0xFF, 0xFF, 0x9F, 0x70, // ## ## # # ## ################ ####### ############################# ##### ### 0xD9, 0x37, 0xFF, 0xF7, 0xC7, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0x70, // ## ## # ## ############### ##### ###### #################################### ### 0xDB, 0xB7, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, // ## ## ### ## ############## ############### ################################## #### 0xDF, 0xF7, 0xFF, 0xEF, 0xFF, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0x70, // ## ######### ############## ############### ################################### ### 0xDE, 0xF7, 0xFF, 0xEF, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0x9F, 0x70, // ## #### #### ############## ################ ############################ ##### ### 0xDD, 0x77, 0xFF, 0xE7, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0x9F, 0x70, // ## ### # ### ############## ############### ############################ ##### ### 0xC3, 0x87, 0xFF, 0xF0, 0x78, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, // ## ### ############### #### ################################ #### 0xFF, 0xFF, 0xFF, 0xF8, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, // ############################# ############################################## }; //ledspotunit #define blau PB14 //active cooled spot light 4x 2Watt RGB #define grun PB13 // led colors GPIO ->220R->BD237->33yF capacitor parralel to LEDcolor #define rot PB12 // N4007 diode before red caused lower voltage #define fan1 PB15 //1x NPN DB237 connectet with 220R to stmPGIO charging 550yFcapacitors parralel to turbinefan on 12V from stepup //notused #define blau1 PA8 #define blau2 PA9 #define fan2 PA10 //input #define T1 PB6 //switching 470R groundet 3V3 to GPIO #define T2 PB5 #define T3 PB7 #define T4 PB8 #define T5 PB9 #define temp1 PA0 //analog measure value vrom 10k tempsensor uint8_t contraent=45; //set contrast change displays are different28turbine void displaystart(void) {display.begin();display.setContrast(contraent);display.clearDisplay();display.setRotation(2);display.fillRect(0, 0, 84, 48, BLACK);display.drawBitmap(0,0, monstercat, 84, 48, WHITE);display.display();} boolean ONOFF=false; boolean automat=true; uint32_t led[5]; int8_t onpress[11]; uint16_t dutywidth=400; uint8_t steps=6; uint16_t fadespeed=600; uint32_t casefan1=200; uint32_t spotfan=200; uint16_t fanpoint=120;//changeable for regulated turbinepowder uint8_t speedy=40; uint32_t cooltarget=40; uint16_t temperatur=0; String farben[11]={"rot","pink","rosa","lila","blau","cyan","cyanB","gren","gelb","orange","weis"}; uint8_t setzen; void setup() { pinMode(rot, OUTPUT); pinMode(grun, OUTPUT); pinMode(blau, OUTPUT); pinMode(blau1, OUTPUT); pinMode(blau2, OUTPUT); pinMode(fan1, OUTPUT);pinMode(fan2, OUTPUT); pinMode(T1, INPUT); pinMode(T2, INPUT); pinMode(T3, INPUT); pinMode(T4, INPUT); pinMode(T5, INPUT); delay(100); displaystart(); delay(300); malscreen(); } void loop() { zeitreise(); } void drueckmich(void){ if (onpress[10] >=2) { if (digitalRead(T1) == HIGH && onpress[0] ==0 ) { onpress[0]=1; setzden(setzen,true); } if (onpress[0] == 1) { onpress[1]++; } if (onpress[1] >= speedy) { onpress[1] =0; onpress[0]=0; } if (digitalRead(T2) == HIGH && onpress[2] ==0 ) { onpress[2] =1; setzden(setzen,false); } if (onpress[2] == 1) { onpress[3]++; } if (onpress[3] >= speedy) { onpress[3] =0; onpress[2]=0; } if (digitalRead(T3) == HIGH && onpress[4] ==0 ) { onpress[4] =1; setzen++; if (setzen >5) {setzen=0;} } if (onpress[4] == 1) { onpress[5]++; } if (onpress[5] >= 30) { onpress[5] =0; onpress[4]=0; } if (digitalRead(T4) == HIGH && onpress[6] ==0 ) { onpress[6] =1; ONOFF=true; casefan1=200;spotfan=casefan1;} //start button set case and spot turbine fast for starting than slowdown.. if (onpress[6] == 1) { onpress[7]++; } if (onpress[7] >= 20) { onpress[7] =0; onpress[6]=0; } if (digitalRead(T5) == HIGH && onpress[8] ==0 ) { onpress[8] =1; ONOFF=false;} if (onpress[8] == 1) { onpress[9]++; } if (onpress[9] >= 20) { onpress[9] =0; onpress[8]=0; } onpress[10]=0; if((digitalRead(T1) == HIGH)||(digitalRead(T2) == HIGH)||(digitalRead(T3) == HIGH)||(digitalRead(T4) == HIGH)||(digitalRead(T5) == HIGH)){malscreen();} pustefix(); }} void setzden(int welch,boolean updown){ if(welch==0 && updown==true && contraent <60){contraent++;display.setContrast(contraent);speedy=20;} if(welch==0 && updown==false && contraent >=1){contraent--;display.setContrast(contraent);speedy=20;} if(welch==2 && updown==true && fanpoint <(dutywidth+39)){fanpoint++;speedy=10;} if(welch==2 && updown==false && fanpoint >=1){fanpoint--;speedy=10;} if(welch==3 && updown==false ){automat=false;} if(welch==3 && updown==true ){automat=true;} if(welch==4 && updown==true && led[0] <10){led[0]++;speedy=40;} if(welch==4 && updown==false && led[0] >=1){led[0]--;speedy=40;} if(welch==5 && updown==true && led[1] <(dutywidth-1)){led[1]++;speedy=2;} if(welch==5 && updown==false && led[1] >=1){led[1]--;speedy=4;} } void pustefix(){ if((temperatur-fanpoint) >1 && (temperatur-fanpoint) <399){ cooltarget=(temperatur-fanpoint)+40;}//temperatur turbine regulation is just so simple :3 if((temperatur-fanpoint) <=1){cooltarget=40;} if((temperatur-fanpoint) >=399){cooltarget=340;} } void malscreen(){ display.clearDisplay();//84 48 display.fillRect(1,12,temperatur/100,8,BLACK); textso(temperatur/100+2,12,String(temperatur),1); display.fillRect(84-casefan1/10,12,casefan1/10,8,BLACK); textso(84-((casefan1/10)+17),12,String(casefan1),1); display.fillRect(1,2,contraent,8,BLACK); textso(contraent+2,2,String(contraent),1); textso(1,22,String(fanpoint),1); textso(20,22,"=0!",1);textso(44,22,String(cooltarget),1);textso(62,22,"FAN",1); if(automat==true){textso(2,32,"AUTO",1);} if(automat==false){textso(2,32,"MANUEL",1);} if (ONOFF==false){textso(62,32,"OFF",1);} if (ONOFF==true){textso(62,32,"ON!",1);} textso(2,40,farben[led[0]],1); textso(46,41,String(led[1]),1); if(setzen <=3){display.drawRect(0,setzen*10,83,11,BLACK);} if(setzen >3){ if(setzen==4){display.drawRect(0,39,42,11,BLACK);} if(setzen==5){display.drawRect(42,39,42,11,BLACK);}} //lezte reihe ; display.display(); } void textso(int xhier,int yhier,String was,int gros){display.setCursor(xhier,yhier);display.setTextSize(gros); display.print(was);} void picone(){ if(led[1]==0){led[0]=random(0,10);led[1]=dutywidth;fadespeed=random(10,60)*40;malscreen();} } void negativation(void){ if (led[1]>=1){led[1]--;} } void wuselzuspeed(void){ if(casefan1 > cooltarget){casefan1--;}else{casefan1++;} if(spotfan > cooltarget){spotfan--;}else{spotfan++;} } void coloursetz(){ // led[2] //0=colour, 1=bright, (2red3gren4blue 5=stillbrighttime) if (led[0]==0){ led[2]=led[1]; led[3]=0; led[4]=0;} //red if (led[0]==1){ led[2]=round(led[1]/2); led[3]=0; led[4]=round(led[1]/3);} //pink if (led[0]==2){ led[2]=round(led[1]/2); led[3]=0; led[4]=round(led[1]/2);} //mangenta if (led[0]==3){ led[2]=round(led[1]/3); led[3]=0; led[4]=round(led[1]/2);} //purple if (led[0]==4){ led[2]=0; led[3]=0; led[4]=led[1];} //blue if (led[0]==5){ led[2]=0; led[3]=round(led[1]/4); led[4]=round(led[1]/2);} //cyanblue if (led[0]==6){ led[2]=0; led[3]=led[1]; led[4]=led[1];} //cyan if (led[0]==7){ led[2]=0; led[3]=led[1]; led[4]=0;} //green if (led[0]==8){ led[2]=round(led[1]/3); led[3]=round(led[1]/2); led[4]=0;} //yellow if (led[0]==9){ led[2]=round(led[1]/2); led[3]=round(led[1]/3); led[4]=0;} //orange if (led[0]==10){ led[2]=led[1]; led[3]=led[1]; led[4]=led[1];} //white }//kittens kant kount.. whatever fuzzelfurrmind.. just mostly not absolutlyworking if furrfurrheadwridedown :3 long maintime=millis();long beaty=micros(); long timez=micros(); long flash=micros(); uint8_t screenfresh; void zeitreise(void){ while ((millis()- maintime) >= 2){onpress[10]++; drueckmich();istwarm();maintime = millis(); if(automat==true){picone();} screenfresh++; if(screenfresh>20) {screenfresh=0;}} while ((micros()- beaty) >= fadespeed) { if(automat==true){negativation();} beaty=micros();} while ((micros()- timez) >= 150) { if(ONOFF==true){spotty();} timez = micros();} while ((micros()-flash) >= 500) { ;wuselzuspeed(); flash = micros();} } void istwarm(void){ if((analogRead(temp1)-2000) > temperatur) {temperatur++;}else{temperatur--;} } uint8_t multiply=1; uint8_t often=5; uint32_t dutycach=dutywidth*multiply; void spotty(void) { coloursetz();noLED();nocooling(); for (uint16_t wusch=0; wusch <=(dutycach); wusch++) { if (wusch == 0) {noLED();nocooling();} if (wusch <= (dutycach-1) && wusch >=1) { if (wusch == (dutycach-(led[2]*multiply))) { digitalWrite(rot, HIGH);} if (wusch == (dutycach-(led[3]*multiply))) { digitalWrite(grun, HIGH);} if (wusch == (dutycach-(led[4]*multiply))) { digitalWrite(blau, HIGH);} if (wusch == (dutycach-(casefan1*multiply))) { digitalWrite(fan1, HIGH);} if (wusch == (dutycach-(spotfan*multiply))) { digitalWrite(fan2, HIGH);}} if (wusch >=dutycach) { noLED(); nocooling();} }} void noLED(void) {digitalWrite(rot,LOW); digitalWrite(grun,LOW); digitalWrite(blau,LOW); digitalWrite(blau1,LOW); digitalWrite(blau2,LOW);} void nocooling(void) {digitalWrite(fan1,LOW); digitalWrite(fan2,LOW);}