Profile Image

Week 2

Embedded Programming ยท HTMAA 2025

Week Highlights

Key achievements and insights from the embedded programming week, including successful microcontroller programming, sensor integration, and the development of the ReactionAge reaction time measurement system.

ReactionAge

ReactionAge system in action - measuring reaction time and predicting age

ChatGPTMario2D

AI-powered Mario-style platformer with touch controls and adaptive gameplay

CircleSquareShapeSongSwingalong

Collaborative multiplayer game with geometric shape interactions

Embedded Programming Design Trades

Comprehensive analysis of critical design decisions in embedded system development

๐Ÿ“Š View Full Analysis

๐Ÿ’ป Design Files Available

Download Arduino code, view circuit diagrams, and access all embedded programming assets from this week's assignments

๐Ÿ“„ View Design Files

Table of Contents

Embedded Programming

This week focuses on embedded programming fundamentals, exploring how to program microcontrollers and create interactive electronic systems. We'll dive into the world of digital electronics, sensors, and real-time programming to build responsive devices that can sense, process, and react to their environment.

โ€ข Introduction to microcontrollers and embedded systems
โ€ข Programming fundamentals for real-time applications
โ€ข Sensor integration and data processing

This Week's Goals

  • Master Embedded Programming
    Learn microcontroller programming, sensor integration, and real-time system design
  • Build Interactive Systems
    Create responsive electronic devices that can sense and react to environmental inputs
  • Develop ReactionAge Project
    Implement a reaction time measurement system based on research methodologies

Assignments

  • Group Assignment
    Collaborative embedded programming project focusing on sensor integration and real-time data processing
  • Individual Assignment: ReactionAge
    Build a reaction time measurement system based on research methodologies from cognitive science literature

Tools & Materials

  • Microcontrollers
    Arduino, ESP32, or similar development boards
  • Development Environment
    Arduino IDE, PlatformIO, or VS Code with embedded extensions
  • Sensors & Components
    Buttons, LEDs, displays, accelerometers, and other input/output devices
  • Prototyping Tools
    Breadboards, jumper wires, resistors, and basic electronic components

Training Documentation

Essential training materials and resources for embedded programming fundamentals, microcontroller setup, and sensor integration techniques.

Electronics & Soldering Training

Download Notes Slack Discussion

Soldering Fundamentals

Comprehensive guide to soldering techniques for embedded electronics, covering both wire soldering and solder paste methods.

Wire Soldering
  • Temperature: 720-800ยฐF
  • Melt pad onto electrode first
  • Anchor arms for precision control
  • Use appropriate tip size for part
  • Work from low to high profile parts
Solder Paste
  • Use gloves for protection
  • Highest magnification possible
  • Temperature: 270-330ยฐC
  • Heat all sides together
  • Required for SMD components

Safety First:

Always wear safety glasses and use proper ventilation. Lead-free solder requires extra caution due to flux crystallization at high temperatures.

How to Solder (Almost) Anything

Step-by-step video demonstrations of essential soldering techniques for embedded electronics, covering both wire soldering and surface-mount component assembly.

Wire Soldering Technique

Learn the proper technique for soldering wires to components, starting with one edge to keep the part in place, then soldering the rest easily by keeping your wrist stable and the solder tip on the pad to heat it up with the part, and slowly bringing in solder.

Wire soldering demonstration showing proper technique and wrist stability

Solder Paste Assembly

Complete process for surface-mount component assembly: apply solder paste first, place the component, then heat up with a heat gun to create strong, reliable connections.

Applying solder paste to PCB pads

Placing microcontroller on prepared solder paste

Using heat gun to reflow solder paste and complete the connection

Pro Tips:

For detailed soldering guides and advanced techniques, refer to the Electronics & Soldering Training section above for comprehensive documentation and resources.

โ€ข Microcontroller Programming Basics - Introduction to embedded programming concepts and development environments
โ€ข Sensor Integration Workshop - Hands-on training for connecting and programming various sensors
โ€ข Real-time System Design - Principles of creating responsive embedded systems
โ€ข Debugging Techniques - Tools and methods for troubleshooting embedded code

QPAD Development Boards Programming Guide

Complete programming setup and workflow for QPAD development boards, covering bootloader configuration, IDE setup, and code deployment for different microcontroller architectures.

QPAD-XIAO (RP2040)

The QPAD-XIAO features a Raspberry Pi RP2040 microcontroller with built-in bootloader support. No bootloader burning required - simply configure your IDE and start programming!

