아래 사이트에 접속하여 3d 모델링 파일을 다운받는다.
https://www.thingiverse.com/thing:260152
압축을 해제한 후 files 폴더로 이동한다.
슬라이싱 프로그램을 이용하여 자신의 3d 프린터에 맞는 출력 파일로 변환해준다.
모델링 파일을 3d 프린터로 출력한다.
출력물의 표면을 사포질 한 후 각 부분을 접착제를 이용하여 조립해준다.
PLA로 출력한 탓에 수축이 있어 틈새가 발생하였다.
이럴 경우에는 퍼티를 이용하여 빈 곳을 메꿔준다.
적색과 금색 락카를 이용하여 겉 표면을 도색해준다.
빈 곳을 채울 때 사용한 퍼티의 색이 진한 색일 경우 백색의 락카를 먼저 칠해준 후 도색을 해야 퍼티를 채운 부분의 색이 어두워지지 않는다.
적색과 금색이 모두 들어간 헬멧 부분에는 마스킹 테이프를 이용한다.
마스킹 테이프를 사용하여 락카칠을 하게 되면 적색과 금색의 경계선 부분이 깔끔하지 않게 되는데, 이 부분은 락카를 바닥에 살짝 뿌린 후 붓으로 찍어 발라준다.
접착제를 이용하여 조립할 때 머리에 착용 가능케하기 위해 세 개의 파트로 구분하였다.
아래 부품들을 사용하여 세 개의 파트들이 하나의 몸체가 되도록 만들어준다.
사각 네오디뮴 자석 4개
서보 모터 모듈
사각 네오디뮴 자석은 40mm x 20mm x 5mm 를 4개 사용하였다.
헬멧과 마스크를 연결해주는 서보 모터 모듈은 아래 사이트에서 다운 받는다.
http://www.thingiverse.com/thing:1396238
LED를 달기에 앞서 투명 플라스틱을 눈 부위에 붙여준다.
우드락에 LED가 들어갈 구멍을 뚫은 후 고휘도 LED를 넣어준다.
배치가 끝났으면 모든 LED를 극성에 따라 병렬로 연결해준다.
3V 건전지를 연결한 후 테스트해본다.
모듈을 조립하고 마스크가 부드럽게 위, 아래로 움직이는지 확인한다.
큐리나노는 블루투스 모듈이 내장되어 있어 별도로 블루투스 센서를 연결할 필요가 없다.
서보 모터
5V - 붉은색 선
GND - 갈색선
9번핀 - 노란색선
LED 모듈
6번 핀에 LED 모듈의 -극 연결
7번 핀에 LED 모듈의 +극 연결
서보 모터는 작동 시 많은 전류가 필요하다. 큐리나노 보드와는 별도로 배터리를 추가로 연결해준다.
구동을 위해 3.7V 500mh 리튬폴리머 배터리를 2개(큐리나노용 1개, 서보모터용 1개) 사용하였다.
스마트폰으로 마스크가 열고 닫히도록 아두이노 코드를 작성해준다.
정상적인 컴파일을 위해서는 아두이노에 'curie' 라이브러리를 설치해준다.
"아두이노 - 툴 - 라이브러리 관리"에 있는 검색창에서 'curie'를 검색
제일 처음에 있는 아두이노 101 라이브러리 설치
"아두이노 - 툴 - 보드"에서 'Arduino/Genuino 101'을 선택해준다.
#include <CurieBLE.h>
#include <Servo.h>
BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // BLE LED Service
// BLE LED Switch Characteristic - custom 128-bit UUID, read and writable by central
BLEUnsignedCharCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
const int maskPin = 9; // pin to use for the Servo Motor
const int LEDGND = 6; // pin to use for the LED
const int LEDPin = 7; // pin to use for the LED
int pos = 0;
Servo myservo;
void setup() {
Serial.begin(9600);
// set LED pin to output mode
myservo.attach(maskPin);
pinMode(LEDGND, OUTPUT);
pinMode(LEDPin, OUTPUT);
digitalWrite(LEDGND, LOW);
// begin initialization
BLE.begin();
// set advertised local name and service UUID:
BLE.setLocalName("LED");
BLE.setAdvertisedService(ledService);
// add the characteristic to the service
ledService.addCharacteristic(switchCharacteristic);
// add service
BLE.addService(ledService);
// set the initial value for the characeristic:
switchCharacteristic.setValue(0);
// start advertising
BLE.advertise();
myservo.write(170);
Serial.println("BLE LED Peripheral");
}
void loop() {
// listen for BLE peripherals to connect:
BLEDevice central = BLE.central();
// if a central is connected to peripheral:
if (central) {
Serial.print("Connected to central: ");
// print the central's MAC address:
Serial.println(central.address());
// while the central is still connected to peripheral:
while (central.connected()) {
// if the remote device wrote to the characteristic,
// use the value to control the LED:
if (switchCharacteristic.written()) {
int val = switchCharacteristic.value();
if (val == 0) { // 마스크 닫힘
Serial.println("Mask CLOSE");
for (pos = 170; pos > 100; pos -= 1)
{
myservo.write(pos);
delay(15);
}
for (pos = 100; pos >= 50; pos -= 1)
{
myservo.write(pos);
delay(10);
}
digitalWrite(LEDPin, HIGH);
} else if (val == 1) { // 마스크 열림
Serial.println("Mask OPEN");
digitalWrite(LEDPin, LOW);
for (pos = 50; pos < 100; pos += 1)
{
myservo.write(pos);
delay(10);
}
for (pos = 100; pos <= 170; pos += 1)
{
myservo.write(pos);
delay(15);
}
} else {
Serial.println("LED off");
digitalWrite(LEDPin, LOW);
}
}
}
// when the central disconnects, print it out:
Serial.print(F("Disconnected from central: "));
Serial.println(central.address());
}
}
스마트폰에 "nRF Connect for Mobile" 앱을 설치한다.
큐리나노와 연결시킨 후 아래의 값을 입력하여 제대로 동작하는지 테스트해본다.
0을 전송하면 마스크 열림 (0x00)
1을 전송하면 마스크 닫힘 (0x01)
2를 전송하면 LED 꺼짐 (0x10)