Since there's very little room in the helmet the wireless system was powered by a single 7.4V NiMH battery pack. The digital servos used in the helmet are designed to be operated on 7.4V so a DC/DC converter is used to provide power for the Arduino, XBee and LEDs.
A larger image is available here.
Here's the code for the helmet-
#include "Servo.h" // include the servo library
Servo faceplateServo;
Servo chinServo;
int ledPin1 = 4; // control pin for LED eyes
int servoPin1 = 2; // control pin for face plate servo
int servoPin2 = 3; // control pin for chin
void setup() {
faceplateServo.attach(servoPin1); // attaches the servo on pin 2 to the servo object
chinServo.attach(servoPin2); // attaches the servo on pin 3 to the servo object
faceplateServo.write(30); // rotate face plate servo to 30 degrees
chinServo.write(95); // rotate chin servo to 95 degrees
pinMode(ledPin1, OUTPUT); // sets the LED pin as output
digitalWrite(ledPin1, HIGH); // turn on LED eyes
Serial.begin(9600);
}
void loop() {
// look for a capital A over the serial port and turn off LED
if (Serial.available() > 0) {
if (Serial.read() == 'A') {
digitalWrite(ledPin1, LOW); // turn off LED eyes
delay(500); // wait half a second
faceplateServo.write(95); // rotate the face plate servo to 95 degrees
chinServo.write(20); // rotate the chin servo to 20 degrees
delay(4000); // wait 4 seconds
chinServo.write(95); // rotate the chin servo to 95 degrees
faceplateServo.write(30); // rotate the face plate servo to 30 degrees
digitalWrite(ledPin1, HIGH); // turn on LED eyes
}
}
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.