Programming Steps:
  1. Connect QPAD-XIAO to your computer via USB-C
  2. In Arduino IDE, select Tools โ†’ Board โ†’ Raspberry Pi RP2040 Boards โ†’ XIAO RP2040
  3. Select the correct COM port under Tools โ†’ Port
  4. Write your code and click Upload - the board handles everything automatically!
Main Repository Code Examples
QPAD21 (SAMD21)

The QPAD21 uses an ATSAMD21 microcontroller that requires bootloader programming using a XIAO programmer chip. Follow these steps to get it ready for development.

Bootloader Programming Steps:
  1. Connect XIAO programmer to QPAD21 using the programming header
  2. Connect XIAO programmer to your computer via USB
  3. In Arduino IDE, select Tools โ†’ Board โ†’ Arduino SAMD (32-bits ARM Cortex-M0+) โ†’ Arduino MKR WiFi 1010
  4. Select the correct COM port for the XIAO programmer
  5. Configure bootloader settings:
    • Bootloader: Adafruit Circuit Playground Express
    • Clock: 48 MHz (USB)
    • USB Stack: Arduino
    • Debug Level: None
    • Erase Flash: All Flash Contents
    • Bootloader Version: 1.0.0
  6. Click Burn Bootloader and wait for completion
Programming Steps (After Bootloader):
  1. Disconnect XIAO programmer and connect QPAD21 directly via USB
  2. Select Tools โ†’ Board โ†’ Arduino SAMD (32-bits ARM Cortex-M0+) โ†’ Arduino MKR WiFi 1010
  3. Select the correct COM port for QPAD21
  4. Write your code and click Upload
Main Repository Code Examples
QPAD-XIAO-ESP32S3 (ESP32-S3)

The QPAD-XIAO-ESP32S3 features an ESP32-S3 microcontroller with built-in WiFi and Bluetooth capabilities. No bootloader burning required - just configure your IDE and start programming!

Programming Steps:
  1. Connect QPAD-XIAO-ESP32S3 to your computer via USB-C
  2. In Arduino IDE, select Tools โ†’ Board โ†’ ESP32 Arduino โ†’ XIAO_ESP32S3
  3. Select the correct COM port under Tools โ†’ Port
  4. Configure additional settings:
    • Upload Speed: 921600
    • CPU Frequency: 240MHz (WiFi/BT)
    • Flash Mode: QIO
    • Flash Size: 8MB (64Mb)
    • Partition Scheme: Default 4MB with spiffs
  5. Write your code and click Upload
Main Repository Arduino Code Examples
๐Ÿ’ก Pro Programming Tips:
  • Always test your code first: Use Verify/Compile to check for errors before uploading
  • Debug without uploading: You can compile and check your code without identifying the specific chip
  • Ready to deploy: Once your code compiles successfully, hit Upload to program your board
  • Serial Monitor: Use Tools โ†’ Serial Monitor to debug and monitor your program's output
  • Board Manager: Install board support packages through Tools โ†’ Board โ†’ Boards Manager if needed

Helpful Documentation

Comprehensive documentation covering embedded programming fundamentals, electronics theory, and practical implementation guides.

HTMA Electronics Slides

Official course slides covering microcontroller architecture, I/O techniques, sensor integration, and real-time system design.

Key Topics Covered

  • Microcontroller Programming
    Architecture and fundamentals
  • Sensor Integration
    Data processing methods
  • Real-time Systems
    Design principles and optimization

Board Design Documentation

Essential resources for designing custom PCBs and development boards for embedded programming projects, covering schematic design, layout principles, and manufacturing considerations.

USB-C Board Design Layout

USB-C board design showing proper connector placement, power routing, and signal integrity considerations for embedded development boards

Design Principles

  • USB-C connector placement and orientation
  • Power distribution and ground plane design
  • Signal integrity and trace routing
  • Component placement optimization

Manufacturing Considerations

  • Layer stackup and via design
  • Silkscreen and assembly markings
  • Test point placement
  • Design rule checking (DRC)

Design Files Available:

Complete KiCad project files, schematics, and PCB layouts are available in the Design Files section below for download and modification.

Common Troubleshooting

Essential troubleshooting techniques for embedded development boards, covering power supply verification and connector testing using multimeter measurements.

Voltage Regulator Troubleshooting

Verify that your voltage regulator is functioning correctly by measuring output voltages with a multimeter when power is connected to the board.

Voltage Regulator Testing Points

Voltage regulator testing points showing input, output, and ground connections for multimeter verification

Testing Steps:
  1. Connect power to your development board
  2. Set multimeter to DC voltage mode
  3. Measure input voltage (VIN) - should match your power supply voltage
  4. Measure output voltage (VOUT) - should be the regulated voltage (e.g., 3.3V or 5V)
  5. Check ground continuity between input and output ground pins
  6. Verify no voltage drop under load conditions

