Siddhant gupta
Published © CC BY

ORBIT-Q: Introduction to the Board

ORBIT-Q: One dev board, swappable M.2 MCU cards. Keep your power supply, debugger & peripherals — just change the chip.

IntermediateShowcase (no instructions)5 days29
ORBIT-Q: Introduction to the Board

Things used in this project

Hardware components

ORBIT-Q
ORBIT-Q
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Orbit-Q Datasheet

Code

Orbit-Q intro

C/C++
introductory code on arduino ide
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_NeoPixel.h>
#include <Fonts/FreeSansBold9pt7b.h>
#include <Fonts/FreeSans9pt7b.h>

/* =======================
   MCU / BOARD DEFINES
   ======================= */
#define PC13_LED    PC13

/* =======================
   WS2812B CONFIG
   ======================= */
#define WS_PIN      PB3
#define NUMPIXELS   10
#define BRIGHTNESS  22

Adafruit_NeoPixel pixels(NUMPIXELS, WS_PIN, NEO_GRB + NEO_KHZ800);

/* =======================
   OLED CONFIG
   ======================= */
#define SCREEN_WIDTH  128
#define SCREEN_HEIGHT 32
#define OLED_RESET    -1
#define OLED_ADDR     0x3C

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

/* =======================
   TIMERS
   ======================= */
unsigned long pc13Millis = 0;
unsigned long wsMillis   = 0;

bool pc13State = false;

/* =======================
   FUNCTION DECLARATIONS
   ======================= */
void blinkPC13();
void runWS2812();
void ntxBootAnimation();
void keepOLEDAlive();

/* =======================
   SETUP
   ======================= */
void setup() {
  pinMode(PC13_LED, OUTPUT);
  digitalWrite(PC13_LED, HIGH); // OFF (active low)

  pinMode(WS_PIN, OUTPUT);
  pixels.begin();
  pixels.setBrightness(BRIGHTNESS);
  pixels.clear();
  pixels.show();

  /* OLED power-up delay */
  delay(300);

  if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR)) {
    while (1);
  }

  delay(100);
  ntxBootAnimation();
}

/* =======================
   LOOP
   ======================= */
void loop() {
  blinkPC13();
  runWS2812();
  keepOLEDAlive();
}

/* =======================
   PC13 HEARTBEAT
   ======================= */
void blinkPC13() {
  if (millis() - pc13Millis >= 500) {
    pc13Millis = millis();
    pc13State = !pc13State;
    digitalWrite(PC13_LED, pc13State ? LOW : HIGH);
  }
}

/* =======================
   WS2812 ANIMATIONS
   ======================= */
void runWS2812() {
  static uint8_t mode = 0;
  static uint16_t hue = 0;
  static int index = 0;
  static uint8_t breath = 0;
  static bool rising = true;

  if (millis() - wsMillis < 30) return;
  wsMillis = millis();

  switch (mode) {
    case 0: // boot scan
      pixels.clear();
      pixels.setPixelColor(index, pixels.Color(255, 0, 0));
      pixels.show();
      index++;
      if (index >= NUMPIXELS) {
        index = 0;
        mode = 1;
      }
      break;

    case 1: // rainbow
      for (int i = 0; i < NUMPIXELS; i++) {
        pixels.setPixelColor(i,
          pixels.gamma32(pixels.ColorHSV(hue + i * 65536L / NUMPIXELS)));
      }
      pixels.show();
      hue += 128;
      if (hue >= 65535) {
        hue = 0;
        mode = 2;
        breath = 0;
        rising = true;
      }
      break;

    case 2: // breathing blue
      pixels.setBrightness(breath);
      pixels.fill(pixels.Color(0, 0, 255));
      pixels.show();

      if (rising) {
        breath++;
        if (breath >= BRIGHTNESS) rising = false;
      } else {
        if (breath > 0) breath--;
        else {
          pixels.setBrightness(BRIGHTNESS);
          mode = 1;
        }
      }
      break;
  }
}

/* =======================
   NTX SYSTEMS OLED LOGO
   ======================= */
void ntxBootAnimation() {
  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE);

  int16_t x1, y1;
  uint16_t wNTX, hNTX;
  uint16_t wSYS, hSYS;

  /* Measure NTX */
  display.setFont(&FreeSansBold9pt7b);
  display.getTextBounds("NTX", 0, 0, &x1, &y1, &wNTX, &hNTX);

  /* Measure SYSTEMS */
  display.setFont(&FreeSans9pt7b);
  display.getTextBounds("SYSTEMS", 0, 0, &x1, &y1, &wSYS, &hSYS);

  int totalWidth = wNTX + 4 + wSYS;
  int startX = (SCREEN_WIDTH - totalWidth) / 2;
  int baselineY = 22; // visually centered baseline

  /* Slide-in animation */
  for (int x = -totalWidth; x <= startX; x += 2) {
    display.clearDisplay();

    display.setFont(&FreeSansBold9pt7b);
    display.setCursor(x, baselineY);
    display.print("NTX");

    display.setFont(&FreeSans9pt7b);
    display.setCursor(x + wNTX + 4, baselineY);
    display.print("SYSTEMS");

    display.display();
    delay(20);
  }

  /* Underline sweep */
  for (int i = 0; i <= totalWidth; i += 4) {
    display.drawLine(startX, 30, startX + i, 30, SSD1306_WHITE);
    display.display();
    delay(8);
  }

  display.setFont(); // reset
}

/* =======================
   KEEP OLED ALIVE
   ======================= */
void keepOLEDAlive() {
  static unsigned long oledMillis = 0;
  if (millis() - oledMillis > 1000) {
    oledMillis = millis();
    display.display();
  }
}

Credits

Siddhant gupta
1 project • 0 followers
Founder and solo hardware engineer working on embedded systems and modular dev platforms

Comments