Head Servo

Turn your head. The servo follows.

This needs Chrome or Edge on a laptop. Other browsers cannot talk to the Arduino.

1 Camera

camera off

2 Servo

90°
OFF Camera OFF Face OFF Arduino
Motion

Reach is how far you turn to hit 0 and 180. Lower is more sensitive.

3 Board

  • Brown to GND
  • Red to 5V
  • Orange to pin 9

Upload this sketch with the Arduino Code Loading Tool. Return here, then connect the Arduino. One SG90 can run from USB.

#include <Servo.h>

Servo myServo;

void setup() {
  Serial.begin(115200);
  myServo.attach(9);
  myServo.write(90);
}

void loop() {
  int angle = -1;
  while (Serial.available() > 0) {
    angle = Serial.read();   // keep only the newest number
  }
  if (angle >= 0 && angle <= 180) {
    myServo.write(angle);
  }
}

Head Servo by Ramsey Musallam