13

Lesson 13: Introduction to miniAuto Platform

Meeting your robot companion

Learning Objectives

By the end of this lesson, students will:

  • Understand miniAuto hardware components
  • Assemble and configure the robot
  • Load and test default programs
  • Connect to mobile app control

Skills Developed:

  • Hardware assembly and troubleshooting
  • System integration skills
  • Wireless communication setup

Lesson Content

1 miniAuto Platform Overview (20 minutes)

miniAuto Key Components:

Core Hardware:
  • • ESP32 microcontroller (WiFi + Bluetooth)
  • • Dual DC motors with encoders
  • • Ultrasonic distance sensor
  • • Camera module for AI vision
  • • LED indicators and buzzer
Advanced Features:
  • • Line following sensors
  • • Robotic gripper attachment
  • • Wireless glove controller
  • • Mobile app connectivity
  • • AI vision processing

Why miniAuto is Perfect for Learning:

  • • Combines all concepts we've learned (sensors, motors, programming)
  • • Real-world robotics platform with professional features
  • • Expandable and customizable for creative projects
  • • Perfect preparation for robotics competitions

Connection to Previous Lessons:

  • • Lesson 8-9: Arduino programming → ESP32 programming
  • • Lesson 10: Analog sensors → Camera and line sensors
  • • Lesson 11: Motor control → Precise wheel control
  • • Lesson 12: Ultrasonic sensors → Built-in obstacle detection

2 Assembly and Setup Process (25 minutes)

Assembly Steps (Hands-On):

  1. Attach motors to chassis frame
  2. Mount wheels and ensure proper alignment
  3. Install ESP32 controller board
  4. Connect motor driver and power distribution
  5. Mount ultrasonic sensor on front
  6. Install camera module (if included)
  7. Connect all wiring harnesses
  8. Install battery pack and test power

Safety and Best Practices:

  • • Always disconnect power when making connections
  • • Check polarity on all connections (red = positive, black = negative)
  • • Ensure screws are tight but don't over-tighten
  • • Keep workspace organized with small parts in containers
  • • Test each component before final assembly
/**
 * @file miniAuto_comprehensive_test.ino
 * @brief Comprehensive Motor and System Test Program
 * @author miniAuto Team / Hiwonder
 * @version V1.0
 * @date 2024-04-22
 * 
 * Motor Layout (numbers correspond to motorpwmPin[4] and motordirectionPin[4] indices):
 * [0] --|||--[1]       
 *  |          |        ^ counterclockwise
 *  |          |        |
 *  |          |        |
 *  |          |        |
 * [3] -------[2]
 */

#include <Arduino.h>

const static uint8_t pwm_min = 2;
const static uint8_t motorpwmPin[4] = {10, 9, 6, 11};        // Motor speed control pins
const static uint8_t motordirectionPin[4] = {12, 8, 7, 13};  // Motor direction control pins

void Motor_Init(void);
void Velocity_Controller(uint16_t angle, uint8_t velocity, int8_t rot, bool drift);
void Motors_Set(int8_t Motor_0, int8_t Motor_1, int8_t Motor_2, int8_t Motor_3);
void testSensors();

void setup() {
    Serial.begin(9600);
    Serial.setTimeout(500);
    Serial.println("🤖 miniAuto Comprehensive System Test");
    
    Motor_Init();  // Initialize motors
    
    // Comprehensive motor movement test
    Serial.println("Testing omnidirectional movement...");
    
    Serial.println("→ Forward");
    Velocity_Controller(0, 50, 0, 0);    // Move forward
    delay(1000);
    
    Serial.println("↗ Left-Forward diagonal");
    Velocity_Controller(45, 50, 0, 0);   // Move left forward
    delay(1000);
    
    Serial.println("← Left");
    Velocity_Controller(90, 50, 0, 0);   // Move left
    delay(1000);
    
    Serial.println("↙ Left-Backward diagonal");
    Velocity_Controller(135, 50, 0, 0);  // Move left backward
    delay(1000);
    
    Serial.println("↓ Backward");
    Velocity_Controller(180, 50, 0, 0);  // Move backward
    delay(1000);
    
    Serial.println("↘ Right-Backward diagonal");
    Velocity_Controller(225, 50, 0, 0);  // Move right backward
    delay(1000);
    
    Serial.println("→ Right");
    Velocity_Controller(270, 50, 0, 0);  // Move right
    delay(1000);
    
    Serial.println("↗ Right-Forward diagonal");
    Velocity_Controller(315, 50, 0, 0);  // Move right forward
    delay(1000);
    
    Serial.println("↺ Rotate left in place");
    Velocity_Controller(0, 0, 50, 0);    // Turn left in place
    delay(1000);
    
    Serial.println("↻ Rotate right in place");
    Velocity_Controller(0, 0, -50, 0);   // Turn right in place
    delay(1000);
    
    Serial.println("🌪️ Drift mode");
    Velocity_Controller(0, 100, 50, 1);  // Drift movement
    delay(1000);
    
    Serial.println("⏹️ Stop");
    Velocity_Controller(0, 0, 0, 0);     // Stop all motors
    
    // Test other systems
    testSensors();
    
    Serial.println("✅ All systems operational!");
}

void loop() {
    // System monitoring
    Serial.print("Battery Status: ");
    // Add battery monitoring code here
    Serial.println("OK");
    delay(5000);
}

// Motor initialization function
void Motor_Init(void) {
    for(uint8_t i = 0; i < 4; i++) {
        pinMode(motordirectionPin[i], OUTPUT);
    }
    Velocity_Controller(0, 0, 0, 0);
}

