//STM32F103 Program for EL (ledwire)driving GND> d882->irf4905->ferrittrafo>+5V 6000yFparraleltoGND STMgpio->220R>D882 ferrittrafoused ca.40watt from VHS recorder to generate ~150VAC for ELwire //build in 1x RGB 3Watt RGB led N4007 1A1000V inline with red rest direckt to D882switched ground LED direkt on 5V //used 30Watt switching supply modul 5V/12V (12V not used) //3taster switching 3V3 to 470Rgroundet GPIO (AMS1117 as 5V>3V3 convwerter for stm power //stm specs: 32GPIO max switching GPIO current 60mA 128k Flash 20k EAM 72Mhz 8analoginputs(unused) //taster1: aus (no all outputs low) //taster2 change modus (1. default EL wire on minimum brightenes fixed) // (2. EL wire auto bruighteness fading) // (4. slow fading RGB colors like the acryl polarisstar) // (4. Puls flashing LED colors (beatflashing thing for psymusic)also pulsing all unsoldered gpios chaoticly // (5. nothing aus taster 1= jump to programm5) //taster3: changing brighteness powder for el wire/RGB led working in programm 1 and 3 //kote by marderchen/project by maderchen towithitwhateverwhantto :3 //even if powdering EL-wire not with factory rated 5-10W its realy getting warm if blown ca. 30Watt init but iam not realy happy with brighteness comming out /*pictures * https://marderchen.lima-city.de/NEU+/crapy_10m_EL-wire_ipowderyouuntiligetyoucutebright.jpg * https://marderchen.lima-city.de/NEU+/10m_EL-Wire_30Watt_STM32_drivingbox_inside.jpg * https://marderchen.lima-city.de/NEU+/10m_EL-Wire_30Watt_STM32_drivingbox_done.jpg * https://marderchen.lima-city.de/NEU+/10m_EL-Wire_30Watt_STM32_drivingbox_interface3WRGBstatusled.jpg * zort have tryed EL-foil inverter = bad brightenes have tryed self oscilating coil transistorcircuit also not happy with brightenessresuklt so now solution for even more power with STM32 but still not fine EL-wire just not * made for lighting something just for edgewarning in dark room.. supply fused with ontime fuse and overheating NTC so its save :3 *///sorry kote extremly chaotic just mixed koteparts from my other projects together^^ #define strobe1 PC14 #define strobe2 PC15 #define strobe3 PA0 #define strobe4 PA5 #define strobe5 PA6 #define strobe6 PA7 #define strobe7 PB0 #define strobe8 PB1 #define strobe9 PB10 #define strobe10 PB11 #define strobe11 PB12 #define strobe12 PB13 #define strobe13 PB14 #define strobe14 PB15 #define strobe15 PA8 #define strobe16 PA9 #define strobe17 PA10 #define strobe18 PB5 #define strobe19 PB6 #define strobe20 PB7 #define strobe21 PB8 #define strobe22 PB9 #define control PC13 #define t1 PA2 #define t2 PA3 #define t3 PA4 #define mostrans PA1 #define channelz 24 void setup(){ delay(300); pinMode(strobe1,OUTPUT); pinMode(strobe2,OUTPUT); pinMode(strobe3,OUTPUT); pinMode(strobe4,OUTPUT); pinMode(strobe5,OUTPUT); pinMode(strobe6,OUTPUT); pinMode(strobe7,OUTPUT); pinMode(strobe8,OUTPUT); pinMode(strobe9,OUTPUT); pinMode(strobe10,OUTPUT); pinMode(strobe11,OUTPUT); pinMode(strobe12,OUTPUT); pinMode(strobe13,OUTPUT); pinMode(strobe14,OUTPUT); pinMode(strobe14,OUTPUT); pinMode(strobe15,OUTPUT); pinMode(strobe16,OUTPUT); pinMode(strobe17,OUTPUT); pinMode(strobe18,OUTPUT); pinMode(strobe19,OUTPUT); pinMode(strobe20,OUTPUT); pinMode(strobe21,OUTPUT); pinMode(strobe22,OUTPUT); pinMode(mostrans,OUTPUT); pinMode(control,OUTPUT); pinMode(t1,INPUT); pinMode(t2,INPUT); pinMode(t3,INPUT); ratemal();} uint8_t beatsplit,strop[channelz+1],helligkeiten[channelz+1],newtrigger,blinkdata[10][channelz+1],onpress[14]; uint16_t fanp=5; uint16_t hellig=0,hellz,rainbow,duty[4]; uint8_t ofon=0;uint8_t modus=0; uint16_t helldata[6]={150,10,10,0,0}; int zeit1,zeit2,zeit3,zeit4,zeit5; void loop(){zeitreise();}//3blau2grun1rot long littletime=micros();long slowtime=micros();long dimmer=micros();long rlag=micros();long mogi=millis(); void zeitreise(void){ while ((micros()- slowtime)>20100){ istinput();//something between 19500-20500 raw- beatsplit++;if (beatsplit >40){beatsplit=1;newtrigger++;if(newtrigger>16){newtrigger=random(1,4)*3;ratemal();}} for(uint8_t fiz=0;fiz= 18){for(uint8_t fu=0;fu=1){strop[fu]-=1;}}machlicht();pulspowder();pulspowder();pulspowder();dimmer = micros();}//downfade while ((micros()- littletime) >= 400){if(modus==2){zeit2++; zeit4++;}littletime = micros();} while ((millis()- mogi) >= (2)){ if(modus==0){hellz=hellig;} if(modus==1){hellautomatic();} if(modus==2){zeit3++; zeit5++;autocolor();} mogi = millis();} while ((micros()- rlag) >= (400)){pulspowder2(); rlag = micros();}//knastterrelais } void hellautomatic(void){//EL bright steppchanger helldata[0]++;if(helldata[0]> 120){helldata[0]=helldata[1]; helldata[2]++; if(helldata[3]<1){helldata[4]=0;}if(helldata[3]>12){helldata[4]=1;} if(helldata[4]==0){helldata[3]++;}if(helldata[4]==1){helldata[3]--;} hellz=helldata[3]; if(helldata[2]> 8){helldata[1]=random(0,11)*10;helldata[2]=random(1,6)*10;} }} void rainbowcalc(void) { if(rainbow >=0 && rainbow <=400) {duty[0] =400; duty[1] =rainbow; duty[2] =0;} //rot ->gelb (rotmax grün+ blau0) if(rainbow >=401 && rainbow <=801) {duty[0] =(400 -(rainbow -401)); duty[1] =400; duty[2] =0;} //gelb ->grün (rot- grünmax blau0) if(rainbow >=802 && rainbow <=1202) {duty[0] =0; duty[1] =400; duty[2] =(rainbow - 802);} //grün ->cyan (rot0 grünmax blau+) if(rainbow >=1203 && rainbow <=1603) {duty[0] =0; duty[1] =(400 -(rainbow - 1203)); duty[2] =400;} //cyan ->blau (rot0 grün- blaumax) if(rainbow >=1604 && rainbow <=2004) {duty[0] =(rainbow-1604); duty[1] =0; duty[2] =400;} //blau ->lila (rot+ grün0 blaumax) if(rainbow >=2005 && rainbow <=2405) {duty[0] =400; duty[1] =0; duty[2] =(400- (rainbow -2006));} //lila ->rot (rotmax grün0 blau-) if(rainbow >= 2406) {rainbow =0;} } int16_t brightc,brightcc,nenrandy,rainc;uint16_t bright =300; void autocolor(void){ if (zeit5 >200) { rainc=random(0,10);zeit5=random(0,150);} if (zeit2 >rainc) {rainbow++; zeit2=0;} if (zeit3 >200) {nenrandy=random(0,25); if (nenrandy <5) {brightc=random(20,350); brightcc=random(1,5);zeit3=random(0,90); } if (nenrandy >= 5 && nenrandy <15) {brightc=random(100,410); brightcc=random(2,7); zeit3=random(20,100); } if (nenrandy >= 20 ) {brightc=random(400,650); brightcc=random(1,5);zeit3=random(0,50); } } duty[3]= (brightcc+rainc+(zeit3/20))*10; if(zeit4 > brightcc) { if (bright > brightc) {bright--;} if (bright < brightc) {bright++;}zeit4=0;} } uint16_t light,darkness,dcach; void machlicht(void) { if(modus==2){ if (bright > 400){light=bright-400; dcach=0;} if (bright <=400){dcach=(400-(bright))/2; light=0;} darkness=(dcach*dcach)/1.8; for (uint32_t fcount1=0; fcount1 <(403+light+darkness+((19-hellig)*200)); fcount1++) { if (fcount1 ==((401+darkness)-duty[0])) { digitalWrite(strobe1, HIGH );} if (fcount1 ==((401+darkness)-duty[1])) { digitalWrite(strobe2, HIGH );} if (fcount1 ==((401+darkness)-duty[2])) { digitalWrite(strobe3, HIGH );} if (fcount1 >= (402 + light + darkness) ) {allesaus();}}}} void allesaus(void){digitalWrite(strobe1, LOW ); digitalWrite(strobe2, LOW ); digitalWrite(strobe3, LOW );} void ratemal(void){ for(uint8_t tik=0;tik<9;tik++){for(uint8_t tok=0;tok1&&fcountx <4 ) {digitalWrite(control,LOW);digitalWrite(mostrans,HIGH);} if (fcountx==power) {digitalWrite(control, HIGH);digitalWrite(mostrans, LOW);}}}}} void istinput(void){ onpress[10]++; if (onpress[10] >2) { if (digitalRead(t3) == HIGH && onpress[0] ==0 ) { onpress[0] =1;modus=4;} if (onpress[0] == 1) { onpress[1]++;} if (onpress[1] >= 5) { onpress[1] =0; onpress[0]=0; } if (digitalRead(t2) == HIGH && onpress[2] ==0 ) { onpress[2] =1;modusnext(); } if (onpress[2] == 1) { onpress[3]++;} if (onpress[3] >= 5) { onpress[3] =0; onpress[2]=0; } if (digitalRead(t1) == HIGH && onpress[4] ==0 ) { onpress[4] =1;hellstufen();} if (onpress[4] == 1) { onpress[5]++;} if (onpress[5] >=5) { onpress[5] =0; onpress[4]=0; } onpress[10]=0; }} void anaus(void){ ofon++; if(ofon>=2){ofon=0;}} void hellstufen(void){ hellig+=2; if(hellig>=20){hellig=0;} } void modusnext(void){ modus++; if(modus>=5){modus=0;} } uint8_t maxx=140; void pulspowder(void) { if(modus==3){ for (uint8_t fcount=0; fcount <=maxx; fcount++) {//oh have to change this back to old system caused writing HIGH or LOW 1800x each cyclus to inhibit the whole programm if(fcount==0){allof();} if (fcount <= (maxx-1) && fcount >=1) { if (fcount==(maxx-strop[0])) {digitalWrite(strobe1,HIGH);} if (fcount==(maxx-strop[1])) {digitalWrite(strobe2,HIGH);} if (fcount==(maxx-strop[2])) {digitalWrite(strobe3,HIGH);} if (fcount==(maxx-strop[3])) {digitalWrite(strobe4,HIGH);} if (fcount==(maxx-strop[4])) {digitalWrite(strobe5,HIGH);} if (fcount==(maxx-strop[5])) {digitalWrite(strobe6,HIGH);} if (fcount==(maxx-strop[6])) {digitalWrite(strobe7,HIGH);} if (fcount==(maxx-strop[7])) {digitalWrite(strobe8,HIGH);} if (fcount==(maxx-strop[8])) {digitalWrite(strobe9,HIGH);} if (fcount==(maxx-strop[9])) {digitalWrite(strobe10,HIGH);} if (fcount==(maxx-strop[10])) {digitalWrite(strobe11,HIGH);} if (fcount==(maxx-strop[11])) {digitalWrite(strobe12,HIGH);} if (fcount==(maxx-strop[12])) {digitalWrite(strobe13,HIGH);} if (fcount==(maxx-strop[13])) {digitalWrite(strobe14,HIGH);} if (fcount==(maxx-strop[14])) {digitalWrite(strobe15,HIGH);} if (fcount==(maxx-strop[15])) {digitalWrite(strobe16,HIGH);} if (fcount==(maxx-strop[16])) {digitalWrite(strobe17,HIGH);} if (fcount==(maxx-strop[17])) {digitalWrite(strobe18,HIGH);} if (fcount==(maxx-strop[18])) {digitalWrite(strobe19,HIGH);} if (fcount==(maxx-strop[19])) {digitalWrite(strobe20,HIGH);} if (fcount==(maxx-strop[20])) {digitalWrite(strobe21,HIGH);} if (fcount==(maxx-strop[21])) {digitalWrite(strobe22,HIGH);} } if (fcount>=maxx){allof();}}}} void allof(void){ digitalWrite(strobe1, LOW);digitalWrite(strobe2, LOW);digitalWrite(strobe3, LOW);digitalWrite(strobe4, LOW);digitalWrite(strobe5, LOW);digitalWrite(strobe6, LOW); digitalWrite(strobe7, LOW);digitalWrite(strobe8, LOW);digitalWrite(strobe9, LOW);digitalWrite(strobe10, LOW);digitalWrite(strobe11, LOW);digitalWrite(strobe12, LOW); digitalWrite(strobe13, LOW);digitalWrite(strobe14, LOW);digitalWrite(strobe15, LOW);digitalWrite(strobe16, LOW);digitalWrite(strobe17, LOW);digitalWrite(strobe18, LOW); digitalWrite(strobe19, LOW);digitalWrite(strobe20, LOW);digitalWrite(strobe21, LOW);digitalWrite(strobe22, LOW); }