PAGE 09 PAGE 11
WEEK #10

OUTPUT DEVICES

Giving movement to the goal: Controlling Servos and DC Motors.

ALL ACCESS MISSION FILES (GITLAB REPO)

MISSION BRIEFING

This week's objective: Add an output device to a microcontroller board and program it to do something. I created a Universal Output Shield in the shape of the Red Hood logo to control my final project's mechanics.

STEP 05: FINAL B&W RESULT

This is the Servo that I used for testing. It is a SG90, a common micro servo that can rotate approximately 180 degrees. It has three wires: power (red), ground (brown), and signal (orange). The signal wire receives PWM signals from the microcontroller to control the angle of the servo horn.

00. GROUP ASSIGNMENT

For the group assignment, we probed the analog levels and digital signals of an input device using an oscilloscope and a multimeter.

📂 OPEN GROUP ASSIGNMENT

01. THE ACTUATORS

  • Servomotor SG90 (For moving targets)
  • DC Motor (For high-speed movement)
  • TB67H451FNG Driver (The power bridge)
  • LiPo Battery 7.4V (Energy source)

02. MY WORKFLOW

I used Inkscape I used the same steps that I used in week06 and week08 to design the PCB in the shape of the Red Hood logo. Then I exported the design to KiCad for layout and routing, and finally sent it to be manufactured.

03. THE PLOT TWIST: BODGE WIRE

During the mission, I discovered a missing trace between VCC and VREF. Every hero needs a backup plan, so I performed a surgical repair by soldering a Bodge Wire to restore power to the driver.

04. OUTPUT 1: SERVOMOTOR TEST

I used the Monitor serial to control the SG90 servomotor. The code reads angles that I write from the Serial Monitor and moves the servo accordingly. The video below shows the servo responding to commands sent from the computer, demonstrating successful hardware-software integration.

Hero Test: Controlling the servo target via Serial Monitor!

05. THE CODE VAULT

#include <Servo.h>


#include 

Servo miServo;  


const int pinSenal = D9; 

void setup() {

  Serial.begin(9600);
  

  miServo.attach(pinSenal);

  miServo.write(0);

  delay(2000); 
  
  Serial.println("========================================");
  Serial.println("READY TO WORK  ");
  Serial.println("========================================");
  Serial.println("Write a number from 0 to 180");
}

void loop() {
  if (Serial.available() > 0) {
    
    int angulo = Serial.parseInt();
    
    while (Serial.available() > 0) {
      Serial.read();
    }

    if (angulo >= 0 && angulo <= 180) {
      Serial.print("-> MOVING THE SERVO TO: ");
      Serial.print(angulo);
      Serial.println(" .");
      
      // Ejecutamos el movimiento
      miServo.write(angulo);
      
    } else {
      Serial.println("-> ¡Error! THE MECHANISM ONLY ACCEPTS NUMERS FROM 0 TO 180");
    }
  }

}

MISSION ACCOMPLISHED

The targets are moving. Hardware and software fully integrated.