zst123
Published

Colorful Circuit Board Artwork using PCBWay

Sharing my experience in creating unique color PCB artwork

IntermediateFull instructions provided24 hours250

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
ESP32
Espressif ESP32
×1

Software apps and online services

MicroPython
MicroPython

Story

Read more

Code

Hardware Demo Code

C/C++
Arduino code
/**
 * [Hardware Demo Code]
 * Board: ESP32S3 Dev Module
 * Library: Adafruit_GC9A01A:1.1.1,
 *          Adafruit_NeoPixel:1.11.0
 */

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_GC9A01A.h"
#include "Adafruit_NeoPixel.h"
#include "Fonts/FreeSerifBold12pt7b.h"
#include "Fonts/FreeSerifBold18pt7b.h"

/***** NeoPixel Library *****/
#define NEO_PIN    (45)
#define NEO_PIXELS (8)
#define NEO_MODE   (NEO_GRB + NEO_KHZ800)
Adafruit_NeoPixel pixels(NEO_PIXELS, NEO_PIN, NEO_MODE);

/***** GC9A01 Library *****/
#define TFT_DC   10
#define TFT_CS   11
#define TFT_SCK  12
#define TFT_MOSI 13
#define TFT_RST  14
#define TFT_MISO -1

SPIClass TFTSPI(FSPI);
Adafruit_GC9A01A tft(&TFTSPI, TFT_DC, TFT_CS, TFT_RST);

/***** User Code *****/
void setup() {
  /***** Init NeoPixel *****/
  pixels.begin();
  pixels.setBrightness(255);
  for(int i = 0; i < pixels.numPixels(); i++) { 
    uint16_t pixelHue = (65535L * 1.0 / pixels.numPixels() * i);
    pixels.setPixelColor(i, pixels.gamma32(pixels.ColorHSV(pixelHue, 255, 50)));
  }
  pixels.show();

  /***** Init GC9A01 *****/
  TFTSPI.begin(TFT_SCK, TFT_MISO, TFT_MOSI, TFT_CS);
  tft.begin();
  tft.setRotation(2);
}

void loop(void) {
  for (int i = 0; i < 2; i++) {
    demo(i);
    delay(2000);
  }
}

void drawCentreString(const char *buf, int x, int y) {
  int16_t x1, y1;
  uint16_t w, h;
  tft.getTextBounds(buf, 0, 0, &x1, &y1, &w, &h); //calc width of new string
  tft.setCursor(x-w/2, y-h/2);
  tft.print(buf);
}

void demo(int variant) {
  unsigned long start = micros();

  uint16_t color1;
  uint16_t color2;
  
  if (variant == 0) {
    color1 = GC9A01A_YELLOW;
    color2 = GC9A01A_RED;
  } else if (variant == 1) {
    color1 = GC9A01A_RED;
    color2 = GC9A01A_YELLOW;
  }

  tft.setTextSize(1);
  tft.fillRect(0, 0, 240, 240/2, color1);
  tft.fillRect(0, 240/2, 240, 240/2, color2);

  tft.setTextColor(color2);
  tft.setFont(&FreeSerifBold18pt7b);
  drawCentreString("Bunny PCB", 240*0.5, 240*0.35);
  tft.setFont(&FreeSerifBold12pt7b);
  drawCentreString("Circuit Board Artwork", 240*0.5, 240*0.47);
  
  tft.setTextColor(color1);
  tft.setFont(&FreeSerifBold12pt7b);
  drawCentreString("Red & Yellow", 240*0.5, 240*0.65);
  drawCentreString("color combination", 240*0.5, 240*0.765);
  drawCentreString("with PCBWay!", 240*0.5, 240*0.88);
}

Credits

zst123

zst123

12 projects • 26 followers
An infocomm and electronics enthusiast. https://www.manzelseet.com

Comments