Output devices - Assignment:
For this week's assignment, the primary objective was to implement and control external output devices, specifically a DC motor and an OLED screen. However, before beginning the integration, I had to completely redesign the PCB from scratch. My previous board had two critical limitations that made it unsuitable for this phase: first, the hardware I²C pins were mismatched, which forced me to use bit-banging for the inputs; and second, the design lacked external breakout pins, making it physically impossible to connect new output components. Consequently, I developed a new, more versatile board that corrects the routing errors and provides the necessary headers to interface with multiple peripherals simultaneously, opting for a cleaner, more robust layout.
At a fundamental level, output devices are controlled through digital signals that typically operate in two discrete states: HIGH, representing the maximum voltage level (3.3V on the XIAO RP2350), and LOW, representing 0V. While these binary states are perfect for simple operations like toggling an LED, many components require a way to receive varying amounts of power. This is achieved through Pulse Width Modulation (PWM), a technique that effectively simulates an analog-like behavior by rapidly switching a digital signal between its HIGH and LOW states. The efficiency of this power delivery is governed by the Duty Cycle, which is the percentage of time the signal remains in the HIGH state during one complete cycle. A 100% duty cycle means constant voltage, while a 50% cycle provides power only half of the time, resulting in an average voltage that allows for precise control of the connected hardware.
By mastering these two methods—direct digital signaling and pulse modulation—the microcontroller can interact with a wide range of peripherals. In this project, digital communication is used to send complex data to the OLED display, while the PWM technique is utilized to regulate the power sent to the DC motor. This combination demonstrates how a single microcontroller can manage both high-speed data protocols and variable power distribution simultaneously. The transition to this new board architecture was essential, as it transformed the system from a restricted input-only device into a flexible platform capable of driving multiple outputs and providing real-time physical and visual feedback.
DC Motor Control & Driver Board
A DC Motor is a device that converts electrical energy into mechanical rotation. At its simplest level, it works through electromagnetism: when electricity flows through the internal coils, they become temporary magnets. These magnets push against permanent magnets inside the motor casing, and that magnetic "push" is what makes the shaft spin. The more power we provide, the faster and stronger it rotates.
While the XIAO RP2350 is the "brain" of the project, it is not strong enough to power a motor directly. Microcontrollers can only provide a tiny amount of current, and a motor needs a lot more to start spinning. To solve this, I designed a custom driver board that acts as a bridge. This board uses a small signal from the brain to control a large amount of power from a battery or power supply, ensuring the microcontroller remains safe while the motor does the heavy lifting.
Bill of Materials (BOM)
| RefDes | Qty | Value / Type | Footprint | Description |
|---|---|---|---|---|
| Q1 | 1 | BC817 (NPN) | SOT-23 (SMD) | Transistor switch for motor power. |
| D1 | 1 | BAT54J (Schottky) | SOD-323 (SMD) | Flyback diode for inductive protection. |
| R1, R2 | 2 | 1k / 10k Ω | 1206 (SMD) | Base limit and Pull-down resistors. |
| C1 | 1 | 10uF / 100nF | 1206 (SMD) | Decoupling capacitor for noise filtering. |
| J1, J2 | 2 | Pin Headers | 2.54mm Pitch | Input (Signal) and Output (Motor) connectors. |