HC-05 초기화 - HC-05 chogihwa

 요즘은 핸드폰(마스터)와 블루투스 모듈(슬레이브)을 많이 연결시켜 사용하곤 하는데, 저는 블루투스 모듈(마스터)와 블루투스 모듈(슬레이브)를 연결시켜 보도록 하겠습니다!! 이런경우는 RC카와 조종기 등으로 사용할 수 있습니다!!

우선 저는 마스터로 사용할 모듈인 HC-05 와 슬레이브로 사용할 HC-06을 이용하여 연결시켜보겠습니다.

블루투스 연결은 마스터와 슬레이브간 연결만 가능하므로 HC-05의 마스터 변경법은 전 글을 참고해주세요!!

 슬레이브의 AT모드 먼저 들어갑니다!

 가장먼저 해줘야할 것은 슬레이브와 마스터 모듈의 핀 번호를 맞춰주는 것입니다! 저는 0000으로 맞춰줬구요, 슬레이브 AT모드로 접속하신 다음 AT커맨더에 AT+ADDR 로 주소를 스캔해오시면 됩니다!!

 HC-06 의 경우 AT+ADDR 이 안먹는 경우가 많기때문에 저는 핸드폰과 연결한 다음 핸드폰으로 주소를 얻어왔습니다!! 핸드폰으로 보니 주소가 59 : 34 : 23 : 12 : 31: b0 이런 형식으로 되어있습니다!! 또한 통신속도도 맞춰줘야 하므로 AT+BAUD4로 9600으로 맞춰줍니다

다음은 마스터 모듈 차례입니다.

HC-05로 AT모드에 접속한 후 AT+ROLE=1 로 마스터 설정을 하고 핀번호 또한 0000으로 맞춰줍니다!! 이제 아까 슬레이브에서 따온 주소를 넣어주기만 하면 되는데 주소형식은 5934,23,1231b0 로 넣어주시면 됩니다!!

AT+CMODE=1 으로 다른 연결이 없도록 한뒤 AT+BIND=5934,23,1231b0 이렇게 주소를 넣어주시면 됩니다!

그리고 AT모드를 빠져나오면(AT+INIT) 요란스럽게 반짝이던 불빛이 달라지는 것을 보실 수 있습니다.

모듈은 한번 페어링 해놓으면 오토페어링이 되기때문에 다음부턴 똑같은 작업 안하셔도 좋습니다!!

아래는 오토페어링이 되는 제 HC-06(좌)과 HC-05(우)의 모습입니다!

//youtu.be/hyME1osgr7s 참고 유투브영상입니다

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

//www.martyncurrey.com/hc-05-and-hc-06-zs-040-bluetooth-modules-first-look/

▼질문 있는 분은 아래 댓글 남겨주세요

HC-05.pdf    (중국어 메뉴얼, 판매자, email 포함 + 회로도)

hc-05_at_commands.pdf

AT+UART=<Param1>,<Param2>,<Param3>

AT+UART=115200,1,2 라고 입력하면 Response는 OK이다.

AT+UART? 라고 입력하면 Response는 +UART:9600,1,2 이다.

HC-05의 특징은...

button switch가 있다.

핀이 6개 이다.

Master/Slave로 역할을 바꿀 수 있다.

▼AT Command입력모드로 진입하기전에 설정법

//www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-at-mode/

If using the button switch, remove power, press and hold the button switch, re-apply power (while holding the button switch). When you see the LED come release the button switch.

The LED should be blinking slowly on/off once every couple of seconds. This indicates AT mode.

버튼을 hold한채로 전원공급을 다시한다.

그리고 LED가 켜졌을때 버튼을 release한다.

그러면 LED가 1초에 한번씩 깜빡이는데 이때가 AT Mode에 진입한 상태이다.

//www.youtube.com/watch?v=rbq7wj3L-6U&feature=youtu.be

Default BaudRate는 38400 이다. (◀우선 38400으로 해줘야 AT Command가 먹힌다.)

//instructables.tistory.com/175 ☜ 여기 링크를 통해서 9600으로 바꿔줘야만 한다.

