![]() |
Altium DesignerAltium Designer
|
DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case
DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case
Youtube video -----> https://youtu.be/6LOUOs8ukiU
Order Project PCBs:
Description:
This project includes files for the LED Resin wearable Sticker. All components, including LED diffusive cases, were specifically designed and manufactured for this project using 3D printing and CNC machining. To control the sticker, I crafted custom electronics, demonstrating in the video how I soldered and assembled everything to achieve an impressive result. The device is battery-powered and charged through USB Type-C. The material used to 3D print the cases is UTR-8100 mate diffuse resin. To control whole thing I used simple 8 bit microcontroller Atmega48. To program the controller via ISP interface, MK2 programmer were used.
Functionality:
Control is done using 1 button. By shortly pressing the button, device wakes up, providing all functions. There are various regimes that can be changed by shortly pressing the button again. If not used, device goes into a deep sleep with almost zero power consumption. Device is designed attached to cloth, so at the other side of it there is a place to solder magnetic clasp (see the video). Overall, according to intentions it has to be used in a dim light conditions at concerts, raves etc. However, it also can be used as a table lamp :)
Materials used (BOM):
1 Battery: 501220 80mAh
1 Battery charger: MCP73812T-420I/OT
7 LEDs: KRTBLFLP71.32-UVUZ-GP+VYAU-JS+SVSZ-SZ-B
21 Resistors 300 Ohm: RC0603JR-07300RL
5 Resistor 10k: RC0603FR-1010KL
3 Resistor 5k1: AC0603DR-075K1L
2 Resistor 100k: RC0603FR-10100KL
1 Resistor 3: 667-ERJ-UP3J3R0V
2 Capacitor 1uF: 187-CL21B105KAFNNNG
2 Capacitor 100n: 80-C0603C104J3R
2 Diodes: 241-BAS16TS_R1_00001
1 MCU: ATMEGA48PB-AUR
1 USB Type C: UJC-HP-G-5-SMT-TR
1 Button: PTS647SN70SMTR2LFS
PCBs, Step files and Code are attached. So feel free to use and improve them. Also, check out YT channel. There are various other things you might like :)
https://www.youtube.com/@NickElectronics
#define F_CPU 8000000 #include <avr/io.h> #include <avr/interrupt.h> #include <avr/sleep.h> #include <stdbool.h> #include <util/delay.h> // Declare your global variables here #define ON PINB7 uint16_t LED_red = 255; uint16_t LED_green = 255; uint16_t LED_blue = 255; uint16_t LED_red_r = 15; uint16_t LED_green_r = 0; uint16_t LED_blue_r = 255; uint16_t LED_red_l = 15; uint16_t LED_green_l = 0; uint16_t LED_blue_l = 255; double dim = 0.15; uint8_t count2=0; uint8_t vin=225; uint16_t count0 = 0; //Turn ON/OFF Timer uint16_t brightness = 0; uint8_t mode = 0; uint16_t dim_counter = 0; _Bool charging = false; _Bool read_ADC_1 = false; _Bool start=false; _Bool eslp=1; _Bool dim_end = false; _Bool button_pressed= false; void sleep(void); void wakeup(void); void startup(void); void control(void); void init_MCU(void); void timer1_e(void); void adc_e(void); void timer1_d(void); void adc_d(void); void timer0_d(void); void ports_e(void); void timer0_e(void); void timer2_e(void); void timer2_d(void); void ports_d(void); void LEDs_d(void); void LEDs_r (uint16_t R, uint16_t G, uint16_t B); void LEDs_e(uint16_t R, uint16_t G, uint16_t B); void LEDs_l (uint16_t R, uint16_t G, uint16_t B); void LEDs_l (uint16_t R, uint16_t G, uint16_t B); _Bool count_direction = true; _Bool LEDs_ON = false; _Bool wake_UP_1 = false; _Bool multiple_functions = false; // Voltage Reference: Int., cap. on AREF #define ADC_VREF_TYPE ((1<<REFS1) | (1<<REFS0) | (1<<ADLAR)) // Read the 8 most significant bits // of the AD conversion result unsigned char read_adc(unsigned char adc_input) { ADMUX=adc_input | ADC_VREF_TYPE; // Delay needed for the stabilization of the ADC input voltage for(int delay = 0; delay < 5; delay++){} // Start the AD conversion ADCSRA|=(1<<ADSC); // Wait for the AD conversion to complete while ((ADCSRA & (1<<ADIF))==0); ADCSRA|=(1<<ADIF); return ADCH;//ADCH; } void control (void) { if(charging) { if(!(PINE & (1<<PINE3))) { charging = 0; sleep(); } } //If device is if (eslp) { // if(PINB & (1<<ON)) { count0=count0+10; if (count0>=2000) { if(!(PINE & (1<<PINE3))) { LEDs_ON = true; } startup(); } } // else { if(!(PINE & (1<<PINE3))) { count0=count0+10; if (count0>=2000) { sleep(); } } } } //if device is not sleeping else if (!eslp) { if((PINB & (1<<ON))) { if(!(PINE & (1<<PINE3))) { button_pressed = true; count0=count0+10; if (count0>=2000) { sleep(); } } } else { count0=0; } } } ISR (TIMER1_OVF_vect) { multiple_functions = true; } ISR (TIMER2_OVF_vect) { count2++; if (count2>=200) { read_ADC_1 = true; count2=0; } dim_counter++; } //Interrupt at UP button. Wake up to check UP button to turn on. ISR (PCINT0_vect) { if(PINB & (1<<ON)) { count0=0; wake_UP_1 = true; } else { wake_UP_1 = false; sleep(); } } int main(void) { cli(); init_MCU(); sei(); while (1) { for(int delay = 0; delay < 1; delay++){;} //delay to ensure stability of the compiler brightness++; if(!(PINB & (1<<ON)) && button_pressed) { button_pressed = false; if (!start) {mode++;} else {start = 0;} if(mode >= 11) { mode = 0; } } if (read_ADC_1 == true) { read_ADC_1 = false; DDRD |= (1<<DDD6); vin=read_adc(6); DDRD &=~ (1<<DDD6); } if((PINE & (1<<PINE3)) && !LEDs_ON) { LEDs_e(50, 50, 50); charging = 1; } if(LEDs_ON) { if(vin <= 175) { vin = 225; sleep(); } if(mode <= 5) { LEDs_l(LED_red_l, LED_green_l, LED_blue_l); LEDs_r(LED_red_r, LED_green_r, LED_blue_r); } else { LEDs_e(LED_red, LED_green, LED_blue); } if(dim_counter >= 0x00F0) { dim_counter = 0; if(dim >= 0.6) { count_direction = false; } else if (dim <= 0.1) { count_direction = true; dim_end = !dim_end; } if (count_direction) { dim+=0.01; } else if (!count_direction) { dim-=0.01; } if(mode == 0) { LED_red_r = 43; LED_green_r = 25; LED_blue_r = 20; LED_red_l = 255; LED_green_l = 150; LED_blue_l = 120; } else if(mode == 1) { LED_red_r = 15; LED_green_r = 0; LED_blue_r = 255; LED_red_l = 15; LED_green_l = 208; LED_blue_l = 255; } else if(mode == 2) { LED_red_r = 15; LED_green_r = 208; LED_blue_r = 255; LED_red_l = 6; LED_green_l = 255; LED_blue_l = 40; } else if(mode == 3) { LED_red_r = 6; LED_green_r = 255; LED_blue_r = 40; LED_red_l = 255; LED_green_l = 30; LED_blue_l = 30; } else if(mode == 4) { LED_red_r = 255; LED_green_r = 30; LED_blue_r = 30; LED_red_l = 15; LED_green_l = 0; LED_blue_l = 255; } else if(mode == 5) { LED_red_r = 177; LED_green_r = 255; LED_blue_r = 60; LED_red_l = 30; LED_green_l = 0; LED_blue_l = 255; } if (!dim_end) { if (mode == 6) { LED_red = 15*dim; LED_green = 0; LED_blue = 254*dim; } else if (mode == 7) { LED_red = 15*dim; LED_green = 208*dim; LED_blue = 254*dim; } else if (mode == 8) { LED_red = 6*dim; LED_green = 254*dim; LED_blue = 40*dim; } else if (mode == 9) { LED_red = 254*dim; LED_green = 30*dim; LED_blue = 30*dim; } else if (mode == 10) { LED_red = 177*dim; LED_green = 254*dim; LED_blue = 60*dim; } } else if(dim_end) { if(mode == 6) { LED_red = 15*dim; LED_green = 208*dim; LED_blue = 254*dim; } else if (mode == 7) { LED_red = 6*dim; LED_green = 254*dim; LED_blue = 40*dim; } else if (mode == 8) { LED_red = 254*dim; LED_green = 15*dim; LED_blue = 15*dim; } else if (mode == 9) { LED_red = 15*dim; LED_green = 0; LED_blue = 254*dim; } else if (mode == 10) { LED_red = 30*dim; LED_green = 0; LED_blue = 254*dim; } } } } //Wake up if(wake_UP_1 == true) { wake_UP_1 = false; wakeup(); } //Run control function if (multiple_functions == true) { multiple_functions = false; control(); } if(brightness >= 255) { brightness = 0; } // LEDs control } } void sleep(void) { cli(); LEDs_ON=false; eslp = 1; count0=0; PCMSK0 |= (1<<PCINT7); LEDs_d(); timer0_d(); timer1_d(); timer2_d(); adc_d(); ports_d(); set_sleep_mode(SLEEP_MODE_PWR_DOWN); sleep_enable(); sei(); //ensure interrupts enabled so we can wake up again sleep_cpu(); //go to sleep } void wakeup(void) { sleep_disable(); cli(); count0=0; eslp=1; ports_e(); timer1_e(); PCMSK0 &= ~(1<<PCINT7); sei(); } void startup(void) { cli(); adc_e(); count0=0; mode = 0; start = 1; timer0_e(); timer2_e(); eslp=0; sei(); } void init_MCU(void) { // Crystal Oscillator division factor: 8 CLKPR=(1<<CLKPCE); CLKPR=(0<<CLKPCE) | (0<<CLKPS3) | (0<<CLKPS2) | (0<<CLKPS1) | (0<<CLKPS0); // Timer/Counter 0 initialization TCCR0A=(1<<COM0A1) | (0<<COM0A0) | (0<<COM0B1) | (0<<COM0B0) | (1<<WGM01) | (1<<WGM00); TCCR0B=(0<<WGM02) | (0<<CS02) | (0<<CS01) | (1<<CS00); TCNT0=0x00; OCR0A=0x00; OCR0B=0x00; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: 8000.000 kHz // Mode: OVF // TOP: 0xFFFF // TIME 8.2 ms TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (0<<COM1B1) | (0<<COM1B0) | (0<<WGM11) | (0<<WGM10); TCCR1B=(0<<ICNC1) | (0<<ICES1) | (0<<WGM13) | (0<<WGM12) | (0<<CS12) | (0<<CS11) | (1<<CS10); TCNT1H=0x00; TCNT1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; ICR1H=0x00; ICR1L=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: 1 MHz // Mode: Normal top=0xFF // OC2A output: Disconnected // OC2B output: Disconnected // Timer Period: 255us ASSR=(0<<EXCLK) | (0<<AS2); TCCR2A=(0<<COM2A1) | (0<<COM2A0) | (0<<COM2B1) | (0<<COM2B0) | (0<<WGM21) | (0<<WGM20); TCCR2B=(0<<WGM22) | (0<<CS22) | (0<<CS21) | (1<<CS20); TCNT2=0x00; OCR2A=0xFF; OCR2B=0x00; // Timer/Counter 0 Interrupt(s) initialization TIMSK0=(0<<OCIE0B) | (0<<OCIE0A) | (0<<TOIE0); // Timer/Counter 1 Interrupt(s) initialization TIMSK1=(0<<ICIE1) | (0<<OCIE1B) | (0<<OCIE1A) | (1<<TOIE1); // Timer/Counter 2 Interrupt(s) initialization TIMSK2=(0<<OCIE2B) | (0<<OCIE2A) | (1<<TOIE2); // External Interrupt(s) initialization // INT0: Off // INT1: Off // Interrupt on any change on pins PCINT0-7: On // Interrupt on any change on pins PCINT8-14: Off // Interrupt on any change on pins PCINT16-23: Off EICRA=(0<<ISC11) | (0<<ISC10) | (0<<ISC01) | (0<<ISC00); EIMSK=(0<<INT1) | (0<<INT0); PCICR=(0<<PCIE2) | (0<<PCIE1) | (1<<PCIE0); PCMSK0=(0<<PCINT7) | (0<<PCINT6) | (0<<PCINT5) | (0<<PCINT4) | (0<<PCINT3) | (0<<PCINT2) | (0<<PCINT1) | (0<<PCINT0); PCIFR=(0<<PCIF2) | (0<<PCIF1) | (1<<PCIF0); // Analog Comparator initialization // Analog Comparator: Off // The Analog Comparator's positive input is // connected to the AIN0 pin // The Analog Comparator's negative input is // connected to the AIN1 pin ACSR=(1<<ACD) | (0<<ACBG) | (0<<ACO) | (0<<ACI) | (0<<ACIE) | (0<<ACIC) | (0<<ACIS1) | (0<<ACIS0); // Digital input buffer on AIN0: On // Digital input buffer on AIN1: On DIDR1=(0<<AIN0D) | (0<<AIN1D); // ADC initialization // ADC Clock frequency: 1000.000 kHz // ADC Voltage Reference: Int., cap. on AREF // ADC Auto Trigger Source: Free Running // Only the 8 most significant bits of // the AD conversion result are used // Digital input buffers on ADC0: On, ADC1: On, ADC2: On, ADC3: On // ADC4: On, ADC5: On DIDR0=(0<<ADC5D) | (0<<ADC4D) | (0<<ADC3D) | (0<<ADC2D) | (0<<ADC1D) | (0<<ADC0D); ADMUX=ADC_VREF_TYPE; ADCSRA=(1<<ADEN) | (0<<ADSC) | (1<<ADATE) | (0<<ADIF) | (0<<ADIE) | (0<<ADPS2) | (1<<ADPS1) | (1<<ADPS0); ADCSRB=(0<<ADTS2) | (0<<ADTS1) | (0<<ADTS0); // SPI initialization // SPI disabled SPCR=(0<<SPIE) | (0<<SPE) | (0<<DORD) | (0<<MSTR) | (0<<CPOL) | (0<<CPHA) | (0<<SPR1) | (0<<SPR0); // TWI initialization // TWI disabled TWCR=(0<<TWEA) | (0<<TWSTA) | (0<<TWSTO) | (0<<TWEN) | (0<<TWIE); // USART initialization // USART disabled UCSR0B=(0<<RXCIE0) | (0<<TXCIE0) | (0<<UDRIE0) | (0<<RXEN0) | (0<<TXEN0) | (0<<UCSZ02) | (0<<RXB80) | (0<<TXB80); // ADC initialization // ADC Clock frequency: 1000.000 kHz // ADC Voltage Reference: Int., cap. on AREF // ADC Auto Trigger Source: Free Running // Only the 8 most significant bits of // the AD conversion result are used // Digital input buffers on ADC0: On, ADC1: On, ADC2: On, ADC3: On // ADC4: On, ADC5: On DIDR0=(0<<ADC5D) | (0<<ADC4D) | (0<<ADC3D) | (0<<ADC2D) | (0<<ADC1D) | (0<<ADC0D); ADMUX=ADC_VREF_TYPE; ADCSRA=(1<<ADEN) | (0<<ADSC) | (1<<ADATE) | (0<<ADIF) | (0<<ADIE) | (0<<ADPS2) | (1<<ADPS1) | (1<<ADPS0); ADCSRB=(0<<ADTS2) | (0<<ADTS1) | (0<<ADTS0); // SPI initialization // SPI disabled SPCR=(0<<SPIE) | (0<<SPE) | (0<<DORD) | (0<<MSTR) | (0<<CPOL) | (0<<CPHA) | (0<<SPR1) | (0<<SPR0); // TWI initialization // TWI disabled TWCR=(0<<TWEA) | (0<<TWSTA) | (0<<TWSTO) | (0<<TWEN) | (0<<TWIE); DDRB=(0<<DDRB7) | (1<<DDB6) | (1<<DDB5) | (1<<DDB4) | (1<<DDB3) | (1<<DDB2) | (1<<DDB1) | (1<<DDB0); PORTB=(0<<PINB7); DDRC=(1<<DDC6) | (1<<DDC5) | (1<<DDC4) | (1<<DDC3) | (1<<DDC2) | (1<<DDC1) | (1<<DDC0); DDRD=(1<<DDD7) | (1<<DDD6) | (1<<DDD5) | (1<<DDD4) | (1<<DDD3) | (1<<DDD2) | (1<<DDD1) | (1<<DDD0); PORTD=(0<<PIND6); DDRE = (0<<DDD3); PORTE=(0<<PIND3); } void timer0_e (void) { TCCR0A=(1<<COM0A1) | (0<<COM0A0) | (0<<COM0B1) | (0<<COM0B0) | (1<<WGM01) | (1<<WGM00); TCCR0B=(0<<WGM02) | (0<<CS02) | (0<<CS01) | (1<<CS00); TCNT0=0x00; OCR0A=0x00; OCR0B=0x00; TIMSK0=(0<<OCIE0B) | (0<<OCIE0A) | (0<<TOIE0); } void timer0_d (void) { TCCR0A=(0<<COM0A1) | (0<<COM0A0) | (0<<COM0B1) | (0<<COM0B0) | (0<<WGM01) | (0<<WGM00); TCCR0B=(0<<WGM02) | (0<<CS02) | (0<<CS01) | (0<<CS00); TCNT0=0x00; OCR0A=0x00; OCR0B=0x00; TIMSK0=(0<<OCIE0B) | (0<<OCIE0A) | (0<<TOIE0); } void timer1_e (void) { TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (0<<COM1B1) | (0<<COM1B0) | (0<<WGM11) | (0<<WGM10); TCCR1B=(0<<ICNC1) | (0<<ICES1) | (0<<WGM13) | (0<<WGM12) | (0<<CS12) | (0<<CS11) | (1<<CS10); TCNT1H=0x00; TCNT1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; ICR1H=0x00; ICR1L=0x00; TIMSK1=(0<<ICIE1) | (0<<OCIE1B) | (0<<OCIE1A) | (1<<TOIE1); } void timer1_d (void) { TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (0<<COM1B1) | (0<<COM1B0) | (0<<WGM11) | (0<<WGM10); TCCR1B=(0<<ICNC1) | (0<<ICES1) | (0<<WGM13) | (0<<WGM12) | (0<<CS12) | (0<<CS11) | (0<<CS10); TCNT1H=0x00; TCNT1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; ICR1H=0x00; ICR1L=0x00; TIMSK1=(0<<ICIE1) | (0<<OCIE1B) | (0<<OCIE1A) | (0<<TOIE1); } void timer2_e (void) { ASSR=(0<<EXCLK) | (0<<AS2); TCCR2A=(0<<COM2A1) | (0<<COM2A0) | (0<<COM2B1) | (0<<COM2B0) | (0<<WGM21) | (1<<WGM20); TCCR2B=(0<<WGM22) | (0<<CS22) | (0<<CS21) | (1<<CS20); TCNT2=0x00; OCR2A=0xFF; OCR2B=0x00; TIMSK2=(0<<OCIE2B) | (0<<OCIE2A) | (1<<TOIE2); } void timer2_d (void) { ASSR=(0<<EXCLK) | (0<<AS2); TCCR2A=(0<<COM2A1) | (0<<COM2A0) | (0<<COM2B1) | (0<<COM2B0) | (0<<WGM21) | (0<<WGM20); TCCR2B=(0<<WGM22) | (0<<CS22) | (0<<CS21) | (0<<CS20); TCNT2=0x00; OCR2A=0x00; OCR2B=0x00; TIMSK2=(0<<OCIE2B) | (0<<OCIE2A) | (0<<TOIE2); } void adc_e (void) { DIDR0=(0<<ADC5D) | (0<<ADC4D) | (0<<ADC3D) | (0<<ADC2D) | (0<<ADC1D) | (0<<ADC0D); ADMUX=ADC_VREF_TYPE; ADCSRA=(1<<ADEN) | (0<<ADSC) | (1<<ADATE) | (0<<ADIF) | (0<<ADIE) | (0<<ADPS2) | (1<<ADPS1) | (1<<ADPS0); ADCSRB=(0<<ADTS2) | (0<<ADTS1) | (0<<ADTS0); } void adc_d (void) { DIDR0=(0<<ADC5D) | (0<<ADC4D) | (0<<ADC3D) | (0<<ADC2D) | (0<<ADC1D) | (0<<ADC0D); ADMUX=ADC_VREF_TYPE; ADCSRA=(0<<ADEN) | (0<<ADSC) | (1<<ADATE) | (0<<ADIF) | (0<<ADIE) | (0<<ADPS2) | (1<<ADPS1) | (1<<ADPS0); ADCSRB=(0<<ADTS2) | (0<<ADTS1) | (0<<ADTS0); } void LEDs_d (void) { LEDs_ON=false; PORTB=(0<<PINB6) | (0<<PINB5) | (0<<PINB4) | (0<<PINB3) | (0<<PINB2) | (0<<PINB1) | (0<<PINB0); PORTC=(0<<PINC6) | (0<<PINC5) | (0<<PINC4) | (0<<PINC3) | (0<<PINC2) | (0<<PINC1) | (0<<PINC0); PORTD=(0<<PIND7) | (0<<PIND6) | (0<<PIND5) | (0<<PIND4) | (0<<PIND3) | (0<<PIND2) | (0<<PIND1) | (0<<PIND0); } /* B G R LED1: PB0 PD7 PD5 LED2: PB3 PB2 PB1 LED3: PC0 PB5 PB4 LED4: PC3 PC2 PC1 LED5: PC6 PC5 PC4 LED6: PD0 PD1 PD2 LED7: PD3 PD4 PB6 */ void LEDs_e (uint16_t R, uint16_t G, uint16_t B) { if (B >= brightness ) { PORTB|=(1<<PINB3) | (1<<PINB0); PORTC|=(1<<PINC6) | (1<<PINC3) | (1<<PINC0); PORTD|=(1<<PIND3) | (1<<PIND0); } else { PORTB&=!((1<<PINB3) | (1<<PINB0)); PORTC&=!((1<<PINC6) | (1<<PINC3) | (1<<PINC0)); PORTD&=!((1<<PIND3) | (1<<PIND0)); } if (G >= brightness ) { PORTB|=(1<<PINB5) | (1<<PINB2); PORTC|=(1<<PINC5) | (1<<PINC2); PORTD|=(1<<PIND7) | (1<<PIND4) | (1<<PIND1); } else { PORTB&=!((1<<PINB5) | (1<<PINB2)); PORTC&=!((1<<PINC5) | (1<<PINC2)); PORTD&=!((1<<PIND7) | (1<<PIND4) | (1<<PIND1)); } if(R >= brightness ) { PORTB|=(1<<PINB6) | (1<<PINB4) | (1<<PINB1); PORTC|=(1<<PINC4) | (1<<PINC1); PORTD|=(1<<PIND5) | (1<<PIND2); } else { PORTB&=!((1<<PINB6) | (1<<PINB4) | (1<<PINB1)); PORTC&=!((1<<PINC4) | (1<<PINC1)); PORTD&=!((1<<PIND5) | (1<<PIND2)); } } /* B G R LED1: PB0 PD7 PD5 LED2: PB3 PB2 PB1 LED3: PC0 PB5 PB4 LED4: PC3 PC2 PC1 LED5: PC6 PC5 PC4 LED6: PD0 PD1 PD2 LED7: PD3 PD4 PB6 */ void LEDs_l (uint16_t R, uint16_t G, uint16_t B) { if (B >= brightness ) { PORTB|=(1<<PINB3) | (1<<PINB0); PORTC|=(1<<PINC3) | (1<<PINC0); } else { PORTB&=!((1<<PINB3) | (1<<PINB0)); PORTC&=!((1<<PINC3) | (1<<PINC0)); } if (G >= brightness ) { PORTB|=(1<<PINB5) | (1<<PINB2); PORTC|=(1<<PINC2); PORTD|=(1<<PIND7); } else { PORTB&=!((1<<PINB5) | (1<<PINB2)); PORTC&=!(1<<PINC2); PORTD&=!(1<<PIND7); } if(R >= brightness ) { PORTB|=(1<<PINB4) | (1<<PINB1); PORTC|=(1<<PINC1); PORTD|=(1<<PIND5); } else { PORTB&=!((1<<PINB4) | (1<<PINB1)); PORTC&=!(1<<PINC1); PORTD&=!(1<<PIND5); } } /* B G R LED1: PB0 PD7 PD5 LED2: PB3 PB2 PB1 LED3: PC0 PB5 PB4 LED4: PC3 PC2 PC1 LED5: PC6 PC5 PC4 LED6: PD0 PD1 PD2 LED7: PD3 PD4 PB6 */ void LEDs_r (uint16_t R, uint16_t G, uint16_t B) { if (B >= brightness ) { PORTC|=(1<<PINC6); PORTD|=(1<<PIND3) | (1<<PIND0); } else { PORTC&=!(1<<PINC6); PORTD&=!((1<<PIND3) | (1<<PIND0)); } if (G >= brightness ) { PORTC|=(1<<PINC5); PORTD|=(1<<PIND4) | (1<<PIND1); } else { PORTC&=!((1<<PINC5)); PORTD&=!((1<<PIND4) | (1<<PIND1)); } if(R >= brightness ) { PORTB|=(1<<PINB6); PORTC|=(1<<PINC4); PORTD|=(1<<PIND2); } else { PORTB&=!(1<<PINB6); PORTC&=!(1<<PINC4); PORTD&=!(1<<PIND2); } } void ports_d (void) { DDRB=(0<<DDRB7) | (0<<DDB6) | (0<<DDB5) | (0<<DDB4) | (0<<DDB3) | (0<<DDB2) | (0<<DDB1) | (0<<DDB0); PORTB=(0<<PINB7); DDRC=(0<<DDC6) | (0<<DDC5) | (0<<DDC4) | (0<<DDC3) | (0<<DDC2) | (0<<DDC1) | (0<<DDC0); DDRD=(0<<DDD7) | (0<<DDD6) | (0<<DDD5) | (0<<DDD4) | (0<<DDD3) | (0<<DDD2) | (0<<DDD1) | (0<<DDD0); PORTD=(0<<PIND6); DDRE = (0<<DDD3); PORTE=(0<<PIND3); } void ports_e(void) { DDRB=(0<<DDRB7) | (1<<DDB6) | (1<<DDB5) | (1<<DDB4) | (1<<DDB3) | (1<<DDB2) | (1<<DDB1) | (1<<DDB0); PORTB=(0<<PINB7); DDRC=(1<<DDC6) | (1<<DDC5) | (1<<DDC4) | (1<<DDC3) | (1<<DDC2) | (1<<DDC1) | (1<<DDC0); DDRD=(1<<DDD7) | (1<<DDD6) | (1<<DDD5) | (1<<DDD4) | (1<<DDD3) | (1<<DDD2) | (1<<DDD1) | (1<<DDD0); PORTD=(0<<PIND6); DDRE = (0<<DDD3); PORTE=(0<<PIND3); }







DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.

Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW
ESP32-S3 4.3inch Capacitive Touch Display Development Board, 800×480, 5-point Touch, 32-bit LX7 Dual-core Processor
BUY NOW
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(2)
- Likes(2)

- Yorik van HavreFeb 19,20240 CommentsReply
- Kjell MorgensternFeb 16,20240 CommentsReply
-
Engineer Sep 29,2024
-
Nick Electronics Dec 06,2023
- 3 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10

-
10design
-
9usability
-
10creativity
-
10content

-
8design
-
7usability
-
8creativity
-
7content

-
10design
-
7usability
-
10creativity
-
10content
More by Nick Electronics
-
Minimalistic Soil Moisture Sensor Youtube video -----> https://youtu.be/oqFGDM0aIfchttps://www.youtube.com/@NickElectronicsDescript...
-
DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case (3rd PCB) DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case (3rd PCB)Third board of the proj...
-
DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case (2nd PCB) Second board of the project DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case (2nd...
-
DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case DIY LED Resin Sticker with Custom Electronics & 3D-Printed CaseYoutube video -----> https://y...
-
DIY LED Resin Sticker with Custom Electronics & 3D-Printed Case DIY LED Resin Sticker with Custom Electronics & 3D-Printed CaseYoutube video -----> https://y...
-
-
Nintendo 64DD Replacement Shell
111 0 1 -
V2 Commodore AMIGA USB-C Power Sink Delivery High Efficiency Supply Triple Output 5V ±12V OLED display ATARI compatible shark 100W
194 4 1 -
How to measure weight with Load Cell and HX711
350 0 3 -
-
Instrumentation Input, high impedance with 16 bit 1MSPS ADC for SPI
485 0 0 -
RGB LED Matrix input module for the Framework Laptop 16
756 0 2