๐Ÿ’ก Pro Tip:

Use a portable multimeter for easy on-the-go testing and debugging of embedded circuits.

USB-C Pinout Troubleshooting

Verify USB-C connector functionality by testing power delivery, data lines, and ground connections using multimeter measurements.

USB-C Pinout Testing Diagram

USB-C pinout diagram showing power, data, and ground connections for multimeter testing and verification

Testing Steps:
  1. Connect USB-C cable to your development board
  2. Set multimeter to DC voltage mode
  3. Measure VBUS (pin A4/B4) - should read 5V when connected to power
  4. Test ground continuity (pins A1/B1, A12/B12) - should show 0ฮฉ resistance
  5. Check CC1/CC2 pins (A5/B5) for proper connection detection
  6. Verify D+ and D- data lines (A6/A7, B6/B7) for continuity
  7. Test both orientations of the USB-C connector

๐Ÿ”ง Troubleshooting Tips:

  • If VBUS shows 0V, check cable and power source
  • If ground shows high resistance, check solder joints
  • If data lines show no continuity, verify connector orientation
  • Test with known working USB-C cable for comparison

Group Assignment: Embedded Programming Design Trades

Comprehensive analysis of design tradeoffs in embedded programming, covering language selection, development workflows, and microcontroller choices. This collaborative project examines the critical decisions that shape embedded system development and their impact on project success.

Design Tradeoffs Summary

Architecture Example Boards Toolchain / Workflow Strengths Limitations
AVR (8-bit) ATtiny44, ATmega328 (Arduino Uno) avr-gcc, avrdude; Arduino IDE for simplified workflow Mature ecosystem, simple to program, widely taught Limited memory & speed, not ideal for complex tasks
ARM Cortex-M SAMD21, STM32, Teensy arm-none-eabi-gcc, OpenOCD, PlatformIO; Arduino or CircuitPython support High performance, industry standard, strong debugging tools Toolchain setup can be complex
RP2040 Raspberry Pi Pico, XIAO RP2040 Pico SDK (C/C++), MicroPython, Arduino IDE; custom PIO assembly for peripherals Flexible, inexpensive, unique PIO hardware for custom protocols Requires learning PIO for advanced features
ESP8266 / ESP32 NodeMCU, Sparkfun/Adafruit ESP boards Espressif SDK/IDF, Arduino IDE, MicroPython Built-in Wi-Fi/Bluetooth, large community support, IoT-ready Higher power usage, less deterministic timing
RISC-V HiFive boards, experimental dev kits riscv-gnu-toolchain, GDB, newer SDKs Open-source ISA, growing ecosystem, academic/educational interest Toolchain less mature, fewer libraries & examples

Comprehensive comparison of microcontroller architectures and their tradeoffs in embedded programming

Language Tradeoff

Programming Language Tradeoffs in Embedded Systems

Programming language tradeoff analysis showing performance vs development speed considerations

As illustrated in the language tradeoff diagram above, the choice of programming language involves critical tradeoffs between performance and development speed. The analysis shows how different languages balance factors like memory efficiency, execution speed, development time, and ecosystem support for embedded system development.

High Performance Languages

  • C/C++: Maximum control, minimal overhead
  • Rust: Memory safety with performance
  • Assembly: Direct hardware control

Rapid Development Languages

  • Python: Fast prototyping, rich libraries
  • JavaScript: Web integration capabilities
  • MicroPython: Python for microcontrollers

Development Workflow Tradeoff

Development Workflow Tradeoffs in Embedded Systems

Development workflow tradeoff analysis comparing different methodologies and their impact on project outcomes

The development workflow tradeoff diagram above demonstrates how different methodologies balance project timeline, code quality, and team collaboration. This visual analysis compares traditional waterfall approaches with agile methodologies, showing the impact of various toolchains, testing strategies, and deployment processes on embedded system development success.

Traditional Approaches

  • Waterfall: Sequential, documentation-heavy
  • V-Model: Testing integrated with design
  • Spiral: Risk-driven iterative approach

Modern Approaches

  • Agile: Iterative, customer-focused
  • DevOps: Continuous integration/deployment
  • Test-Driven Development: Quality-first

Microcontroller Tradeoff

Microcontroller Selection Tradeoffs

Microcontroller tradeoff analysis showing performance vs power consumption and cost considerations

The microcontroller tradeoff diagram above illustrates the critical balance between performance, power consumption, and cost in embedded system design. This visual analysis evaluates different architectures, processing capabilities, memory configurations, and peripheral options, providing a clear framework for selecting the optimal platform based on specific application requirements.

