-
ARM MBED 엠베드 압력센서 QA3040P 구동 방법개발 팁/Embedded 2017. 11. 11. 13:15반응형
ARM MBED 엠베드 압력센서 구동 방법
1) ARM MBED 보드 중 NXP FRDM-K64F 보드의 핀 PIN 배치도는 다음과 같다
2) 압력 센서와 회로도는 다음과 같다.
QA3040P (46mmX33mm) http://www.eleparts.co.kr/EPXHG7FW
3) K64F 보드와 QA3040P를 회로도에 맞게 연결한다
K64F 3.3V -> 압력센서의 A 단자
압력센서의 V 단자 -> 브레드보드 10
브레드보드 10 -> K64F A0 (Analog In)
브레드보드 10 -> 저항(2K옴) // 1K옴~47K옴 사이인데 구할 수 있는 것이 2K옴
저항(2K옴) -> K64F GND
연결 사진은 아래와 같다.
4) 코드를 입력한다.
예제 코드는 아래와 같다
AnalogIn p0(A0);DigitalOut led1(LED1);// main() runs in its own thread in the OSint main() {while (true) {led1 = !led1;printf( "p0 input:%f\n", p0.read());wait(0.5);}}
5) 터미널에서 입력을 확인한다
뒤에서 세자리 정도는 노이즈로 보면 되고, 압력을 점점 가하면 값이 올라가는데 최대 1.0까지 올라간다. 꽤 정밀한 편이어서 다양하게 사용할 수 있을 것 같다.
반응형'개발 팁 > Embedded' 카테고리의 다른 글
임베디드 구현을 위한 음계 주파수 옥타브 정보 (0) 2017.11.12 ARM MBED 엠베드 초음파센서 HC SR04 구동 방법 (0) 2017.11.11 ARM MBED 엠베드 FRDM-K64F 보드 PIN 핀 배치 설명 그림 (0) 2017.11.11 ARM MBED 예제 (Blinky/블링키) 빌드/컴파일/다운로드 (0) 2017.10.28 ARM MBED 개발 환경 설치/셋업 방법 (윈도우즈/Windows) (0) 2017.10.28