인텔 퀴리(Arduino 101) 기반 모션 감지 조명 시스템
부품 및 소모품
| 부품 | 수량 |
| 아두이노 101 (Arduino 101, 인텔 퀴리 탑재) | 1 |
프로젝트 소개
목표
- 발소리 감지 시 조명 자동 켜기/끄기
- 주변 춤/탭 댄스 템포에 맞춰 조명 깜빡임 동기화
- 가속도계/자이로스코프 판독값을 USB/블루투스로 출력해 지진파 감지 활용
GitHub 저장소
https://github.com/ckuzma/arduino-101-sketches
스케치 모음
1. TapFlashTest - 탭 감지 시 내장 LED 점멸
#include "CurieIMU.h"
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
CurieIMU.begin();
CurieIMU.attachInterrupt(eventCallback);
CurieIMU.setDetectionThreshold(CURIE_IMU_SHOCK, 1050); // 1.050g = 1050mg
CurieIMU.setDetectionDuration(CURIE_IMU_SHOCK, 75); // 75ms
CurieIMU.interrupts(CURIE_IMU_SHOCK);
}
void loop() { }
static void eventCallback(void) {
if (CurieIMU.getInterruptStatus(CURIE_IMU_SHOCK)) {
digitalWrite(LED_BUILTIN, HIGH);
delay(50);
digitalWrite(LED_BUILTIN, LOW);
}
}
- 충격(탭) 감지 시 내장 LED 50ms 점멸
- 충격 감지 임계값/지속시간 튜닝용
2. TapBeatMatch - 탭 템포에 맞춰 LED 깜빡임 동기화
- 아두이노 101 근처 테이블 탭 템포에 맞춰 내장 LED 깜빡임 동기화
- 가중 평균으로 노이즈 완화
- 충격 감지 임계값 조절 가능
3. SeismicReader + Python 시각화 스크립트
- 아두이노 101이 JSON 형식의 가속도계/자이로 값을 시리얼로 출력
- 파이썬 스크립트가 데이터를 읽어 터미널에 간단 그래프 표시
- CSV로 저장해 엑셀에서 그래프 가능
- 파이썬 2.x/3.x 크로스 플랫폼 지원
4. VibrationLighting - 진동 감지 조명 제어
- 원래는 발소리 감지로 조명 켜기/끄기 설계했으나, 신호대잡음비 문제로 더블 탭 감지로 축소
- 현관 거울 아래 LED 스트립이 거울을 두 번 두드리면 켜지고 다시 두드리면 꺼짐
보너스: 외부 자이로스코프(MPU-6050) 연동
별도 가속도/자이로 센서(ITG-MTU / GY-521 / MPU-6050)를 거의 모든 아두이노에 연결하고 CurieGraph.py로 데이터 시각화 가능. 지진파 데이터 크라우드소싱 가능성 입증용.
#include <Wire.h>
const int MPU_addr = 0x68; // MPU-6050 I2C 주소
int ax, ay, az, temp, gx, gy, gz;
void setup() {
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(MPU_addr);
Wire.write(0x6B); Wire.write(0); Wire.endTransmission(true);
}
String jsonEncodeValue(String key, float keyVal) {
return "\"" + key + "\":" + String(keyVal);
}
String assembleJson(String keysAndVals) {
return "{" + keysAndVals + "}";
}
void loop() {
Wire.beginTransmission(MPU_addr);
Wire.write(0x3B); Wire.endTransmission(false);
Wire.requestFrom(MPU_addr, 14, true);
ax = Wire.read()<<8 | Wire.read();
ay = Wire.read()<<8 | Wire.read();
az = Wire.read()<<8 | Wire.read();
temp = Wire.read()<<8 | Wire.read();
gx = Wire.read()<<8 | Wire.read();
gy = Wire.read()<<8 | Wire.read();
gz = Wire.read()<<8 | Wire.read();
String keyVals = jsonEncodeValue("ax", ax) + ",";
keyVals += jsonEncodeValue("ay", ay) + ",";
keyVals += jsonEncodeValue("az", az) + ",";
keyVals += jsonEncodeValue("gx", gx) + ",";
keyVals += jsonEncodeValue("gy", gy) + ",";
keyVals += jsonEncodeValue("gz", gz);
Serial.println(assembleJson(keyVals));
delay(100);
}
코드
아두이노 101 전용 스케치 모음. 인텔 퀴리의 가속도계/자이로스코프 활용.
GitHub 저장소 바로가기