Low-Power Options

  • ARM Cortex-M0+: Ultra-low power
  • PIC: Simple, cost-effective
  • MSP430: Energy-efficient design

High-Performance Options

  • ARM Cortex-M4: DSP capabilities
  • ESP32: WiFi/Bluetooth integrated
  • STM32: Rich peripheral set

Use Case Analysis

Architecture Workflow Process Key Characteristics
SAMD21 (ARM Cortex-M) โ€ข Write code in C/C++ (Arduino IDE or PlatformIO)
โ€ข Compile with arm-none-eabi-gcc
โ€ข Upload using OpenOCD via USB or SWD debugger
โ€ข Debug with GDB or serial monitor
Professional-grade debugging, industry standard tools
RP2040 (Raspberry Pi Pico) โ€ข Write code in C/C++ (Pico SDK) or MicroPython
โ€ข Compile with CMake + GCC toolchain
โ€ข Drag-and-drop .uf2 file to Pico's USB mass storage device
โ€ข (Optional) Use custom PIO assembly for hardware interfaces
Accessibility and flexibility, drag-and-drop + PIO

Workflow examples showing different development approaches for ARM and RP2040 architectures

The example workflow table above provides specific recommendations for different embedded system applications, showing how the tradeoff analyses from the previous sections translate into practical implementation strategies. This comprehensive table demonstrates the relationship between project requirements and optimal technology choices.

Key Findings

As demonstrated in the workflow table above, ARM workflows emphasize professional-grade debugging with industry-standard tools, while RP2040 workflows emphasize accessibility and flexibility through drag-and-drop deployment and unique PIO capabilities. The comprehensive architecture comparison shows that optimal design choices depend heavily on project constraints, performance requirements, and development timeline. High-performance applications favor ARM Cortex-M with professional toolchains, while rapid prototyping benefits from RP2040's flexible development environment and built-in features.

Download PDF Report Download PowerPoint

Individual Assignment: ReactionAge

Build a reaction time measurement system based on research methodologies from cognitive science literature. This project combines embedded programming with scientific measurement principles to create a tool for studying human cognitive performance.

Core Features

  • Stimulus Generation
    Visual/auditory stimuli with precise timing
  • Response Detection
    Accurate measurement using buttons/sensors
  • Data Analysis
    Statistical processing and visualization

Research Foundation

Based on PLOS ONE study (2017) examining reaction time variability and cognitive decline.

Repository: github.com/saleemaldajani/reaction-timer-saleemaldajani

Reaction Time vs Age Model

Reaction time model showing the relationship between age and cognitive performance, based on research from PLOS ONE (2017)

Related Research

Parts List / Bill of Materials

Download BOM
# Image Part Description Qty Unit Price Datasheet Price
1 ATmega32 Microcontroller ATmega32 Microcontroller 8-bit AVR MCU, 32 KB Flash, 2 KB SRAM, ADC, timers, USART 1 $7.50 PDF $7.50
2 OLED Display Module 0.96โ€ณ OLED Display Module (SSD1306) 128ร—64 mono OLED, IยฒC/SPI interface 1 $2.50 PDF $2.50
3 Male Header Pins Male Header Pins (2.54 mm) Breakaway straight male headers 2 $0.20 PDF $0.40
4 Dual-Row Header Dual-Row Header (2ร—5, 2.54 mm) 10-pin dual-row header, unshrouded 1 $0.50 PDF $0.50
5 SMD MOSFET SMD MOSFET (AO3400A example) N-channel MOSFET, SOT-23 2 $0.15 PDF $0.30
6 SMD Capacitor SMD Capacitor (MLCC 0603 example) Ceramic capacitor, value TBD 5 $0.03 PDF $0.15
7 SMD Resistors SMD Resistors โ€“ 1 kฮฉ (code '1001') Precision SMD resistors 5 $0.02 PDF $0.10
8 SMD LED SMD LED (0603, color TBD) Indicator LED 2 $0.05 PDF $0.10
9 USB-C Connector USB-C Receptacle Surface-mount USB Typeโ€‘C connector 1 $0.60 PDF $0.60
10 Custom PCB Custom PCB (Capacitive-Touch Board) Project-specific PCB 1 $10.00 N/A $10.00
TOTAL $22.15

Complete bill of materials for the ReactionAge embedded programming project. All prices are in USD and subject to supplier variations.

Nintendo Switch Controller Training for Toddlers

An interactive training module designed for young children, utilizing Nintendo Switch controller input to create an engaging letter-matching game that develops motor skills and cognitive recognition.

