## Human-Machine Interfaces & Positional Actuation
A complete embedded system requires bidirectional interaction: displaying telemetry and diagnostics to human operators via visual screens, and physically manipulating the physical environment using precision positional actuators.
§
1. Liquid Crystal Displays (LCD) vs Graphic OLED
TEXTSYSTEM SCHEMATIC
ALPHANUMERIC 16x2 LCD WITH I2C BACKPACK:
+---------------------------------------------------------------+
| [T][E][M][P][: ] [2][4][.][5][ ][C] [ ] [ ] [ ] [ ] [ ] [ ] |
| [S][P][E][E][D][: ][1][2][0][0][ ][R][P][M] [ ] [ ] [ ] [ ] |
+---------------------------------------------------------------+
- Displays 32 fixed-size characters across 2 rows.
- Controlled over I2C at address 0x27 using LiquidCrystal_I2C.
GRAPHIC 128x64 MONOCHROME OLED (SSD1306):
+---------------------------------------------------------------+
| System Telemetry [Battery: 85%] |
| --------------------------------------- |
| Distance: 45.2 cm *** WAVEFORM PLOT *** |
| Status: ACTIVE RUNNING / / / |
| / / --/ |
+---------------------------------------------------------------+
- 8,192 individually addressable pixels (128 columns x 64 rows).
- High contrast, wide viewing angle, low power draw.§
2. Positional Servo Motor Control Physics
Unlike continuous DC motors that spin freely when powered, a Servo Motor rotates to an exact commanded angle (typically 0° to 180°) and holds that position under physical load:
TEXTSYSTEM SCHEMATIC
SERVO 50 Hz CONTROL PULSE TIMELINE (20ms Total Period):
POSITION 0 DEGREES (1.0 Millisecond Pulse Width):
5V |-- 1.0ms --|
0V | |-----------------------------------------------| (19.0ms OFF)
POSITION 90 DEGREES - CENTER (1.5 Millisecond Pulse Width):
5V |---- 1.5ms ----|
0V | |-------------------------------------------| (18.5ms OFF)
POSITION 180 DEGREES (2.0 Millisecond Pulse Width):
5V |------ 2.0ms ------|
0V | |---------------------------------------| (18.0ms OFF)§
3. Integrated Display & Servo Sweep Code
CPPSYSTEM SCHEMATIC
// =============================================================================
// I2C OLED DISPLAY & SERVO RADAR SWEEP
// =============================================================================
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Servo.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Servo radarServo;
const uint8_t SERVO_PIN = 9;
void setup() {
radarServo.attach(SERVO_PIN);
// Initialize OLED at address 0x3C
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
for (;;); // Lock up if OLED hardware fails
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(10, 25);
display.println(F("Radar System Boot..."));
display.display();
delay(1000);
}
void loop() {
// Sweep servo from 0 to 180 degrees
for (int angle = 0; angle <= 180; angle += 10) {
radarServo.write(angle);
updateDisplay(angle);
delay(50);
}
// Sweep back from 180 to 0 degrees
for (int angle = 180; angle >= 0; angle -= 10) {
radarServo.write(angle);
updateDisplay(angle);
delay(50);
}
}
void updateDisplay(int currentAngle) {
display.clearDisplay();
display.setCursor(0, 0);
display.println(F("--- RADAR SCANNER ---"));
display.setCursor(0, 20);
display.print(F("Current Azimuth: "));
display.print(currentAngle);
display.println(F(" deg"));
// Draw visual angle gauge bar
int barWidth = map(currentAngle, 0, 180, 0, 120);
display.drawRect(4, 45, 120, 10, SSD1306_WHITE);
display.fillRect(4, 45, barWidth, 10, SSD1306_WHITE);
display.display();
}