본문 바로가기
컴퓨터

[프로젝트] 스마트 홈프로젝트- 보일러 제어

by Luyin 2015. 5. 19.

전원제어

소리제어, 

온도제어, 습도제어


1. 준비물

Raspberry pi B+, ESP8266 ESP-12


ESP8266과 Raspberry pi연결방법.

1.  기본 지식

ESP8266은 3.3V로 연결되어야 한다.

ESP8266은 전원을 연결하면 처음에만 LED 파란불이 반짝인다.

ESP8266 ESP-12 시리즈는 초기에 Lua가 올려져 있다.

ESP8266의 초기 설정은 9600bps로 되어 있다. 맨처음 시리얼 통신을 연결하면

아래의 문구가 나온다.

 NodeMCU 0.9.5 build 20150318  powered by Lua 5.1.4

2. 선연결(Wiring)







3. 시리얼 통신 연결

   시리얼 통신 연결을 위해 기본 세팅이 필요하다. 

   시리얼 포트 로그인 비활성화:

 /etc/inittab 파일을 열어서 아래의 라인을 찾는다.

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

라인의 제일 앞에 # 문자를 추가하여 비활성화 한다.

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Disable bootup info:

This part is optional. At every boot Raspberry will send all bootup information through serial port. If you want to keep that information to be sent, just skip this step.
Remove all ttyAMA0 references from /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

After deletion, it should look like the following code:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Now we must reboot the Raspberry!

sudo shutdown -r now

시리얼 통신 툴은 다양하게 사용가능하다. 아래에는 minicom과 picocom 두 가지 방법에 대하여 설명하겠다.

1. minicom을 이용한 접속 방법

Next step is to install minicom and connect to wifi module. It will help us to communicate with the ESP8266 by offering us an interface where we can run the lua commands.

# Install minicon
sudo apt-get install minicom

# Connect to wifi module
minicom -b 9600 -o -D /dev/ttyAMA0


2. picocom 을 이용한 접속 방법

Next step is to install picocomand connect to wifi module. It will help us to communicate with the ESP8266 by offering us an interface where we can run the lua commands

# Install minicon
sudo apt-get install picocom

# Connect to wifi module
sudo picocom /dev/ttyAMA0 -omap crcrlf


Raspberry pi를 이용한 ESP8266 개발 방법

http://allan.me/2014/12/28/esp8266-raspberry-pi-development/


How to compile ESP8266 in Windows

http://signusx.com/esp8266-windows-compilation-tutorial/


ESP8266용 Raspberry pi CrossTool 체인 빌드 에러 해결책

링크페이지의 제일 하단에 글린 답글로 문제점 해결

https://github.com/pfalcon/esp-open-sdk/issues/107



PinLevelDescription
CH_PDHighEnables the chip
GPIO0LowSelects UART download boot mode
GPIO2HighSelects UART download boot mode
GPIO15LowIf availble. Selects UART download boot mode


펌웨어 다운로드 모드

nodeMCU Firmware 로 일단 한번 다운받고 나면 115200 모드에서 동작한다.




1. 보일러 룸컨트롤러 프로토콜을 해킹해야 한다.

2. ESP-12는 2mm 피치 간격이라. 2.54변환 보드가 있어야 한다.

3. Esp open sdk 를 설치하면 자동으로 컴파일러를 맞춰준다.


정보

보일러는 PLC 통신이라는 것을 한다. Power Line Communication 의 약자로 전력선 통신을 말한다.

PLC 통신에 대한 이해는 아래의 링크를 확인하면 된다.

http://tuwlab.com/ece/1960


재료

220V(AC) to 5V(DC) 레귤레이터: HLK-PM01

7805 레귤레이터


브레드 보드

인두기


Device Mart: ESP8266 모듈(Wifi 탑제모듈)

릴레이

전원모듈: HLK-PM01


스위칭 파워서플라이를 사용하는 가전제품(모니터, 프린터..)들은 초기에 전원이 투입되면 내부 콘덴서가 방전되어 있는 상태이므로 큰 돌입전류가 생기게 됩니다. 이 돌입전류로 인해서 릴레이의 접점이 융착되는 경우도 있으므로 릴레이는 본문에 소개된 것 보다 접점용량이 충분히 큰 것을 사용하시기 바랍니다. (접점용량 10A 이상인 것이나, SSR(전자식 릴레이)가 적당합니다.)


http://www.aliexpress.com/item/High-Quality-AC220V-1CH-1-Receiver-2-Remote-Controllers-RF-Wireless-Transceiver-315MHz-NG4S/2042516680.html


http://www.clien.net/cs2/bbs/board.php?bo_table=use&wr_id=709004