Game Mechanics

  • Button Mapping
    A, B, X, Y in inverted layout
  • Visual Stimulus
    Flashing letters with bright colors
  • Progressive Difficulty
    Adapts based on performance

Educational Benefits

  • Motor Skills
    Hand-eye coordination
  • Letter Recognition
    Alphabet learning
  • Attention Building
    Focus and concentration

Technical Features

  • Controller Support
    Pro Controller & Joy-Con
  • Display System
    Large, colorful letters
  • Progress Tracking
    Analytics & feedback

ChatGPTMario2D

An AI-powered Mario-style platformer game built with ChatGPT assistance, featuring touch controls, adaptive gameplay mechanics, and classic 2D platforming elements optimized for embedded systems.

Mario-style platformer gameplay with touch controls and adaptive difficulty

ChatGPT-assisted development process and code generation demonstration

Source Code: qpad_d21_mario_touch_v12_clean.ino

Download .ino
Game Features
  • Touch-based controls (P3=LEFT, P4=RIGHT, P0=JUMP)
  • Adaptive difficulty thresholds
  • Collision detection and physics
  • Coin collection and enemy interaction
  • Coyote time and jump buffering
Technical Implementation
  • OLED Display (SSD1306) rendering
  • Adafruit FreeTouch library integration
  • State machine architecture
  • Offscreen watchdog protection
  • Robust collision detection system
Touch Button Mapping
P4(6) right
P3(5) left
P5(7) up
P2(4) down
P0(2) jump
P1(3) not working

Button mapping obtained using QPAD21 Touch Monitor utility in Design Files

CircleSquareShapeSongSwingalong

A collaborative multiplayer game featuring geometric shape interactions, synchronized gameplay between two ESP32 devices, inspired by educational content in Shape Song Swing Along.

Shape Song Swing Along educational content integration and gameplay

Circle and square shape interaction gameplay mechanics

Source Code: TwoSquares_XiaoESP32S3_Touch_ReadySplash_MACFix.ino

Download .ino
Multiplayer Features
  • ESP-NOW wireless communication
  • Dual ESP32-S3 device support
  • MAC address-based player identification
  • Synchronized game state management
  • Ready state coordination
Educational Integration
  • Shape recognition and interaction
  • Touch-based geometric learning
  • Visual feedback systems
  • Collaborative problem solving
  • Real-time synchronization
Device MAC Addresses
MAC Address 1
D8:3B:DA:75:05:AC
MAC Address 2
D8:3B:DA:75:E1:9C

MAC addresses obtained using Get MAC Address utility in Design Files

Design Files

Source code, circuit diagrams, and documentation files for embedded programming projects.

ReactionAge Arduino Code

Download .ino
Developed with ChatGPT

This code was developed collaboratively with ChatGPT. View development transcript

Key Features

Hardware Integration
  • OLED Display (SSD1306)
  • RGB LED indicators
  • Capacitive touch sensors
  • State machine architecture
Reaction Time Analysis
  • Multiple prediction models
  • Statistical data collection
  • CSV export functionality
  • Real-time age prediction
Code Preview
// Reaction time prediction models
const float A_POOLED = -35.392393f, B_POOLED = 0.1930446f;
const float A_MALE = -58.123019f, B_MALE = 0.2640664f;
const float A_FEMALE = -31.603679f, B_FEMALE = 0.176111015f;

float predictAgeFromRT(unsigned long rt_ms) {
  float x = (float)rt_ms;
  float a, b, c;
  switch (currentModel) {
    case SX_MALE: a=A_MALE; b=B_MALE; c=C_MALE; break;
    case SX_FEMALE: a=A_FEMALE; b=B_FEMALE; c=C_FEMALE; break;
    default: a=A_POOLED; b=B_POOLED; c=C_POOLED; break;
  }
  return a + b*x + c*x*x;
}

ChatGPTMario2D Arduino Code

Download .ino
Developed with ChatGPT

This code was developed collaboratively with ChatGPT. View development transcript

Key Features

Game Mechanics
  • Touch-based controls (P3=LEFT, P4=RIGHT, P0=JUMP)
  • Adaptive difficulty thresholds
  • Collision detection and physics
  • Coin collection and enemy interaction
  • Coyote time and jump buffering
Technical Implementation
  • OLED Display (SSD1306) rendering
  • Adafruit FreeTouch library integration
  • State machine architecture
  • Offscreen watchdog protection
  • Robust collision detection system
