아두이노 - 힘 센서 | Arduino - Force Sensor

이 튜토리얼에서 우리는 배울 예정입니다:

준비물

1×Arduino Uno Amazon
1×USB 2.0 cable type A/B 쿠팡 | Amazon
1×Force Sensor Amazon
1×10 kΩ resistor Amazon
1×Breadboard 쿠팡 | Amazon
1×Jumper Wires Amazon
1×(Optional) 9V Power Adapter for Arduino Amazon
1×(Recommended) Screw Terminal Block Shield for Arduino Uno 쿠팡 | Amazon
1×(Optional) Transparent Acrylic Enclosure For Arduino Uno Amazon
공개: 이 섹션에서 제공된 링크 중 일부는 제휴 링크입니다. 이 링크를 통해 구매한 경우 추가 비용없이 수수료를 받을 수 있습니다. 지원해 주셔서 감사합니다.

힘 센서에 관하여

Force sensor pinout

힘 센서는 또한 힘 감지 저항기, 힘 민감 저항기, 또는 FSR로 알려져 있습니다. 힘 센서는 기본적으로 얼마나 많이 눌렸는지에 따라 그 저항값이 변하는 저항기입니다. 힘 센서는:

  • 저렴하고 사용하기 쉬움.
  • 물리적 압력, 압박을 감지하는 데 뛰어남.
  • 몇 파운드의 무게가 그 위에 있는지 찾는 데는 능숙하지 않음.

힘 센서는 전자 드럼, 휴대 전화, 휴대용 게임 기기 및 많은 휴대용 전자 제품에 사용됩니다.

핀 배치

힘 센서는 두 개의 핀을 가지고 있습니다. 이것이 일종의 저항기이기 때문에, 우리는 이 핀들을 구분할 필요가 없습니다. 그들은 대칭입니다.

작동 원리

힘 센서는 본질적으로 얼마나 눌렸는지에 따라 저항이 변하는 저항기입니다. 센서를 더 세게 누르면 두 단자 사이의 저항이 낮아집니다.

선연결

Arduino Force Wiring Diagram

이 이미지는 Fritzing을 사용하여 만들어졌습니다. 이미지를 확대하려면 클릭하세요.

힘 센서를 위한 프로그래밍 방법

Arduino Uno의 A0에서 A5 핀은 아날로그 입력으로 작동할 수 있습니다. 아날로그 입력 핀은 전압(0v와 VCC 사이)을 정수 값(0에서 1023 사이), 즉 ADC 값 또는 아날로그 값으로 변환합니다.

힘 센서의 핀을 아날로그 입력 핀에 연결함으로써, analogRead() 함수를 사용하여 핀에서 아날로그 값을 읽을 수 있으며, 그러면 얼마나 눌렸는지 알 수 있습니다.

아두이노 코드

/* * 이 Arduino 코드는 newbiely.kr 에서 개발되었습니다 * 이 Arduino 코드는 어떠한 제한 없이 공개 사용을 위해 제공됩니다. * 상세한 지침 및 연결도에 대해서는 다음을 방문하세요: * https://newbiely.kr/tutorials/arduino/arduino-force-sensor */ #define FORCE_SENSOR_PIN A0 // FSR과 10K 풀다운이 A0에 연결되어 있습니다. void setup() { Serial.begin(9600); } void loop() { int analogReading = analogRead(FORCE_SENSOR_PIN); Serial.print("Force sensor reading = "); Serial.print(analogReading); // 원시 아날로그 읽기 값을 출력합니다 if (analogReading < 10) // 0에서 9까지 Serial.println(" -> no pressure"); else if (analogReading < 200) // 10에서 199까지 Serial.println(" -> light touch"); else if (analogReading < 500) // 200에서 499까지 Serial.println(" -> light squeeze"); else if (analogReading < 800) // 500에서 799까지 Serial.println(" -> medium squeeze"); else // 800에서 1023까지 Serial.println(" -> big squeeze"); delay(1000); }

사용 방법

  • 위의 코드를 복사하여 아두이노 IDE로 열기
  • 아두이노 IDE에서 Upload 버튼을 클릭하여 아두이노에 코드 업로드하기
  • 힘 센서를 누르기
  • 시리얼 모니터에서 결과 보기
COM6
Send
Force sensor reading = 0 -> no pressure Force sensor reading = 0 -> no pressure Force sensor reading = 132 -> light touch Force sensor reading = 147 -> light touch Force sensor reading = 394 -> light squeeze Force sensor reading = 421 -> light squeeze Force sensor reading = 607 -> medium squeeze Force sensor reading = 791 -> medium squeeze Force sensor reading = 921 -> big squeeze Force sensor reading = 987 -> big squeeze Force sensor reading = 0 -> no pressure Force sensor reading = 0 -> no pressure
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

동영상

비디오 제작은 시간이 많이 걸리는 작업입니다. 비디오 튜토리얼이 학습에 도움이 되었다면, YouTube 채널 을 구독하여 알려 주시기 바랍니다. 비디오에 대한 높은 수요가 있다면, 비디오를 만들기 위해 노력하겠습니다.

※ OUR MESSAGES

  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!