Kaustubh

~/about

kaustubh@portfolio➜sudo ./about

Selected Work

01

Spotify Player

Embedded C, ESP32, KiCad

Standalone Spotify controller: custom ESP32 firmware talks directly to the Spotify Web API, paired with a purpose-built 4-layer PCB for physical playback control, volume, and live track metadata.

Assembled PCB
Assembled PCB

Firmware

  • Implemented the Spotify OAuth 2.0 Authorization Code flow on-device: ESP32 hosts a local HTTPS server to capture the redirect, exchanges the code for tokens, and auto-refreshes on expiry.
  • Decoupled input handling from network I/O with a dedicated FreeRTOS task and queue, so button presses are polled and debounced independently of the multi-second blocking Spotify API calls running in the main loop.
  • Optimistic UI updates: the screen reflects a button press immediately (play/pause state, progress reset), with the confirming API call and track-info refresh scheduled asynchronously afterward.
  • Persistent, certificate-validated TLS connections that are proactively re-established during idle time, so the 1-3s handshake cost never lands on a button press.
  • Ported across ESP32 variants by replacing hardware-only peripherals (PCNT quadrature decoding, hardware SHA1) with portable software equivalents, letting the same codebase target both classic ESP32 and ESP32-C3.

PCB

  • Custom 4-layer PCB in KiCad: ESD and overcurrent protection, clean power distribution, signal integrity and ESP32 layout best practices.
  • OLED display and hardware buttons drive a responsive physical UI with real-time playback status and progress; firmware also supports an optional rotary encoder for volume control on devkit builds where a strapping-pin conflict doesn't rule it out.
02

TFT Display Driver

C, TFT Display, Raspberry Pi

Bare-metal C driver for the ILI9481 TFT over 8-bit parallel bus on a Raspberry Pi - no display libraries, no OS abstractions, direct hardware control. No existing driver supported an Arduino TFT shield on a Pi Zero 2W over this interface, so every layer (GPIO, init sequence, rendering pipeline, primitive library) was built from scratch.

Commit bb12be9 - memory-mapped GPIO + full primitives
Commit bb12be9 - memory-mapped GPIO + full primitives

How it works

Direct hardware access - Maps BCM2835/BCM2711 GPIO registers directly into process memory via /dev/gpiomem, bypassing the Linux GPIO subsystem for nanosecond-level pin control with no syscall overhead.

Optimized bus writes - A 256-entry lookup table, precomputed at startup, maps every byte value to its exact GPIO SET mask, reducing each bus write to two register operations with no per-bit branching. Burst writes hold CS low across an entire pixel block, with inline NOP-padded timing to meet the ILI9481's setup/hold requirements without a system timer.

Lazy rendering + dirty regions - Drawing calls write to an 18-bit RGB backbuffer; flush() transmits only the minimal bounding rectangle of changed pixels, sending full-width regions as a single burst and partial-width regions row-by-row.

Reverse-engineered init sequence - Every open-source ILI9481 init sequence I tried produced incorrect output on this panel. Rebuilt one from the datasheet, hand-tuning power, VCOM, and gamma registers.

Features

  • Full 2D primitive library - pixels, rectangles, Bresenham lines, strings, scaled text, bitmaps
  • 18-bit colour (262K) via RGB backbuffer
  • JPEG rendering with Floyd–Steinberg dithering
  • BMP file rendering
  • Interactive 8-stage diagnostic tool for hardware bring-up (bus pattern tests, polarity/inversion checks, bit-reversal detection) - catches wiring faults before any init sequence is sent
03

Robot Arm

OpenCV, Kinematics, Computer Vision

Python toolkit for vision-guided pick-and-place with a 4-DOF Dobot Magician arm and an Orbbec Astra camera: calibration, coordinate transforms, object localization, and robot control as reusable APIs.

Dobot Arm Picking and Placing
Dobot Arm Picking and Placing

Pipeline

  1. Calibrate camera intrinsics and lens distortion using ArUco targets (single-frame and real-time).
  2. Undistort incoming frames for accurate geometry.
  3. Map image pixels (u, v) to robot coordinates (x, y, z) via planar homography (camera roughly perpendicular to a flat workspace) or ray–plane intersection (flexible camera placement, extensible to height-aware tasks).
  4. Command the arm to execute pick-and-place using the transformed coordinates.



Refer to the GitHub repo for full details, including calibration, coordinate transforms, and pick-and-place scripts.

04

USB PD Board

KiCad, Power Electronics