Code Preview
// Touch control mapping and adaptive thresholds
#define N_TOUCH   6
#define THRESHOLD 500
uint8_t touch_pins[N_TOUCH] = {2,3,4,5,6,7};  // P0..P5 -> pins (2,3,4,5,6,7)

// Game state management
enum GameState { MENU, PLAYING, PAUSED, GAME_OVER };
GameState currentState = MENU;

// Player physics and collision detection
struct Player {
  float x, y, vx, vy;
  bool onGround, canJump;
  int lives, coins;
};

// Adaptive difficulty system
#define USE_ADAPTIVE_THRESH 1
int adaptive_thresholds[N_TOUCH] = {500, 500, 500, 500, 500, 500};

void updateGame() {
  // Physics update
  player.vy += GRAVITY;
  player.y += player.vy;
  
  // Collision detection with platforms
  for (int i = 0; i < N_PLATFORMS; i++) {
    if (checkCollision(player, platforms[i])) {
      player.onGround = true;
      player.vy = 0;
    }
  }
}

CircleSquareShapeSongSwingalong Arduino Code

Download .ino
Developed with ChatGPT

This code was developed collaboratively with ChatGPT. View development transcript

Key Features

Multiplayer Communication
  • ESP-NOW wireless protocol
  • MAC address-based player identification
  • Real-time state synchronization
  • Ready state coordination
  • Dual ESP32-S3 device support
Educational Features
  • Shape recognition and interaction
  • Touch-based geometric learning
  • Visual feedback systems
  • Collaborative problem solving
  • Real-time synchronization
Code Preview
// ESP-NOW communication setup
#include 
#include 

// Player state structure for network synchronization
struct PlayerState {
  int x, y, vx, vy;
  bool onGround;
};

struct NetPacket {
  PlayerState st;
  bool ready;
};

// MAC address-based player identification
uint8_t macP1[] = {0xD8, 0x3B, 0xDA, 0x75, 0x05, 0xAC};
uint8_t macP2[] = {0xD8, 0x3B, 0xDA, 0x75, 0xE1, 0x9C};

// Touch controls for shape interaction
#define N_TOUCH 6
#define THRESHOLD 100000UL
int touch_pins[N_TOUCH] = {9, 8, 7, 2, 3, 1};
#define IDX_LEFT  1
#define IDX_RIGHT 0
#define IDX_JUMP  2

// ESP-NOW callback for receiving data
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
  memcpy(&otherState, incomingData, sizeof(otherState));
  otherReady = true;
}

QPAD21 Touch Monitor Arduino Code

Download .ino

A touch monitoring utility developed with ChatGPT assistance for debugging and calibrating touch sensor inputs on the QPAD21 development board. This tool provides real-time visualization of touch sensor values and helps optimize touch thresholds for embedded applications.

Developed with ChatGPT

This code was developed collaboratively with ChatGPT. View development transcript

Key Features

Touch Monitoring
  • Real-time touch sensor value display
  • Multi-channel touch input monitoring
  • Threshold calibration assistance
  • Serial output for data logging
  • Visual feedback on OLED display
Debugging Tools
  • Touch state visualization
  • Raw sensor value output
  • Threshold testing interface
  • Performance monitoring
  • Calibration guidance
Code Preview
// Touch monitoring and calibration utility
#include 
#include 
#include 

#define N_TOUCH 6
#define THRESHOLD 500
uint8_t touch_pins[N_TOUCH] = {2,3,4,5,6,7};
Adafruit_FreeTouch* touch_devices[N_TOUCH];

int touch_values[N_TOUCH] = {0,0,0,0,0,0};
bool pin_touched[N_TOUCH] = {false,false,false,false,false,false};

void updateTouchMonitor() {
  for (int i = 0; i < N_TOUCH; i++) {
    int value = touch_devices[i]->measure();
    touch_values[i] = value;
    pin_touched[i] = (value > THRESHOLD);
    
    // Serial output for debugging
    Serial.print("Touch ");
    Serial.print(i);
    Serial.print(": ");
    Serial.print(value);
    Serial.print(" ");
    Serial.println(pin_touched[i] ? "PRESSED" : "RELEASED");
  }
}

Get MAC Address Arduino Code

Download .ino

A utility developed with ChatGPT assistance for retrieving and displaying MAC addresses on ESP32 devices. This tool is essential for ESP-NOW communication setup, allowing developers to identify device MAC addresses for peer-to-peer networking configuration in multiplayer embedded applications.

Developed with ChatGPT

This code was developed collaboratively with ChatGPT. View development transcript

Key Features

MAC Address Retrieval
  • WiFi STA MAC address extraction
  • Bluetooth MAC address retrieval
  • Serial output for easy copying
  • OLED display visualization
  • Multiple format output options