In case of using HC-06, I recommand you to use Ultra-Serial-Port-Monitor program.

(▶LINK)

HC-06.pdf

(AT+BAUD+4  를 입력했을때, OK9600이 떠야만한다.)

(AT+NAME)

(AT+PINxxxx  :  xxxx는 PW에 해당한다. (Default는 1234이다.))

우선

– the HC-06 does not have a button switch
– the HC-06 only 4 header pins
– the HC-06 does not have pins 31-34 connected


Button Switch

The push button switch connects VCC (3.3v) to pin 34 

and is used to put the EGBT-045MS / HC-05 in to AT mode.

푸쉬 버튼은 AT mode로 들어가는데 쓰인다.

There are 2 AT modes, I refer to them as “mini mode” and “full mode”. 

Briefly pressing the button switch puts the modules 

in to mini mode 

and not all commands work.

두가지 AT modes가 있다, 난 참조한다. to them as "mini mode" 그리고 "full mode".

간단히 누르기.. the 버튼 스위치를 ..는 puts한다. the모듈을

into mini mode

and 모든 commands는 동작하지않는다.

Keeping the switch closed puts the modules 

in to full AT mode where all AT commands work.

Releasing the switch returns pin 34 LOW.
For more on AT commands 

see Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE

Most HC-06 modules do not have the button switch (the space is empty) 

and bringing pin 34 HIGH on the HC-06 

does not do anything.

유지하기.. the 스위치를 닫힌상태로 ..는 puts한다. the modules를

into full AT mode로 where 모든 AT commands가 동작하는.

풀기.. the 스위치를 ..는 returns시킨다. pin 34를 LOW로.

For 더많은걸위해 on AT commands에 대해

보길 바란다. Arduino 와 HC-05 블루투스 모듈 -AT MODE를 (위 사이크 클릭)

대부분의 HC-06 모듈은 do not 갖고있지않다. the 버튼 스위치를 (빈자리 이다.)

and 가져온 pin 34 HIGH on the HC-06상에서 

은 아무것도 하지않는다.

STATE Pin

From the above photo you can see that the STATE pin is connected to pin 32 

and to pin 25 of the small blue tooth modules.

위 사진으로부터 넌 can 볼수있다. that the STATE 핀이 연결되있다고 to 핀 32에

and to 핀 25에 of the 작은 BlueTooth modules에.

Pin 32 is LED2 on the EGBT-045MS/HC-05.

Pin 32 is LOW when the module is not connected 

and HIGH when the module is connected.

핀 32는 LED2이다. on the HC-05상에서.

핀 32는 LOW이다. when the 모듈이 연결되있지않으면

and HIGH이다. when the 모듈이 연결되있으면.

This gives us an easy way to determine 

if the HC-05 is actually connected or not.

Connect the STATE pin to an Arduino digital pin 

and if digitalRead() returns HIGH you know the module has an active connection.

이건 준다 우리에게 an 쉬운방법을 to 결정하는데

if HC-05가 실질적으로 연결되있는지 or 아닌지.

연결해라. the STATE 핀을 to an Arduino 디지털 핀에

and if digitalRead()가 반환하면 HIGH를, 넌 알게된다. the module이 갖고있다고 실제 연결을.

You can, of course, connect an LED to the STATE pin 

as a visual indicator of a connection.

I haven’t tried this on a HC-06 yet 

but since this is not mentioned in the manual 

I believe it is not active.

넌 can, 물론, 연결할수있다. an LED를 to the STATE 핀에

as a 시각적 표시등으로써 of a 연결의.

난 시도해본적없다. 이걸 on HC-06에서 아직

but since 이게 not 언급되지않았기때문에 in the 메뉴얼에

난 믿는다. 그게 not 액티브하지않는다고.

EN Pin

Pulling the EN pin on the HC-05 LOW disables the module.

되돌리기 the EN 핀을 ........LOW로 ..는 disables시킨다. the 모듈을.

관련 게시물

Toplist

최신 우편물

태그