Exercise 2: Arduino Basics & Running Light

Learning Open Source Hardware - Arduino UNO R4 WiFi Development Board

Introduction to Arduino

Arduino UNO R4 WiFi

Reference: Arduino UNO R4 WiFi 开发板详解 - View on Xiaohongshu (Little Red Book)

Arduino is an open-source electronic prototyping platform that includes hardware (various Arduino board models) and software (Arduino IDE). Its core advantages are:

Common Application Scenarios:

1. Arduino IDE

(1) Introduction

Arduino IDE is an integrated development environment for writing, uploading, and debugging programs based on the Arduino platform. It's an open-source tool that runs on Windows, Mac OS X, and Linux systems. It uses C/C++ language with a simple graphical interface, including built-in code editor, compiler, uploader, and serial monitor.

Arduino IDE Interface
IDE Feature 1 IDE Feature 2 IDE Feature 3 IDE Feature 4

References:

(2) Coding Methods

(3) Hardware Connection

2. Running Light Program

Below is the complete code for implementing the running light effect:

// Define LED pins: 2, 3, 4, 5, 6, 7
int ledPins[] = {2, 3, 4, 5, 6, 7};
int ledCount = 6;

void setup() {
  // Initialize all pins as output mode
  for (int i = 0; i < ledCount; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
}

void loop() {
  // Light from left to right
  for (int i = 0; i < ledCount; i++) {
    digitalWrite(ledPins[i], HIGH);
    delay(150);
    digitalWrite(ledPins[i], LOW);
  }

  // Light from right to left
  for (int i = ledCount - 2; i > 0; i--) {
    digitalWrite(ledPins[i], HIGH);
    delay(150);
    digitalWrite(ledPins[i], LOW);
  }
}
Running Light Effect 1 Running Light Effect 2

3. Case Studies

Case 1: "Emotion Aid" Project

Emotion Aid Device

Case Link: https://blog.arduino.cc/2023/05/19/the-emotion-aid-is-a-wearable-device-that-communicates-the-users-emotions/#respond

Advantages:

  1. Novel & Intuitive Output: Uses pure physical motion to express emotions rather than screens or lights, more friendly to sensory-sensitive individuals
  2. Multi-modal Signal Fusion: Integrates EDA, body temperature, and heart rate signals using "multi-modal fusion" to improve emotion inference robustness
  3. Open Source & Community Friendly: Complete course design with code, circuit diagrams, and structural designs fully open-sourced on Instructables

Disadvantages:

  1. Oversimplified Emotion Inference: Inferring complex human emotions solely from EDA, heart rate, and temperature is scientifically extremely difficult
  2. Rough Data Fusion: No effective noise reduction or feature extraction on raw data; motion artifacts severely interfere with signals
  3. Suboptimal Wearing Position: Attached to underwear limits gender applicability and is greatly affected by breathing and body movement
  4. Battery & Durability Issues: 9V battery has limited capacity,难以 support long-term use and servo current requirements
  5. Risk of Emotional Labeling: Crude simplification of emotional states may传递 wrong information when misjudged, causing social misunderstandings

Case 2: UESTC Professor Xu Peng's Team - "Wireless Brain Function Assessment System"

Case Link: https://www.new1.uestc.edu.cn/?n=UestcNews.Front.DocumentV2.ArticlePage&Id=96164

Advantages:

  1. Pioneered "Quantitative Diagnosis": Combined EEG signals with AI algorithms to transform diagnosis from experience-based "qualitative judgment" to data-supported "quantitative diagnosis"
  2. High User-Friendliness: Wireless dry-electrode EEG cap for diagnosis and short-duration treatment (3 times daily, 40 seconds each) greatly improved comfort and cooperation
  3. "Deep Brain" Intervention Possible: Targeted transcranial magnetic therapy indirectly regulates deep brain regions through superficial "relay stations", achieving over 80% effectiveness

Disadvantages:

  1. High Technical Threshold & Cost: BCI and TMS equipment研发 and manufacturing costs are high, mainly面向 tertiary hospitals or professional rehabilitation institutions in the short term
  2. Physiological Signal Limitations: EEG signals have low signal-to-noise ratio and are easily interfered with;后期 processing and AI model training require extremely high algorithm standards
  3. Institutional Application Constraints: The entire system requires professional场地 operation,难以 serve as home daily intervention equipment
  4. Long-term Safety & Effectiveness Pending Verification: Although effectiveness exceeds 80%, this evaluation多源于 short-term clinical observations; long-term impacts need longer tracking studies
  5. "Black Box" Problem: AI algorithms虽 accurate but decision logic is opaque to humans, making it difficult for doctors to judge specific bases for conclusions

Summary

Through this exercise, we learned:

← Back to Exercise List