ESP-NOW Integration
  • Device identification for networking
  • Peer-to-peer communication setup
  • MAC address validation
  • Network configuration assistance
  • Multi-device coordination
Code Preview
// MAC address retrieval utility for ESP32
#include 
#include 

void setup() {
  Serial.begin(115200);
  
  // Get WiFi STA MAC address
  uint8_t mac[6];
  esp_read_mac(mac, ESP_MAC_WIFI_STA);
  
  Serial.print("WiFi STA MAC: ");
  for (int i = 0; i < 6; i++) {
    if (i > 0) Serial.print(":");
    if (mac[i] < 16) Serial.print("0");
    Serial.print(mac[i], HEX);
  }
  Serial.println();
  
  // Get Bluetooth MAC address
  esp_read_mac(mac, ESP_MAC_BT);
  Serial.print("Bluetooth MAC: ");
  for (int i = 0; i < 6; i++) {
    if (i > 0) Serial.print(":");
    if (mac[i] < 16) Serial.print("0");
    Serial.print(mac[i], HEX);
  }
  Serial.println();
}

Project Resources

Circuit Diagrams

  • Microcontroller connection schematics
  • Sensor integration diagrams
  • Power supply and signal conditioning circuits

Board Design Files

Complete KiCad project files for custom PCB design, including schematics, PCB layouts, and project configurations for embedded development boards.

File Type Description Download
KiCad Project Complete KiCad project file containing all design data and settings .kicad_pro
Schematic Circuit schematic showing component connections and electrical design .kicad_sch
PCB Layout Physical PCB layout with component placement and trace routing .kicad_pcb

Design Documentation:

For detailed board design principles, USB-C connector placement, and manufacturing considerations, refer to the Board Design Documentation section above.

Reflections & Learnings

[Reflection notes placeholder.]

Contributions

Acknowledgments for collaborative support and technical assistance during the embedded programming project development.

Course Staff

Quentin Bolsรฉe

Helped me so much with the ESP32S3 code development with his awesome examples. Also assisted with resoldering the microcontroller when we were debugging the USBC QPAD issues. Couldn't have done it without you!

Anthony Pennes

Spent so many hours helping me debug my USBC QPAD while resoldering the USBC port. Eventually it turned out the problem was that we crashed the board with XIAO code on a D21! Too much to say and so little time until class. Couldn't have done it without you.

Jesse de Alva

Helped me test the boards after programming them, providing valuable assistance with debugging and validation of the embedded programming projects. Your support was crucial for ensuring everything worked correctly.

Technical Support & Collaboration

Eghosa Ohenehn

Contributed valuable insights and technical discussions about microcontroller tradeoffs during the group assignment development. Provided expertise in evaluating different microcontroller architectures and their suitability for various embedded programming applications.

Anthony Pennes

Engaged in extensive discussions throughout the embedded programming design trades section, providing valuable technical insights and collaborative support during the group assignment development process.

Quentin Bolsรฉe

Participated in numerous office hours discussions about embedded programming design trades, contributing significantly to the technical analysis and collaborative development of the group assignment content.

Alex Hu

Thank you for showing me Flappy Bird and inspiring me to push through the game development part of my plan this week. Your demonstration and encouragement were instrumental in motivating me to complete the ChatGPTMario2D and CircleSquareShapeSongSwingalong projects, helping me overcome technical challenges and stay focused on the embedded programming goals.

Tushar Kanade

Thank you for taking videos of the soldering training! Your documentation of the training process was incredibly helpful for understanding the techniques and procedures. The visual reference you provided made it much easier to follow along and learn the proper soldering methods for the embedded programming projects.

Special thanks to the collaborative learning environment that enabled knowledge sharing and technical problem-solving throughout the embedded programming week.

Ethical AI Use

Transparent documentation of AI assistance used in this week's work, following course guidelines for ethical AI usage.

AI-Assisted Template Generation and Task Planning

Used ChatGPT to generate the weekly template HTML structure and styling framework, and created structured task prompts for week 2 embedded programming content development.

๐Ÿ“„ View ChatGPT Transcript ๐Ÿ“‹ View Task Prompt

AI-Assisted Content Development and Page Structure

Used Cursor AI for iterative content development, page structure optimization, and aesthetic improvements. The AI helped with HTML/CSS implementation, content organization, and maintaining consistent styling across the embedded programming documentation.

๐Ÿ“„ View Full Transcript ๐Ÿ’พ Download Chat File

AI-Assisted BOM Table Implementation

