Embedded Programming Cover

10. OUTPUT DEVICES

[ MISSION: Converting bits into physical movement and sound. ]

> Digital Logic

Microcontrollers operate in a binary world. Digital outputs only recognize two states: HIGH (3.3V/5V) and LOW (0V). In my project, this logic handles driver enabling and status signaling.

> PWM & DC Motors

To regulate DC Motor speed, we use Pulse Width Modulation. By rapidly switching the signal, the Duty Cycle defines the average power: higher percentage equals higher RPM.

PWM Diagram

SIGNAL_ANALYSIS: DUTY_CYCLE

SELECT_SUBSYSTEM_COMPONENT

[ MISSION: BRUSHLESS MOTOR CONTROL ]

BAT-01

Components Diagram

To control a motor, I wanted to make a compact and as simple a module as possible, so I simply used a TB67H45 driver and pins for the INs, OUTs and power supply.

VESC Diagram
PCB Layout
BAT-02

PCB Implementation

For the design of this board, I decided to use the logo of one of my favorite superheroes, Batman. As you can see in the PCB document, I used the GND under the driver to better dissipate heat.

BAT-03

Milling and cutting

To cut my PCB transformer, I used my files using the same method I explained in week 8 with a MONOFAB.

Wiring Diagram
BAT-04

Wiring

The image shows the function of each pin on my board; it's a simple and very efficient system to use.

[ FINAL RESULT ]

MOTOR CODE
// Pin definitions for the XIAO RP2350
const int IN1 = D0;
const int IN2 = D1;

// Speed adjustment (0 to 255)
int motorSpeed = 200; 

void setup() {
  // Configure pins as OUTPUT
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  
  // Ensure the motor starts in the OFF state
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
}

void loop() {
  // --- Move FORWARD ---
  // On the TB67H45, one pin receives PWM and the other stays LOW
  analogWrite(IN1, motorSpeed);
  digitalWrite(IN2, LOW);
  delay(2000);

  // --- BRAKE (Brake Mode) ---
  // Setting both pins to HIGH stops the motor quickly
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, HIGH);
  delay(1000);

  // --- Move BACKWARD ---
  // Reverse the logic: IN1 is LOW, IN2 receives PWM
  digitalWrite(IN1, LOW);
  analogWrite(IN2, motorSpeed);
  delay(2000);

  // --- STOP (Standby/Coast Mode) ---
  // Setting both pins to LOW lets the motor spin down freely
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  delay(1000);
}
WAYNE_ENT_OS // VER 4.02 STATUS: ENCRYPTED
PCB Layout
CONTROLLER_UNIT XIAO_RP2350 // ARMORED_CORE MOTOR_DRIVER TB67H45_CHIPSET // HIGH_TORQUE TRACE_SPEC 0.7mm // POWER_INTEGRITY PIN_LAYOUT HORIZONTAL_HEADER // LOW_PROFILE
🦇

PCB and Schematics

Download the circuit that I made this week.

GET_FILES.ZIP