/**
 * @brief Speed control function for omnidirectional movement
 * @param angle     Controls robot motion direction (0-359°, front=0°, counterclockwise positive)
 * @param velocity  Controls robot speed (0-100)
 * @param rot       Controls rotation speed (-100 to 100, positive=counterclockwise)
 * @param drift     Enables drift mode (0=normal, 1=drift)
 */
void Velocity_Controller(uint16_t angle, uint8_t velocity, int8_t rot, bool drift) {
    int8_t velocity_0, velocity_1, velocity_2, velocity_3;
    float speed = 1;
    angle += 90;
    float rad = angle * PI / 180;
    
    if (rot == 0) speed = 1;  // Speed factor
    else speed = 0.5; 
    
    velocity /= sqrt(2);
    
    if (drift) {
        velocity_0 = (velocity * sin(rad) - velocity * cos(rad)) * speed;
        velocity_1 = (velocity * sin(rad) + velocity * cos(rad)) * speed;
        velocity_2 = (velocity * sin(rad) - velocity * cos(rad)) * speed - rot * speed * 2;
        velocity_3 = (velocity * sin(rad) + velocity * cos(rad)) * speed + rot * speed * 2;
    } else {
        velocity_0 = (velocity * sin(rad) - velocity * cos(rad)) * speed + rot * speed;
        velocity_1 = (velocity * sin(rad) + velocity * cos(rad)) * speed - rot * speed;
        velocity_2 = (velocity * sin(rad) - velocity * cos(rad)) * speed - rot * speed;
        velocity_3 = (velocity * sin(rad) + velocity * cos(rad)) * speed + rot * speed;
    }
    Motors_Set(velocity_0, velocity_1, velocity_2, velocity_3);
}

/**
 * @brief PWM and motor direction setting function
 * @param Motor_x   PWM and motor direction control values (calculated from mecanum wheel kinematics)
 */
void Motors_Set(int8_t Motor_0, int8_t Motor_1, int8_t Motor_2, int8_t Motor_3) {
    int8_t pwm_set[4];
    int8_t motors[4] = {Motor_0, Motor_1, Motor_2, Motor_3};
    bool direction[4] = {1, 0, 0, 1};  // Forward direction: left=1, right=0
    
    for(uint8_t i = 0; i < 4; ++i) {
        if(motors[i] < 0) direction[i] = !direction[i];
        else direction[i] = direction[i];

        if(motors[i] == 0) pwm_set[i] = 0;
        else pwm_set[i] = map(abs(motors[i]), 0, 100, pwm_min, 255);

        digitalWrite(motordirectionPin[i], direction[i]); 
        analogWrite(motorpwmPin[i], pwm_set[i]); 
    }
}

void testSensors() {
    Serial.println("Testing sensors...");
    // Add sensor testing code here
    Serial.println("✓ Sensors OK");
}

3 Default Programs and Features (15 minutes)

Built-in Demonstration Programs:

  • Remote Control: Mobile app or wireless glove control
  • Obstacle Avoidance: Autonomous navigation
  • Line Following: Track following behavior
  • AI Vision Games: Object recognition and tracking
  • Dance Mode: Choreographed movement patterns

Note about miniAuto Library:

Some online examples reference #include "miniAuto.h" but this is a custom library file that should come with your kit. For educational purposes, we use direct Arduino functions as shown in the comprehensive test code above.

The manufacturer's code (above) uses standard Arduino libraries and direct pin control, which helps you understand exactly how the robot works at the hardware level.

4 Mobile App and Wireless Control (15 minutes)

App Connection Process:

  1. Download miniAuto app from app store
  2. Enable WiFi hotspot mode on robot
  3. Connect phone to robot's WiFi network
  4. Launch app and establish connection
  5. Test basic movement controls
  6. Explore advanced features (camera view, sensors)

App Features to Explore:

  • Manual Control: Joystick and button interface
  • Live Camera Feed: See what the robot sees
  • Sensor Dashboard: Real-time sensor readings
  • Programming Mode: Block-based programming interface
  • Competition Modes: Line following, obstacle course

Hands-On Activity (25 minutes)

Project: miniAuto First Contact

Students will complete the full setup process and create their first custom program for their miniAuto robot.

Setup Checklist:

  • □ Complete physical assembly
  • □ Load and test system diagnostic program
  • □ Establish mobile app connection
  • □ Test all basic movements via app
  • □ Verify sensor readings
  • □ Create custom "robot introduction" program

Custom Program Requirements:

  • • Robot introduces itself with movement and sounds
  • • Demonstrates key capabilities (movement, sensors, lights)
  • • Responds to environment (obstacles, distance)
  • • Includes personality elements (unique behaviors)

Troubleshooting Guide:

  • No movement: Check battery, motor connections
  • App won't connect: Verify WiFi settings, restart robot
  • Sensors not working: Check wiring, test with multimeter
  • Erratic behavior: Check for loose connections, interference

Assessment & Homework

Quick Check (In Class):

  • • Is the robot properly assembled and functional?
  • • Can student establish app connectivity?
  • • Are all major systems working (motors, sensors, LEDs)?
  • • Can they create and load custom programs?

Homework Assignment:

Robot Personality Development

Create a unique "personality" for your miniAuto robot. Program distinct behaviors, movement patterns, and responses that make your robot unique. Include at least 3 different "moods" or behavior modes that can be triggered by different conditions.

← Previous: Lesson 12
📝 Take Lesson 13 Quiz Next: Lesson 14 →