Used Cursor AI to implement the comprehensive BOM table with clickable images, datasheet links, and full-width responsive design. The AI helped with HTML table structure, CSS styling, and integration of CSV data into an aesthetically pleasing table format.

๐Ÿ“„ View Full Transcript ๐Ÿ’พ Download Chat File

AI-Assisted Image Recognition and BOM Creation

Used ChatGPT for image recognition of electronic components to identify parts and construct the bill of materials CSV file. The AI analyzed component images and provided detailed part specifications, descriptions, and pricing information for the embedded programming project.

๐Ÿ“„ View Full Transcript

AI-Assisted Project Content Updates and Documentation

Used Cursor AI for comprehensive project content updates, documentation improvements, and HTML structure optimization. The AI assisted with content organization, styling consistency, and integration of multimedia elements for the embedded programming documentation.

๐Ÿ“„ View Full Transcript ๐Ÿ’พ Download Chat File

AI-Assisted Arduino Programming and Code Development

Used ChatGPT for Arduino programming assistance based on the ReactionAge project code from GitHub repository and Quentin Bolsรฉe's QPAD documentation available on the course website embedded system assignment page. The AI provided guidance on embedded programming concepts, code optimization, and integration with the QPAD-xiao board design.

๐Ÿ“„ View ChatGPT Transcript ๐Ÿ”— GitHub Repository ๐Ÿ”— QPAD-xiao Documentation

AI-Assisted Group Assignment Content Development and Table Implementation

Used Cursor AI for comprehensive development of the embedded programming design trades group assignment section. The AI assisted with creating structured subsections for language, development workflow, and microcontroller tradeoffs, implementing professional HTML tables with data extracted from PowerPoint presentations, and integrating download links for PDF and PPTX files.

๐Ÿ“„ View Full Transcript ๐Ÿ’พ Download Chat File

AI-Assisted Training Section Development and Documentation

Used Cursor AI for comprehensive development of the training section, including soldering techniques, QPAD programming guides, board design documentation, and troubleshooting procedures. The AI assisted with creating structured subsections, implementing video demonstrations, adding download links for design files, and developing comprehensive troubleshooting guides with multimeter testing procedures.

๐Ÿ“„ View Full Transcript ๐Ÿ’พ Download Chat File

AI-Assisted Git Workflow Optimization

Used Cursor AI to analyze file sizes and break down large changes into smaller, manageable commits to avoid exceeding Git's 25MB commit size limit. The AI helped organize files by size, created a logical commit strategy, and automated the commit and push process for better version control practices.

๐Ÿ“„ View Full Transcript ๐Ÿ’พ Download Chat File

AI-Assisted Game Development: ChatGPTMario2D

Used ChatGPT for collaborative development of the ChatGPTMario2D platformer game, including touch control implementation, adaptive difficulty systems, collision detection, and game physics. The AI provided guidance on embedded programming concepts, state machine architecture, and optimization for the QPAD21 development board.

๐Ÿ“„ View ChatGPT Transcript

AI-Assisted Multiplayer Game Development: CircleSquareShapeSongSwingalong

Used ChatGPT for collaborative development of the CircleSquareShapeSongSwingalong multiplayer game, including ESP-NOW wireless communication, MAC address-based player identification, synchronized game state management, and educational content integration. The AI provided guidance on embedded networking, real-time synchronization, and touch-based geometric learning systems.

๐Ÿ“„ View ChatGPT Transcript

AI-Assisted Touch Monitoring Utility Development

Used ChatGPT for collaborative development of the QPAD21 touch monitoring utility, including real-time sensor value display, threshold calibration assistance, debugging tools, and serial output for data logging. The AI provided guidance on touch sensor integration, calibration procedures, and embedded debugging techniques for the QPAD21 development board.

๐Ÿ“„ View ChatGPT Transcript

AI-Assisted MAC Address Utility Development

Used ChatGPT for collaborative development of the get_mac_address utility for ESP32 devices, including WiFi STA and Bluetooth MAC address retrieval, serial output formatting, and ESP-NOW integration support. The AI provided guidance on embedded networking concepts, MAC address extraction methods, and device identification techniques for multiplayer embedded applications.

๐Ÿ“„ View ChatGPT Transcript

AI-Assisted Toddler Training Subsections Development

Used Cursor AI for comprehensive development of toddler training subsections, including ChatGPTMario2D and CircleSquareShapeSongSwingalong game implementations. The AI assisted with creating structured subsections, implementing video demonstrations, adding download links for Arduino code files, and developing comprehensive documentation for embedded programming educational content.

๐Ÿ“„ View Transcript ๐Ÿ’พ Download Markdown

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License