4-layer USB-C Power Delivery sink board: negotiates 12V/3A over USB PD and delivers regulated 12V, 5V, and 3.3V rails, each capable of at least 3A (not concurrently - the buck stages cap 5V and 3.3V at 3A each).

PCB Layout
PCB Layout

Design

  • PD negotiation - HUSB237 handles the USB PD handshake and requests 12V/3A from the source.
  • Buck conversion - TPS563300 stages step 12V down to efficient 5V and 3.3V rails.
  • Protection - TVS diode for ESD/surge, EFuse (TPS25924x) for over-current and short-circuit protection.

Stackup

4-layer SIG/GND/PWR/SIG: PWR layer is a solid 12V copper pour, GND is a solid pour stitched to the top-layer copper for a clean return path under the switching stages.

05

Posture Analyzer

Python, OpenCV, MediaPipe

Real-time posture monitor: a Raspberry Pi streams webcam video to a desktop for pose analysis and live feedback.

RPi with Camera
RPi with Camera

Implementation

  • Pi streams 640×480 video at 12 FPS over TCP to a desktop, keeping the Pi lightweight and offloading processing to the PC.
  • MediaPipe pose estimation tracks shoulders, ears, and hips to compute posture metrics.
  • Streaming pipeline handles automatic reconnection and frame-loss recovery for a flaky Pi/network link.
  • OpenCV overlay renders skeletal tracking, alignment indicators, and posture status in real time.
06

GANs + Survival Models

PyTorch, Pandas, GAN, XGBoost

Two predictive-maintenance projects for CNC machining: a GAN architecture exercise and a working failure-time prediction model.

Chatter Prediction (XGBoost Survival Model)

Trained an XGBoost survival model on 8M+ time-series vibration samples to predict chatter onset, reaching a C-index of 0.84. Window-based feature extraction on high-frequency vibration data improved chatter ranking consistency and enabled early-life fault discrimination.

Synthetic Failure Data (C-WGAN-GP)

Implemented a Conditional Wasserstein GAN with Gradient Penalty to generate synthetic CNC failure data conditioned on spindle RPM, aimed at the class imbalance in the real dataset.



Refer to the GitHub repo for full details, including data preprocessing, model architecture, and training scripts.

07

SPI Tapeout

TinyTapeout, Verilog, Cocotb

SPI Tapeout

SPI-configurable PWM peripheral implemented in Verilog for tape-out via TinyTapeout, with a full Cocotb verification environment covering both the SPI protocol layer and the PWM outputs it drives.

Implementation

  • Multi-stage synchronizers and edge-detection circuitry to safely capture asynchronous SPI signals across clock domains.
  • Address validation, transaction buffering, and deferred register updates to guarantee protocol correctness.
  • SPI registers configure per-channel output enable, PWM enable, and duty cycle; writes take effect on the next PWM period boundary.

Verification

  • Protocol-level: correct read/write framing, invalid-address handling, back-to-back transactions.
  • PWM-level: output frequency measured against a 3 kHz target (±1% tolerance) across all 16 output bits, and duty cycle verified at 0%, 50%, and 100% by measuring high-time against period on every channel.
08

Audio Visualizer

NextJS, Python, DSP

Real-time in-browser audio visualizer: mic input runs through the Web Audio API, gets analyzed every animation frame, and drives three different visualization modes - all client-side, no server round-trip.

Audio pipeline

Mic → getUserMedia → MediaStreamAudioSourceNode → AnalyserNode (FFT size 8192, 4096 bins) → muted GainNode → destination. The gain node is kept at 0 so the mic never feeds back into speakers, while still keeping the audio graph alive across browsers. Echo cancellation, noise suppression, and auto-gain are disabled so the analyzer sees signal closer to the raw input.

Visualization modes

  • Waveform - raw time-domain samples via getFloatTimeDomainData.
  • Frequency bars - FFT bins mapped to log-spaced bands (perceptual frequency resolution rather than linear FFT spacing).
  • 9-band ISO EQ - FFT bins grouped into 9 ISO octave bands (63 Hz–16 kHz), each band taking the peak magnitude of the bins in its range.

Performance

Reuses a single typed array per buffer type across frames instead of allocating on every animation tick, and a sensitivity slider scales output gain before it hits the canvas draw call.

09

Buck PCB

Altium, Power Electronics

Buck converter PCB stepping 8–15V down to a regulated 3.3V/2A rail, built around the AP63203WU-7.

PCB Layout
PCB Layout

Design

  • Converter - AP63203WU-7 synchronous buck converter.
  • Layout - routing optimized around the switching stage (tight switch-node loop, placement tuned for the buck topology) to keep parasitics and noise down.