본문 바로가기

[아두이노]휨센서를 활용한 휘어짐 측정

반응형

 오늘은 휨센서를 사용해서 어느정도 휘어졌는지를 측정해보겠습니다.멀티미터로 측정해보니 22K옴(똑바로 펴진상태)~ 72K옴(구브르져 있는 상태,360도 접히기 직전상태) 에 따라 저항값이 변하게 되어 있는 센서 입니다. 모양은 아래 그림과 같습니다.



아주 오랜 옛날에 닌텐도 게임 악세서리인 파워글러브라는 것에 사용 됬다고 하는데 평은 그닥 좋지 않았네요;;;

준비물

저항 - 1K옴

[TSS10264] 휨센서 - 2.2인치 (구부림 센서, Flex Sensor 2.2)

브레드보드, 아두이노

점프선

LED


결선


코드는 이하와 같습니다.


  1. /*
  2.   AnalogReadSerial
  3.   Reads an analog input on pin 0, prints the result to the serial monitor.
  4.   Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
  5.  
  6.  This example code is in the public domain.
  7.  */
  8.  
  9. // the setup routine runs once when you press reset:
  10. void setup() {
  11.   // initialize serial communication at 9600 bits per second:
  12.   Serial.begin(9600);
  13. }
  14.  
  15. // the loop routine runs over and over again forever:
  16. void loop() {
  17.   // read the input on analog pin 0:
  18.   int sensorValue = analogRead(A0);
  19.   // print out the value you read
  20.   Serial.println(sensorValue);
  21.   delay(1);        // delay in between reads for stability
  22. }


 

실행을 해보면 똑바로 펴져 있을 때는 시리얼 모니터에 40으로 나오고 360도로 구브리게 되면 13~14정도의 값이 나오는 것을 확인 할 수 있습니다.범위를 어느정도 지정해서 손가락을 폈는지 오므렸는지 알 수 있겠네요.


똑바로 펴져있는 상태.


구부린 상태


감사합니다.

반응형
-->