Hey Everyone what's up.So here's one of the previous projects I made a few weeks ago.Voronoi Diagram-Based PCB Lamp is an RGB Lamp made entirely from PCBs, I used four rectangular PCBs with two square PCBs to make the body of the LAMP.RGB Color in this Lamp can be changed by pressing the button on top of it, this button is connected with the lower square board that contains the RGB LEDs and the Attiny85 Microcontroller.SUPPLIESAttiny85 SOIC8Custom PCBs- Main Square MCU PCB and Rectangular PCBWS2812B LEDs (2020 Package)USB Type C PortDiode M72R0 Resistor 1206 PackageArduino as ISP Setup for flashing the MCUSMD buttonUC202 Connector and wire harnessSolder wirePROBLEM IN PREVIOUS EDITIONVersion 1 of this project had a few issues, including the wrong footprint issue for the RGB LED and the Gap Issue between two rectangular boards.For solving the Gap Issue, I made the Square PCBs (Microcontroller board and switchboard) a little bit smaller than their previous version.I decreased the square length by 1mm from all the sides and this was the result.As for the RGB LED issue, I added SMD WS2812B 2020 Package LED on the top side of the PCB and that solved the RGB LED issue.PCB DesignThis was the schematic I used in this built, it contains an Attiny85 connected with four RGB LEDs that are all powered by a USB Type C Port which has a Diode and a Load resistor in series to limit the output current.After finalizing the schematic, I converted it into a board file and prepared two PCBs that were 1mm shorter from all sides.This Length reduction thing was crucial as it controls the gap that occurs during the final soldering process of Side PCBs.PCBWAY REVIEWAfter finalizing the PCBs, I send both PCBs to PCBWAY for samples.I choose a white soldermask with Black Silkscreen and placed the order.After waiting for a week, PCBs arrived and their quality was super good.Overall, there was no error whatsoever and these PCBs that I made were complex.Loved how each detail I made in this PCB was proper and perfect.Check out PCBWAY for getting great PCB service for less cost!PCB ASSEMBLY PROCESSPCB Assembly Process consists of five major steps that includeRemoving Conjoined PCBsSolder Paste Dispensing ProcessPick & place processHotplate reflowSwitch and connector PCB assemblyRemoving Conjoined PCBsWhile Designing the Square PCBs, I made two separate boards, one for microcontroller setup and one for the switch that also acts as a Lid of the Lamp.If I made two PCBs and placed an order for them separately, that would've cost a lot so in order to save a few bucks, I connected two same-size square boards together with two RIBs that can be easily cut down to separate two PCBs.This saves a lot of costs and it's a pretty neat method of combining two or more orders together, it's a kind of PCB Paneling.Solder Paste Dispensing ProcessWe apply solder paste with a solder paste dispenser syringe or the proper method is to use stencil here which I don't have. but anyway, after this, we can now move on to the next process, which is to add components to each pad.Pick & place processNext, we carefully pick all the components with an ESD tweezer and place them in their assigned place one by one.Hotplate reflowThen after doing the pick and place process, we carefully lifted the whole PCB and place it on the hotplate.Basically, in this hotplate reflow process, the surface heats up to the solder paste melting temp and it slowly melts. after a few mins when the solder paste completely melts, we remove the PCB and let it cool down for a moment.Switch and connector PCB assemblyI then added SMD Button and UC202 connector manually with help of a soldering iron.CODEHere's the code I used in this project, it's based around Adafruit's neopixel library so you need to download that before using this sketch.As for Uploading this sketch into the Attiny, do check out this post of mine.#include <Adafruit_NeoPixel.h>
#define BUTTON_PIN 4 //D1- 5// driven with a pull-up resistor so the switch should// pull the pin to ground momentarily. On a high -> low// transition the button press logic will execute.
#define PIXEL_PIN 0 // Digital IO pin connected to the NeoPixels.//D4 - 2
#define PIXEL_COUNT 4
// Parameter 1 = number of pixels in strip, neopixel stick has 8
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream, correct for neopixel stick
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
bool oldState = HIGH;
int showType = 0;
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
// Get current button state.bool newState = digitalRead(BUTTON_PIN);
// Check if state changed from high to low (button press).if (newState == LOW && oldState == HIGH) {
// Short delay to debounce button.
delay(20);
// Check if button is still low after debounce.
newState = digitalRead(BUTTON_PIN);
if (newState == LOW) {
showType++;
if (showType > 9)
showType=0;
startShow(showType);
}
}
// Set the last button state to the old state.
oldState = newState;
}
void startShow(int i) {
switch(i){
case 0: colorWipe(strip.Color(0, 0, 0), 50); // Black/offbreak;
case 1: colorWipe(strip.Color(255, 0, 0), 50); // Redbreak;
case 2: colorWipe(strip.Color(0, 255, 0), 50); // Greenbreak;
case 3: colorWipe(strip.Color(0, 0, 255), 50); // Bluebreak;
case 4: theaterChase(strip.Color(127, 127, 127), 50); // Whitebreak;
case 5: theaterChase(strip.Color(127, 0, 0), 50); // Redbreak;
case 6: theaterChase(strip.Color( 0, 0, 127), 50); // Bluebreak;
case 7: rainbow(20);
break;
case 8: rainbowCycle(20);
break;
case 9: theaterChaseRainbow(50);
break;
}
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}
void rainbow(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i+j) & 255));
}
strip.show();
delay(wait);
}
}
// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheelfor(i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(wait);
}
}
//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
for (int j=0; j<10; j++) { //do 10 cycles of chasingfor (int q=0; q < 3; q++) {
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, c); //turn every third pixel on
}
strip.show();
delay(wait);
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}
//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
for (int j=0; j < 256; j++) { // cycle all 256 colors in the wheelfor (int q=0; q < 3; q++) {
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, Wheel( (i+j) % 255)); //turn every third pixel on
}
strip.show();
delay(wait);
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
Rectangular Board Main assemblyAfter testing the Main MCU working, we can now move on to the final process which is to put everything together and start the assembly process.I first added solder wire on one side of the soldering padafter placing the Main PCB in its right position, I joined its soldering pad with the soldering pad of the wall PCB. I then added solder wire on another side as well.I then placed the switch PCB with the same method in its place and added other wall PCBs on both sides by soldering their pads together.Final ResultHere's the final result with no Gap issue and no LED issue this time.Conclusion and V3This LAMP does work but there's still a flaw in this project.I accidentally made the wrong connections to the LED which I edited out by adding a few jumper wires and disconnecting existing connections for the LED.Here's how I corrected things, followed the right connections, and made changes to PCB Design.This is it for today, Leave a comment if you guys need any help, and I'll be back with another project soon!Thanks, PCBWAY for supporting this project, Do check PCBWAY for getting great PCB service for less cost!Peace