산업 제조
산업용 사물 인터넷 | 산업자재 | 장비 유지 보수 및 수리 | 산업 프로그래밍 |
home  MfgRobots >> 산업 제조 >  >> Manufacturing Technology >> 제조공정

Octopod:스마트 IoT 홈/산업 자동화 프로젝트

구성품 및 소모품

Arduino UNO
× 1
Arduino MKR WiFi 1010
이것 또는 다른 Wi-Fi ESP8266/ ESP32이것은 우리 나라에서는 사용할 수 없었기 때문에 NodeMCU를 사용했습니다. ESP8266
× 1
Maxim 통합 MAX32630FTHR
MAX32620FTHR, Arduino 1010 또는 ESP8266 보드 중에서 선택할 수 있습니다. 이 보드를 사용하려면 외부 WiFi가 필요합니다. Interent용 모듈 또는 Esp8266 칩
× 1
라즈베리 파이 제로 무선
일반 Raspi 2/3도 사용할 수 있습니다!
× 1
DHT11 온도 및 습도 센서(4핀)
× 1
씨드 그로브 - 가스 센서(MQ2)
× 1
SparkFun 토양 수분 센서(스크류 터미널 포함)
× 1
PIR 모션 센서(일반)
선택 사항
× 1
RFID 리더(일반)
× 1
릴레이(일반)
2채널 권장
× 1
RGB 확산 공통 음극
× 1
라즈베리 파이 카메라 모듈
× 1
서보(타워 프로 MG996R)
× 1
부저
× 2
HC-05 블루투스 모듈
선택 사항
× 1
LED(일반)
× 4
벽면 어댑터/전원 은행
× 2
메모리 카드
4Gb 이상, 가급적이면 Class 10(Raspberry Pi OS에 필요)
× 1

필요한 도구 및 기계

뜨거운 글루건(일반)
3D 프린터(일반)
선택 사항
수공구
바늘 코 플라이어, 가위, 커터 등

앱 및 온라인 서비스

블링크
OpenCV

이 프로젝트 정보

많은 IoT 자동화 프로젝트가 있지만 이만한 것이 없다는 것을 믿으십시오! Octopod는 NodeMCU를 사용하여 만듭니다. (MAX32620FTHR 또는 Arduino MKR 1010), Arduino Uno,라즈베리 파이 3 . Octopod를 사용하면 집을 똑똑하게 만들 수 있습니다. Octopod는 온도와 같은 다양한 데이터를 보냅니다. , 습도, 그리고 가스 품질 집/사무실/산업 내부. Octopod가 나에게 알림을 보냅니다. 모든 종류의 움직임을 감지할 때마다 내부에서 식물에 물을 주어야 할 때를 알려줍니다. . 기기를 제어할 수도 있습니다. 블링크를 통해 스마트폰에서 응용 프로그램. Octopod는 진정한 무드 ​​라이팅도 가능하게 합니다!

Octopod에는 작은 카메라가 장착되어 있습니다. , 라이브 피드를 보냅니다. . 이 카메라는 인공 지능도 사용합니다. 시야에 있는 사람을 감지하고 사진을 보냅니다. . 또한 RFID 기능이 있습니다. 도어 잠금 시스템 ! 대단하죠?

모든 것이 어떻게 작동합니까?

NodeMCU는 여러 센서, 릴레이 모듈 및 RGB LED에 연결됩니다. WiFi를 통해 스마트폰의 Blynk 앱에 연결되어 모든 데이터를 전송하고 집을 제어할 수 있습니다.

Raspberry Pi는 Wi-Fi에도 연결되어 있어 Pi 카메라를 통해 라이브 피드를 볼 수 있습니다. 또한 Pi에 OpenCV 라이브러리를 설치하고 눈에 보이는 사람을 감지하고 이미지를 이메일로 보내도록 Pi를 구성했습니다.

스마트 도어 유닛은 RFID 모듈을 사용합니다. 허용된 RFID가 범위 내로 들어오면 자동으로 문이 열립니다.

1단계:메인 옥토포드 코딩

거의 모든 줄에 주석을 추가했으므로 복사할 뿐만 아니라 이해합니다. 여기에서는 코드가 실행될 때 실제로 어떤 일이 발생하는지 간단히 말하겠습니다!

<울>
  • 라이브러리 포함:
  • 이 코드는 2개의 주요 라이브러리인 Blynk 라이브러리를 사용하여 코드를 Blynk 애플리케이션과 호환 가능하게 만들고 다른 라이브러리는 DHT11 온도 라이브러리로 센서의 원시 데이터를 온도 및 습도로 변환합니다. 이러한 라이브러리를 다운로드하려면 코드에서 주어진 링크로 이동하여 다운로드하십시오. 그런 다음 Arduino IDE 로 이동합니다. 스케치 → 라이브러리 포함 → .zip 라이브러리를 추가하고 다운로드한 라이브러리를 선택합니다.

    #include //Blynk 라이브러리 포함#include //Blynk 라이브러리 포함#include //DHT 센서 라이브러리 포함#define BLYNK_PRINT 시리얼 

    이것은 nodemcu를 인터넷에 연결한 다음 앱에 인증하는 데 도움이 되는 몇 가지 Blynk 코드입니다.

    // Blynk 앱에서 인증 토큰을 받아야 합니다.// 프로젝트 설정으로 이동(nut icon).char auth[] ="Your Auth Key";// WiFi 자격 증명.// 설정 열린 network.char ssid[] ="당신의 WiFi SSID";char pass[] ="당신의 WiFi 패스"; 
    <울>
  • 핀 및 정수 정의:
  • 이 부분에서는 다양한 센서의 핀을 정의합니다. 확신에 따라 변경할 수 있습니다. 또한 코드 과정에서 사용하는 경향이 있는 몇 가지 정수를 정의합니다.

    #define DHTPIN 2 // 어떤 디지털 핀 온습도 센서가 연결되어 있는지 #define 토양 핀 4 // 어떤 디지털 핀 토양 수분 센서가 연결되어 있는지 #define gasPin A0 // 어떤 아날로그 핀 가스 센서가 연결되어 있는지 to#define pirPin 12 // 어떤 디지털 핀 토양 수분 센서가 int pirValue에 연결되어 있습니까? // 읽은 값을 저장할 장소 PIR Valueint 흙값; // 읽은 토양 수분 값을 저장할 장소 int PIRpinValue; // Blynk 앱에서 보낸 값을 저장할 위치 Pin V0int SOILpinValue; // Blynk App Pin V1에서 보낸 값을 저장할 위치 
    <울>
  • BLYNK_WRITE():
  • 이 코드를 사용하여 Blynk 앱에 핀 V0 및 핀 V1을 사용하여 동작 감지 및 토양 수분 테스트가 켜져 있는지 코드를 알릴 수 있음을 알립니다.

    BLYNK_WRITE(V0) // Blynk 앱의 VO 핀은 모션 감지가 켜져 있는지 알려줍니다{ PIRpinValue =param.asInt(); } BLYNK_WRITE(V1) //Blynk 앱의 V1 핀은 토양 수분이 켜져 있는지 알려줍니다{ SOILpinValue =param.asInt(); } 
    <울>
  • 무효 sendSensor():
  • 이 코드는 DHT11에서 데이터를 가져와서 사용할 수 있게 만든 다음 각각 핀 V5와 V6으로 보냅니다.

    <사전><코드>무효 sendSensor(){ int h =dht.readHumidity(); 정수 t =dht.readTemperature(); // 또는 화씨의 경우 dht.readTemperature(true) if (isnan(h) || isnan(t)) { Serial.println("DHT 센서에서 읽지 못했습니다!"); // 센서가 거짓 값을 보내지 않는지 확인하기 위해 return; } // 언제든지 값을 보낼 수 있습니다. // 초당 10개 이상의 값을 보내지 마십시오. Blynk.virtualWrite(V5, h); // V5 핀에 습도를 보냅니다. Blynk.virtualWrite(V6, t); // 핀 V7에 온도 전송}
    <울>
  • getPirValue() 무효화 및 getSoilValue() 무효화:
  • 센서에서 디지털 값을 읽은 다음 if-else 조건을 실행하여 센서의 상태를 확인합니다. 센서가 필수 상태인 경우 Blynk 앱에서 알림을 푸시합니다.

    <사전><코드> 무효 getPirValue(무효){ pirValue =digitalRead(pirPin); if (pirValue) //PIR의 디지털 핀은 사람 감지에 높은 값을 제공합니다. { Serial.println("Motion detected"); Blynk.notify("움직임 감지"); }} 무효 getSoilValue(void){ 흙값 =digitalRead(soilPin); if (soilValue ==HIGH) //토양 센서의 디지털 핀은 습도가 낮을 ​​때 낮은 값을 제공합니다. { Serial.println("Water Plants"); Blynk.notify("수초"); }} <울>
  • 무효 설정():
  • 설정에서 한 번만 수행해야 하는 몇 가지 작업을 수행합니다. 예:고정 전송 속도로 직렬 통신을 시작하고, 이 코드를 Blynk 애플리케이션에 인증하고, Dht 센서 판독을 시작한 다음, 스마트 홈 프로젝트가 온라인 상태임을 트위터 핸들에 트윗하고, 노드에 Pir Pin 및 Soil Sensor를 알립니다. 핀은 입력 전용입니다.

    void setup(){ // 디버그 콘솔 Serial.begin(9600); Blynk.begin(인증, ssid, 통과); // 서버를 지정할 수도 있습니다. //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442); dht.begin(); // DHT 읽기 시작 Blynk.tweet("OCTOPOD IS ONLINE! "); // 프로젝트하는 Twitter 핸들에서 트위팅은 온라인 상태입니다. pinMode(pirPin,INPUT); // Pir Pin이 Input Only를 취하도록 정의하기 pinMode(soilPin,INPUT); // 토양 센서 핀이 입력 전용임을 정의합니다. // 1초마다 호출되도록 함수를 설정합니다. timer.setInterval(1000L, sendSensor);} 
    <울>
  • 무효 루프():
  • 루프에서 우리는 반복해서 수행해야 하는 일을 씁니다. 여기에서 설정 전에 작성한 코드가 실행되는지 확인합니다. 그런 다음 핀 V0 및 핀 V1의 상태를 확인하고 그에 따라 센서에서 값을 가져오는 2개의 If-Else 문을 작성합니다.

    void loop(){ Blynk.run(); 타이머.런(); if (PIRpinValue ==HIGH) // Blynk 앱의 VO 핀은 모션 감지가 켜져 있는지 알려줍니다. { getPirValue(); } if (SOILpinValue ==HIGH) //Blynk 앱의 V1 핀은 토양 수분이 켜져 있는지 알려줍니다. { getSoilValue(); } } 

    2단계:RFID Smart Lock 코딩

    솔직히 이것은 간단하고 쉬운 코드이며 많은 설명이 필요하지 않습니다. 그러나 이것이 무엇을 하는지 간단하게 말씀드리겠습니다. 코드에는 두 가지 버전이 있습니다. 하나는 도어 유닛 박스를 블루투스에 연결하여 직렬 터미널을 통해 문이 열렸을 때 알려주는 것입니다. 다른 것은 직렬로 보내므로 Arduino를 컴퓨터에 연결하면 볼 수 있습니다. 나는 블루투스 버전이 없는 단순한 것을 선호한다. 자, 시작합니다!

    <울>
  • 스케치 → 라이브러리 포함 → 라이브러리 관리 → 검색창에 MFRC522를 입력하고 라이브러리를 설치합니다. 그런 다음 파일 → 예제 → 사용자 정의 라이브러리 → MFRC522 → dumpInfo Sketch로 이동합니다. 처음에는 핀을 연결하는 방법을 읽을 수 있습니다(또는 그림 참조). 그런 다음 코드를 실행하고 직렬 모니터를 열고 MFRC522 모듈 앞에 Rfid 카드를 가져오고 5초 동안 기다립니다. 그런 다음 비슷한 방식으로 카드 UID를 기록하고 다른 카드와 키 체인의 UID를 기록합니다.
  • <울>
  • 그런 다음 원하는 코드를 다운로드하십시오. 코드를 열고 이 줄로 이동합니다. 여기에 이 ​​X 대신 문을 여는 데 사용할 카드의 UID를 추가하십시오. 이제 준비가 되었습니다. 코드를 업로드하기만 하면 됩니다.
  • if (content.substring(1) =="XX XX XX XX") {} 

    이 코드에는 코드의 If-Else 부분에서 수행하는 두 가지 주요 작업이 있습니다. arduino에 카드의 UID가 언급된 UID와 일치하면 서보를 움직이게 하고(문이 열리도록) LED를 깜박이고 부저를 사용하여 소리를 내라고 말하면 됩니다. 그렇지 않으면 UID가 깜박이지 않고 일부 LED가 깜박이고 Buzzer를 사용하여 소리가납니다.

    3단계:Raspberry Pi 인간 감지 AI 설정

    이 안내 단계에서는 스마트 보안 카메라를 만드는 방법을 배울 것입니다. 카메라는 물체를 감지할 때마다 이메일을 보내드립니다. 동일한 WiFi 네트워크에 있는 경우 라즈베리 파이의 IP 주소를 입력하여 카메라로 실시간 영상에 액세스할 수 있습니다. 스마트 카메라를 처음부터 만드는 방법을 알려 드리겠습니다. 가자!

    요구사항:

    1. OpenCV(오픈 소스 컴퓨터 비전 라이브러리)

    2. 라즈베리 파이 3B

    3. 라즈베리 파이 카메라 V2

    가정:

    1. Raspbian Stretch가 설치된 Raspberry Pi 3. Raspbian Stretch OS가 아직 없는 경우 Raspbian Stretch의 새로운 기능을 활용하려면 OS를 업그레이드해야 합니다.

    Raspberry Pi 3를 Raspbian Stretch로 업그레이드하려면 여기에서 다운로드하고 이 업그레이드 지침(또는 초보자에게 권장되는 NOOBS 경로에 대한 지침)을 따르십시오.

    참고:Raspberry Pi 3를 Raspbian Jessie에서 Raspbian Stretch로 업그레이드하는 경우 문제가 발생할 수 있습니다. 스스로 위험을 감수하고 Raspberry Pi 포럼에 도움을 요청하십시오. 중요:Raspbian Stretch를 새로 설치하는 것이 좋습니다! Raspbian Jessie에서 업그레이드하는 것은 권장하지 않습니다.

    2. 터미널을 열고 SSH 또는 VNC를 통한 원격 액세스 명령을 실행할 수 있도록 Raspberry Pi 3에 대한 물리적 액세스. 이 튜토리얼의 대부분을 SSH를 통해 수행할 것이지만 터미널에 액세스할 수만 있다면 쉽게 따라할 수 있습니다.

    <울>
  • 1단계:RASPBERRY PI 3에 카메라 부착
  • 1. Raspberry Pi 카메라 모듈을 엽니다. 정전기로 인해 카메라가 손상될 수 있으므로 주의하십시오. 회색 정전기 방지 백에서 카메라를 꺼내기 전에 접지된 물체(예:라디에이터 또는 PC 섀시)를 만져 방전되었는지 확인하십시오.

    2. Raspberry Pi에 케이블을 삽입하여 Raspberry Pi 카메라 모듈을 설치합니다. 은색 커넥터가 HDMI 포트를 향하도록 하여 이더넷과 HDMI 포트 사이에 있는 커넥터에 케이블 슬롯을 넣습니다.

    3. Raspberry Pi를 부팅합니다.

    4. 프롬프트에서 "sudo raspi-config"를 실행합니다. "카메라" 옵션이 나열되지 않으면 몇 가지 명령을 실행하여 Raspberry Pi를 업데이트해야 합니다. "sudo apt-get update" 및 "sudo apt-get upgrade" 실행

    5. "sudo raspi-config"를 다시 실행하십시오. 이제 "카메라" 옵션이 표시되어야 합니다.

    명령-

    $ sudo raspi-config 

    6. "카메라" 옵션으로 이동하여 활성화합니다(인터페이싱 옵션에서 감시). "마침"을 선택하고 Raspberry Pi를 재부팅하거나 다음을 입력하십시오.

    $ sudo 재부팅 
    <울>
  • 2단계:CV 설치 열기
  • OpenCV를 처음 설치하거나 Rasbian Stretch를 막 시작하는 경우. 이것은 당신을 위한 완벽한 튜토리얼입니다.

    1단계:파일 시스템 확장

    Raspbian Stretch를 새로 설치하고 있습니까? 그렇다면 가장 먼저 해야 할 일은 파일 시스템을 확장하여 마이크로 SD 카드에서 사용 가능한 모든 공간을 포함하도록 하는 것입니다.

    명령-

    $ sudo raspi-config 

    그런 다음 "고급 옵션" 메뉴 항목을 선택하고 "파일 시스템 확장"을 선택합니다. 메시지가 표시되면 첫 번째 옵션인 "A1. 확장 파일 시스템", 키보드에서 Enter 키를 누르고 "" 버튼까지 화살표를 누른 다음 Pi를 재부팅하십시오. 8GB 카드를 사용하는 경우 사용 가능한 공간의 거의 50%를 사용할 수 있으므로 한 가지 간단한 작업은 LibreOffice와 Wolfram 엔진을 모두 삭제하여 PI의 공간을 확보하는 것입니다.

    명령-

    $ sudo apt-get 퍼지 wolfram-engine $ sudo apt-get 퍼지 libreoffice* $ sudo apt-get clean$ sudo apt-get 자동 제거 

    Wolfram 엔진과 LibreOffice를 제거하면 거의 1GB를 회수할 수 있습니다!

    2단계: 종속성 설치

    Raspberry Pi에 OpenCV를 설치하는 방법에 대해 논의한 것은 이번이 처음이 아니므로 설치 프로세스를 통해 작업할 수 있도록 이 지침을 간략하게 유지하겠습니다. 각 명령을 실행하는 데(일부는 인터넷 속도에 따라 다름) 그에 따라 OpenCV + Raspberry Pi 3 설치를 계획할 수 있습니다(OpenCV 자체는 컴파일하는 데 약 4시간이 걸립니다. 나중에 자세히 설명). 첫 번째 단계는 기존 패키지를 업데이트하고 업그레이드하는 것입니다.

    명령-

    $ sudo apt-get 업데이트 &&sudo apt-get 업그레이드  

    그런 다음 OpenCV 빌드 프로세스를 구성하는 데 도움이 되는 CMake를 비롯한 일부 개발자 도구를 설치해야 합니다. Raspbian Stretch:Raspberry Pi에 OpenCV 3 + Python 설치

    명령-

    $ sudo apt-get install build-essential cmake pkg-config 

    다음으로 디스크에서 다양한 이미지 파일 형식을 로드할 수 있는 이미지 I/O 패키지를 설치해야 합니다. 이러한 파일 형식의 예로는 JPEG, PNG, TIFF 등이 있습니다. Raspbian Stretch

    명령-

    $ sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev 

    이미지 I/O 패키지가 필요한 것처럼 비디오 I/O 패키지도 필요합니다. 이 라이브러리를 사용하면 디스크에서 다양한 비디오 파일 형식을 읽고 비디오 스트림으로 직접 작업할 수 있습니다.

    명령-

    $ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev $ sudo apt-get install libxvidcore-dev libx264-dev 

    OpenCV 라이브러리에는 이미지를 화면에 표시하고 기본 GUI를 빌드하는 데 사용되는 highgui라는 하위 모듈이 함께 제공됩니다. highgui 모듈을 컴파일하려면 GTK 개발 라이브러리를 설치해야 합니다. Raspbian Stretch:Raspberry Pi에 OpenCV 3 + Python 설치

    명령-

    $ sudo apt-get install libgtk2.0-dev libgtk-3-dev 

    OpenCV 내부의 많은 작업(즉, 행렬 작업)은 몇 가지 추가 종속성을 설치하여 추가로 최적화할 수 있습니다.

    명령-

    $ sudo apt-get install libatlas-base-dev gfortran 

    이러한 최적화 라이브러리는 Raspberry Pi와 같이 리소스가 제한된 장치에 특히 중요합니다. 마지막으로 Python 바인딩으로 OpenCV를 컴파일할 수 있도록 Python 2.7 및 Python 3 헤더 파일을 모두 설치해 보겠습니다. Raspbian Stretch

    명령-

    $ sudo apt-get install python2.7-dev python3-dev  

    OS를 새로 설치하는 경우 이러한 버전의 Python이 이미 최신 버전일 수 있습니다(이를 나타내는 터미널 메시지가 표시됨). 이 단계를 건너뛰면 OpenCV를 컴파일하기 위해 make를 실행할 때 Python.h 헤더 파일을 찾을 수 없다는 오류를 확인할 수 있습니다. 3단계:OpenCV 소스 코드 다운로드

    3단계:OpenCV 다운로드 소스 코드

    이제 종속성을 설치했으므로 공식 OpenCV 저장소에서 OpenCV의 3.3.0 아카이브를 가져옵니다. 이 버전에는 OpenCV로 딥 러닝을 수행한 이전 게시물에서 논의한 dnn 모듈이 포함되어 있습니다(참고:openCV의 향후 버전이 출시되면 3.3.0을 최신 버전 번호로 교체할 수 있습니다):

    명령-

    $ cd ~ $ wget -O opencv.zip   https://github.com/Itseez/opencv/archive/3.3.0.zi...>> p$ opencv.zip 압축 풀기

    OpenCV 3의 전체 설치(예:SIFT 및 SURF와 같은 기능에 액세스하기 위해)가 필요하므로 opencv_contrib 저장소도 가져와야 합니다. Raspbian Stretch:Raspberry Pi에 OpenCV 3 + Python 설치

    명령-

    $ wget -O opencv_contrib.zip   https://github.com/Itseez/opencv_contrib/archive/...>>3.3.0$ opencv_contrib.zip 압축 풀기 

    복사하여 붙여넣는 동안 "<=>" 버튼을 사용하여 위의 명령을 확장해야 할 수도 있습니다. 일부 브라우저에서는 3.3.0.zip의 .zip이 잘린 것처럼 보일 수 있습니다. OpenCV 3.3.0 아카이브의 전체 URL은 다음과 같습니다. https://github.com/Itseez/opencv_contrib/archive/... 참고:opencv 및 opencv_contrib 버전이 동일한지 확인하십시오(이 경우 3.3.0). . 버전 번호가 일치하지 않으면 컴파일 타임 또는 런타임 오류가 발생할 수 있습니다. 4단계:Python 2.7 또는 Python 3? Raspberry Pi 3에서 OpenCV 컴파일을 시작하기 전에 먼저 Python 패키지 관리자인 pip를 설치해야 합니다.

    명령-

    $ wget    https://bootstrap.pypa.io/get-pip.py> 
    >>
    >$ sudo 파이썬 get-pip.py $ sudo 파이썬3 get-pip.py 

    이러한 명령을 실행할 때 pip가 이미 최신 상태라는 메시지를 받을 수 있지만 이 단계를 건너뛰지 않는 것이 가장 좋습니다. PyImageSearch의 오랜 독자라면 제가 virtualenv와 virtualenvwrapper 모두의 열렬한 팬이라는 것을 알게 될 것입니다.

    이러한 패키지를 설치하는 것은 요구 사항이 아니며 패키지 없이도 OpenCV를 설치할 수 있지만 다른 기존 PyImageSearch 자습서(및 향후 자습서)에서도 Python 가상 환경을 활용하므로 설치하는 것이 좋습니다.

    또한 이 가이드의 나머지 부분에서 virtualenv와 virtualenvwrapper가 모두 설치되어 있다고 가정합니다. 그렇다면 virtualenv 및 virtualenvwrapper를 사용하는 요점은 무엇입니까? 첫째, 가상 환경은 각각에 대해 격리되고 독립적인 Python 환경을 만들어 서로 다른 프로젝트에 필요한 종속성을 별도의 위치에 유지하는 데 사용되는 특수 도구라는 것을 이해하는 것이 중요합니다. 간단히 말해서 "프로젝트 X는 버전 1.x에 의존하지만 프로젝트 Y는 4.x가 필요하다"는 딜레마를 해결합니다.

    또한 글로벌 사이트 패키지를 깔끔하고 단정하며 어수선하지 않게 유지합니다. Python 가상 환경이 좋은 방법인 이유에 대한 자세한 설명을 보려면 RealPython에 대한 이 훌륭한 블로그 게시물을 읽어보세요. 일종의 가상 환경을 사용하는 것이 Python 커뮤니티의 표준 관행이므로 동일한 작업을 수행하는 것이 좋습니다.

    명령-

    $ sudo pip install virtualenv virtualenvwrapper$ sudo rm -rf ~/.cache/pip  

    이제 virtualenv와 virtualenvwrapper가 모두 설치되었으므로 ~/.profile 파일을 업데이트해야 합니다. 파일 맨 아래에 다음 행을 포함하십시오:Raspbian Stretch

    명령-

    $ 나노 ~/.profile 

    파일 하단에 다음 줄을 복사하여 붙여넣습니다.

    명령-

    # virtualenv 및 virtualenvwrapperWORKON_HOME=$HOME/.virtualenvs 소스 /usr/local/bin/virtualenvwrapper.sh  

    또는

    ~/.profile 업데이트를 처리하려면 단순히 cat 및 출력 리디렉션을 사용해야 합니다.

    명령-

    $ echo -e "\n# virtualenv 및 virtualenvwrapper">> ~/.profile $ echo "exportWORKON_HOME=$HOME/.virtualenvs">> ~/.profile$ echo "소스 /usr/local/ bin/virtualenvwrapper.sh">> ~/.profile  

    이제 ~/.profile이 업데이트되었으므로 변경 사항이 적용되도록 다시 로드해야 합니다. 다음을 수행하여 ~/.profile 파일을 강제로 다시 로드할 수 있습니다. 로그아웃했다가 다시 로그인합니다.

    터미널 인스턴스를 닫고 새 인스턴스 열기

    또는 내가 개인적으로 좋아하는 것

    명령-

    $ 소스 ~/.profile  

    참고 :시스템 변수가 올바르게 설정되었는지 확인하기 위해 새 터미널을 열 때마다 소스 ~/.profile 파일을 실행하는 것이 좋습니다. Python 가상 환경 만들기 다음으로 컴퓨터 비전 개발에 사용할 Python 가상 환경을 만들어 보겠습니다.

    명령-

    $ mkvirtualenv cv -p python2  

    이 명령은 Python 2.7을 사용하여 cv라는 새 Python 가상 환경을 만듭니다.

    대신 Python 3을 사용하려면 다음 명령을 대신 사용하는 것이 좋습니다.

    명령-

    $ mkvirtualenv cv -p python3 

    다시 말하지만, 이 점을 충분히 강조할 수 없습니다. cv Python 가상 환경은 완전히 독립적이며 Raspbian Stretch 다운로드에 포함된 기본 Python 버전과 격리되어 있습니다.

    전역 site-packages 디렉토리의 모든 Python 패키지는 cv 가상 환경에서 사용할 수 없습니다. 마찬가지로, cv의 site-packages에 설치된 Python 패키지는 Python의 전역 설치에서 사용할 수 없습니다.

    Python 가상 환경에서 작업할 때 이것을 염두에 두십시오. 그러면 많은 혼란과 골칫거리를 피하는 데 도움이 될 것입니다. "cv" 가상 환경에 있는지 확인하는 방법 Raspberry Pi를 재부팅한 경우 로그아웃했다가 다시 로그인하십시오. 또는 새 터미널을 열려면 workon 명령을 사용하여 cv 가상 환경에 다시 액세스해야 합니다.

    이전 블로그 게시물에서 독자들이 mkvirtualenv 명령을 사용하는 것을 보았지만 이것은 전혀 필요하지 않습니다! mkvirtualenv 명령은 실제로 가상 환경을 생성하기 위해 한 번만 실행되도록 되어 있습니다. 그런 다음 workon을 사용할 수 있으며 가상 환경으로 드롭다운됩니다.

    명령-

    $ 소스 ~/.profile $ workon cv 

    To validate and ensure you are in the cv virtual environment, examine your command line — if you see the text (cv) preceding your prompt, then you are in the cv virtual environment:Make sure you see the “(cv)” text on your prompt, indicating that you are in the cv virtual environment.

    Otherwise, if you do not see the (cv) text, then you are not in the cv virtual environment:

    If you do not see the “(cv)” text on your prompt, then you are not in the cv virtual environment and need to run “source” and “workon” to resolve this issue. To fix this, simply execute the source and workon commands mentioned above. Installing NumPy on your Raspberry Pi Assuming you’ve made it this far, you should now be in the cv virtual environment (which you should stay in for the rest of this tutorial).

    Step #4 :Installing NumPy on your Raspberry Pi

    Our only Python dependency is NumPy, a Python package used for numerical processing:

    COMMAND-

    $ pip install numpy  

    the NumPy installation can take a bit of time.

    Step #5:Compile and Install OpenCV

    COMMAND-

    $ workon cv 

    Once you have ensured you are in the cv virtual environment, we can setup our build using CMake:

    COMMAND-

    $ cd ~/opencv-3.3.0/ $ mkdir build $ cd build $ cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \ -D BUILD_EXAMPLES=ON .. 

    Now, before we move on to the actual compilation step, make sure you examine the output of CMake! Start by scrolling down the section titled Python 2 and Python 3 . If you are compiling OpenCV 3 for Python 2.7, then make sure your Python 2 section includes valid paths to the Interpreter, Libraries, numpy and packages

    Checking that Python 3 will be used when compiling OpenCV 3 for Raspbian Stretch on the Raspberry Pi 3. Notice how the Interpreter points to our python2.7 binary located in the cv virtual environment. The numpy variable also points to the NumPy installation in the cv environment.

    Again, the Interpreter points to our python3.5 binary located in the cv virtual environment while numpy points to our NumPy install.

    In either case, if you do not see the cv virtual environment in these variables paths, it’s almost certainly because you are NOT in the cv virtual environment prior to running CMake! If this is the case, access the cv virtual environment using workon cv and re-run the cmake command outlined above.

    Configure your swap space size before compiling Before you start the compile process, you should increase your swap space size. This enables OpenCV to compile with all four cores of the Raspberry PI without the compile hanging due to memory problems.

    Open your /etc/dphys-swapfile and then edit the CONF_SWAPSIZE variable

    COMMAND-

    $ nano /etc/dphys-swapfile  

    and then edit the following section of the file:#set size to absolute value, leaving empty (default) then uses computed value # you most likely don't want this, unless you have an special disk situation

    # CONF_SWAPSIZE=100 CONF_SWAPSIZE =1024 

    Notice that I’ve commented out the 100MB line and added a 1024MB line. This is the secret to getting compiling with multiple cores on the Raspbian Stretch. If you skip this step, OpenCV might not compile.

    To activate the new swap space, restart the swap service:

    COMMAND-

    $ sudo /etc/init.d/dphys-swapfile stop $ sudo /etc/init.d/dphys-swapfile start  

    Note:It is possible to burn out the Raspberry Pi microSD card because flash memory has a limited number of writes until the card won’t work. It is highly recommended that you change this setting back to the default when you are done compiling and testing the install (see below). To read more about swap sizes corrupting memory, see this page. Finally, we are now ready to compile OpenCV:

    COMMAND-

    $ make -j4 

    The -j4 switch stands for the number of cores to use when compiling OpenCV. Since we are using a Raspberry Pi 2, we’ll leverage all four cores of the processor for a faster compilation.

    However, if your make command errors out, I would suggest starting the compilation over again and only using one core

    $ make clean$ make  

    Once OpenCV 3 has finished compiling.Our OpenCV 3 compile on Raspbian Stretch has completed successfully.

    From there, all you need to do is install OpenCV 3 on your Raspberry Pi 3:

    COMMAND-

    $ sudo make install$ sudo ldconfig  

    Step #6 :Finish installing OpenCV on your Pi

    We’re almost done — just a few more steps to go and you’ll be ready to use your Raspberry Pi 3 with OpenCV 3 on Raspbian Stretch.

    For Python 2.7:

    #5 Provided your Step without error, OpenCV should now be installed in/usr/local/lib/python2.7/site-pacakges . You can verify this using the ls command:

    COMMAND-

    $ ls -l /usr/local/lib/python2.7/site-packages/ total 1852 -rw-r--r-- 1 root staff 1895772 Mar 20 20:00 cv2.so  

    Note:In some cases, OpenCV can be installed in /usr/local/lib/python2.7/dist-packages(note the dist-packages rather than site-packages ). If you do not find the cv2.so bindings insite-packages , we be sure to check dist-packages . Our final step is to sym-link the OpenCV bindings into our cv virtual environment for Python 2.7:

    COMMAND-

    $ cd ~/.virtualenvs/cv/lib/python2.7/site-packages/ $ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so  

    For Python 3:After running make install , your OpenCV + Python bindings should be installed in/usr/local/lib/python3.5/site-packages . Again, you can verify this with the ls command:

    COMMAND-

    $ ls -l /usr/local/lib/python3.5/site-packages/ total 1852 -rw-r--r-- 1 root staff 1895932 Mar 20 21:51 cv2.cpython-34m.so  

    I honestly don’t know why, perhaps it’s a bug in the CMake script, but when compiling OpenCV 3 bindings for Python 3+, the output .so file is named cv2.cpython-35m-arm-linux-gnueabihf.so(or some variant of) rather than simply cv2.so (like in the Python 2.7 bindings). Again, I’m not sure exactly why this happens, but it’s an easy fix. All we need to do is rename the file:

    COMMAND-

    $ cd /usr/local/lib/python3.5/site-packages/ $ sudo mv cv2.cpython-35m-arm-linux-gnueabihf.so cv2.so  

    After renaming to cv2.so , we can sym-link our OpenCV bindings into the cv virtual environment

    for Python 3.5:

    COMMAND-

    $ cd ~/.virtualenvs/cv/lib/python3.5/site-packages/ $ ln -s /usr/local/lib/python3.5/site-packages/cv2.so cv2.so  

    Step #7:Testing your OpenCV 3 install

    Congratulations, you now have OpenCV 3 installed on your Raspberry Pi 3 running Raspbian Stretch! But before we pop the champagne and get drunk on our victory, let’s first verify that your OpenCV installation is working properly.

    Open up a new terminal, execute the source and workon commands, and then finally attempt to import the Python + OpenCV bindings:

    COMMAND-

    $ source ~/.profile$ workon cv $ python>>> import cv2>>> cv2.__version__ '3.3.0'>>>  

    OpenCV 3 has been successfully installed on my Raspberry Pi 3 + Python 3.5 environment . Once OpenCV has been installed, you can remove both the opencv-3.3.0 and opencv_contrib-3.3.0 directories to free up a bunch of space on your disk:

    COMMAND-

    $ rm -rf opencv-3.3.0 opencv_contrib-3.3.0  

    However, be cautious with this command! Make sure OpenCV has been properly installed on your system before blowing away these directories. A mistake here could cost you hours in compile time.

    Open your /etc/dphys-swapfile and then edit the CONF_SWAPSIZE variable COMMAND-

    # set size to absolute value, leaving empty (default) then uses computed value# you most likely don't want this, unless you have an special disk situation CONF_SWAPSIZE=100 #CONF_SWAPSIZE=1024 

    Notice that I’ve commented out the 1024MB line and uncommented the 100MB line. As stated above, larger swap spaces may lead to memory corruption, so I recommend setting it back to 100MB. If you skip this step, your memory card won’t last as long. To revert to the smaller swap space, restart the swap service

    COMMAND-

    $ sudo /etc/init.d/dphys-swapfile stop
    $ sudo /etc/init.d/dphys-swapfile start
    <울>
  • STEP 4:Setting Up Python Program
  • You can verify that the camera works by running.

    COMMAND-

    $ raspistill -o image.jpg 

    which will save a image from the camera in your current directory.

    After you checked the camera is working. Now download all the python files and models from below link :

    LINK:

    https://drive.google.com/file/d/0B98uoD6BbkpqZU9FT...

    You can open up the file inspector and view the image.

    Make sure you are using the virtual environment by typing the following commands:

    COMMANDS-

    $ source ~/.profile $ workon cv  

    Next, navigate to the repository directory,

    COMMANDS-

    $ cd Smart-Security-Camera  

    and install the dependencies for the project

    COMMANDS-

    $ pip install -r requirements.txt  

    To get emails when objects are detected, you'll need to make a couple modifications to the mail.py file. Open mail.py with vim vim mail.py , then press i to edit. Scroll down to the following section

    # Email you want to send the update from (only works with gmail)fromEmail ='[email protected]' fromEmailPassword ='password1234' # Email you want to send the update to toEmail ='[email protected]'  

    and replace with your own email/credentials.

    The mail.py file logs into a gmail SMTP server and sends an email with an image of the object detected by the security camera. Press esc then ZZ to save and exit.

    You can also modify the main.py file to change some other properties.

    email_update_interval =600 # sends an email only once in this time intervalvideo_camera =VideoCamera(flip=True) # creates a camera object, flip verticallyobject_classifier =cv2.CascadeClassifier("models/fullbody_recognition_model.xml") # an opencv classifier facial_recognition_model.xml fullbody_recognition_model.xml upperbody_recognition_model.xml 

    Run the program python main.py

    You can view a live stream by visiting the IP address of your pi in a browser on the same network. You can find the IP address of your Raspberry Pi by typing ifconfig in the terminal and looking for the inet address. Visit :5000 in your browser to view the stream.

    참고:

    To view the live stream on a different network than your Raspberry Pi, you can use ngrok to expose a local tunnel. Once downloaded, run ngrok with ./ngrok http 5000 and visit one of the generated links in your browser. Note:The video stream will not start automatically on startup. To start the video stream automatically, you will need to run the program from your /etc/rc.local file see this video for more information about how to configure that. Receiving Emails When receiving an email for the first time, you might get the following notification from Google:

    By default, Google blocks apps from using SMTP without permissions. We can solve this by clicking on the allow "less secure apps" link and toggle the feature on. The next object detected will send an email.

    STEP 4:Blynk App Interface Setup

    This is one of the easiest and fun steps. So let's get started. Shall we?

    <울>
  • Downloading the Blynk App is the first obvious step. Download it from App Store or Google Play Store. Sign Up or Login in the app to get started.
  • <울>
  • Click on New Project to create a new project. Name it whatever you like. In devices Choose NodeMCU. In connection type choose WiFi and click on Create.
  • <울>
  • Now you will get a Auth key on your Email. Make sure to copy that and add that to your code.
  • <울>
  • Now click on the + sign to add widgets. You may need to buy some energy!
  • <울>
  • Now add three Gauge's. Click on of the Gauge's, name it Temperature. Choose a color of you choice for this gauge. In the pin choose Virtual Pin V6. Set the range from 0 to 50 °C ( not sure for °F), make the label °C/ °F and keep the reading rate to Push.
  • <울>
  • Repeat this for other two Gauges using data as shown in the pictures.
  • <울>
  • Now, add a zeRGBa and set R to digital Pin GP15, B to GP3 and B to GP1.
  • <울>
  • Now add 4 Buttons, change there colors accordingly. Set them as shown in the pictures.
  • <울>
  • Add a SuperChart, add 3 data streams Temperature, Humidity and gas, set there colors, there pins, Range and Suffix.
  • <울>
  • Now, add tabs. Go to the second tab and add Twitter, Notifications, Email and Eventor. In Twitter add you twitter username and password. In Notifications, Switch on Notify when hardware goes off. In Email, set your Email address. In Eventor you can set many triggers, see the picture for the triggers that I have set up.
  • <울>
  • You are done. now click on the play button to use the interface that you have created. You can change the interface as you like. It is really simple and fun process!
  • STEP 5:Making Octopod Structure

    Warning - This is going to be one of most time-consuming process!

    NOTE:You can skip this step and 3D print the enclosure that I have provided!

    Actually, this step is optional yet the most important step! You can just take a shoe box and avoid all of this hard work. But on the contrary, this hard work makes the project unique. The idea for this unique design striked me while, I was doing my math homework. This shape is inspired from an octagon. Rather, This is a 3D octagon! So let's get started!

    Making the Structure:

    <울>
  • Take your cardboard and draw a rectangle of 9 cm x 9.5 cm (You can change the dimensions as per your convince). Now, joining end to end draw 4 of theses similar rectangles (8 if your cardboard is long enough).
  • <울>
  • Now make partial cuts (somewhat like paper creases) in between these rectangles and cut out this whole long piece. Repeat this process until you have 4 of these long pieces.
  • <울>
  • Now, using a D draw a 135° and cut it out as shown in the images. Make 16 of these same angles.
  • <울>
  • Using Glue gun glue these angles in between the small pieces. Repeat this for all the joints.
  • <울>
  • Now using glue gun join 2 of these open structures to make a closed structure (somewhat octagon) .
  • <울>
  • Now glue the other two open structure perpendicularly, making a 3-D shape.
  • <울>
  • Now Cut 4 More pieces of of 9 x 9.5 cm and glue them in between all the empty spaces.
  • <울>
  • Now you will be left with only 8 open triangles. Using Acrylic Butter paper cut 8 triangles, which will fit on these open areas, but don't glue them now.
  • Paint Job:

    For this you need to head out towards an open area! Wear your Mask and Gloves and just make one coat over the structure that you have created. You can go to Youtube, to learn proper ways to make a perfect coat. Now let this dry for 4- 5 Hours and then apply 1 more coat. I think 3 coats will be good for this.

    That's it! You have arrived with a unique piece of art.

    STEP 6:Making Door Lock Enclosure

    Really simple. Just take a Shoe Box and apply 2- 3 even coats of spray. And maybe for design make check pattern using duck tape like we did!

    STEP 7:Assembling the Octopod

    I have tried to make this step as simple as possible, by making the schematic diagram. Refer the picture or the file, and make connections accordingly. I will briefly explain all the connections!

    <울>
  • We have connected the nodeMCU to a large size Solderless Breadboard. We have also connected Breadboard power supply on the breadboard. NodeMCU, all the sensors, LED's and other components are powered by the power supply.
  • <울>
  • Following are the sensor connections:DHT11D4 / GP2 MQ2A0 / adc00 Soil Moisture SensorD2 / GP4 PIRD6 / GP1 RGB R → D8 / GP15, G → Rx / GP3, B → Tx / GP1 RelayLn1D0 / GP16, Ln2D5 / GP14 Make the following connections.
  • <울>
  • For powering this you can use Power Bank or a Wall Adapter, which will be connected to the breadboard Power supply.
  • <울>
  • Now, take your Raspberry Pi along with the Raspberry Pi Camera. Make a small hole in one of the walls of the cardboard and glue or tape your Raspberry Camera.
  • Now, insert all these electronics inside, through any open triangle and close the triangle by using the cut outs of acrylic butter paper that we made. It is better to leave 1 or 2 open, in case something inside needs to be fixed! Also let the prongs of the Soil Moisture Sensor sit outside.

    All done! We have completed the making process of the Octopod! Now, Just switch On the power and keep your Octopod over the dining Table or maybe on the Guest's Table and enjoy! To see the live feed from the Raspberry Pi, just open a browser and put in the IP address of the Pi. Enjoy!

    STEP 8:Assembling the Door Lock

    After uploading the code on your Arduino just make the connections as shown in the picture or in fritzing file! It is quite simple. Then take the handy shoe box that we made make 2 holes in it for the LED's to pop out. and allow the servo to stand out. These days mechanical locks like servo's are also available in the market, though servo works just as fine. This is just an experiment, so please so please don't use this as you actual lock! Glue the Rfid to one wall of the box and also glue the small breadboard and Arduino. You can use a wall adapter or a Power bank to power this. Just power the Arduino and you will be good to go! Done!

    CONCLUSION:

    This was a really fun project to do!

    I was really happy how it turned out. I think the lights look really well, and i think its well worth making even one of these as a side lamp. I really can't thank creators of Blynk and OpenCV libraries enough, they are both really excellent pieces of software and made this project possible! As always, if you have any questions on any part of the process please let me know and I will be happy to try help. Thanks a lot! And Please Vote for Us!

    -Saksham

    Arduino Blog

    Full Instructable

    UPDATE:

    I have been working on integrating this system with Amazon Alexa, I am almost done. Will upload the code in 2-3 days!

    <섹션 클래스="섹션 컨테이너 섹션 축소 가능" id="코드">

    코드

    <울>
  • octopod.ino
  • octopod_door.ino
  • octopod_door_bluetooth.ino
  • octopod.inoArduino
    This is the main code for Arduino MKR 1010 (NodeMCU in my case)
    If you are using MAX32620FTHR, download libraries for it. Then change the board in board settings. Also change the pin as given bellow
    ESP MAX
    AO - - - - - - - - - - - - GPIO2
    A1 - - - - - - - - - - - - - GPIO1

    Soil Sensor MAX
    analog sensor - - - GPIO3

    Gas Sensor (MQ2) MAX
    sensor - - - - - - - - - - - GPIO4

    PIR Sensor MAX
    sensor - - - - - - - - - - - -GPIO0

    Relay MAX
    1 - - - - - - - - - - - - - - - - - M0
    2 - - - - - - - - - - - - - - - - - M1
    /*************************************************************************** OCTOPOD:A SMART HOME AUTOMATION PROJECT MADE BY SAKSHAM Download latest Blynk library here:https://github.com/blynkkk/blynk-library/releases/latestDownload latest DHT Sensor library here:https://github.com/adafruit/DHT-sensor-library***************************************************************************/#include  //Include ESP8266 Wifi Library#include  //Include Blynk Library#include  //Include DHT sensor library#define BLYNK_PRINT Serial// You should get Auth Token in the Blynk App.// Go to the Project Settings (nut icon).char auth[] ="Your Blynk Auth Key";// Your WiFi credentials.// Set password to "" for open networks.char ssid[] ="Your WiFi SSID";char pass[] ="Your WiFi Password";#define DHTPIN 2 // What digital pin temperature and humidity sensor is connected to#define soilPin 4 // What digital pin soil moist ure sensor is connected to#define gasPin A0 // What analog pin gas sensor is connected to#define pirPin 12 // What digital pin soil moisture sensor is connected to int pirValue; // Place to store read PIR Valueint soilValue; // Place to store read Soil Moisture Valueint PIRpinValue; // Place to store the value sent by Blynk App Pin V0int SOILpinValue; // Place to store the value sent by Blynk App Pin V1// Uncomment whatever type you're using!#define DHTTYPE DHT11 // DHT 11//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321//#define DHTTYPE DHT21 // DHT 21, AM2301DHT dht(DHTPIN, DHTTYPE);BlynkTimer timer;// This function sends Arduino's up time every second to Virtual Pin (5).// In the app, Widget's reading frequency should be set to PUSH. This means// that you define how often to send data to Blynk App.BLYNK_WRITE(V0) //VO pin from Blynk app tells if Motion Detection is ON{ PIRpinValue =param.asInt(); } BLYNK_WRITE(V1) //V1 pin from Blynk app tells if Soil Moisture is ON{ SOILpinValue =param.asInt(); } void sendSensor(){ int h =dht.readHumidity(); int t =dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit if (isnan(h) || isnan(t)) { Serial.println("Failed to read from DHT sensor!"); // to check if sensor is not sending any false values return; } // You can send any value at any time. // Please don't send more that 10 values per second. Blynk.virtualWrite(V5, h); // send humidity to pin V5 Blynk.virtualWrite(V6, t); // send temperature to pin V7}void getPirValue(void){ pirValue =digitalRead(pirPin); if (pirValue) //digital pin of PIR gives high value on human detection { Serial.println("Motion detected"); Blynk.notify("Motion detected"); }}void getSoilValue(void){ soilValue =digitalRead(soilPin); if (soilValue ==HIGH) //digital pin of soil sensor give low value when humidity is less { Serial.println("Water Plants"); Blynk.notify("Water Plants"); }}void setup(){ // Debug console Serial.begin(9600); Blynk.begin(auth, ssid, pass); // You can also specify server://Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442); dht.begin(); // Begins DHT reading Blynk.tweet("OCTOPOD IS ONLINE! "); // Tweating on your Twitter Handle that you project is online pinMode(pirPin,INPUT); // Defining that Pir Pin is meant to take Input Only pinMode(soilPin,INPUT); // Defining that Soil Sensor Pin is meant to take Input Only // Setup a function to be called every second timer.setInterval(1000L, sendSensor);}void loop(){ Blynk.run(); timer.run(); if (PIRpinValue ==HIGH) //VO pin from Blynk app tells if Motion Detection is ON { getPirValue(); } if (SOILpinValue ==HIGH) //V1 pin from Blynk app tells if Soil Moisture is ON { getSoilValue(); } }
    octopod_door.inoArduino
    Code for Automatic Door Lock Control (NO BLUETOOTH VERSION)
    /*********************************************************************************************************** OCTOPOD:A SMART HOME AUTOMATION PROJECT MADE BY SAKSHAM ARDUINO RFID DOOR LOCK CODELibrary Required - MFRC522 ************************************************************************************************************/#include #include #include  #define SS_PIN 10#define RST_PIN 9#define LED_G 5 //define green LED pin#define LED_R 4 //define red LED#define BUZZER 2 //buzzer pinMFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.Servo myServo; //define servo name void setup() { Serial.begin(9600); // Initiate a serial communication SPI.begin(); // Initiate SPI bus mfrc522.PCD_Init(); // Initiate MFRC522 myServo.attach(3); //servo pin myServo.write(0); //servo start position pinMode(LED_G, OUTPUT); pinMode(LED_R, OUTPUT); 핀모드(버저, 출력); noTone(BUZZER); Serial.println("Put your card to the reader..."); Serial.println();}void loop() { // Look for new cards if ( ! mfrc522.PICC_IsNewCardPresent()) { return; } // Select one of the cards if ( ! mfrc522.PICC_ReadCardSerial()) { return; } //Show UID on serial monitor Serial.print("UID tag :"); String content=""; byte letter; for (byte i =0; i  
    octopod_door_bluetooth.inoArduino
    Code for Automatic Door Lock Control (Bluetooth Version)
    /*********************************************************************************************************** OCTOPOD:A SMART HOME AUTOMATION PROJECT MADE BY SAKSHAM ARDUINO RFID DOOR LOCK CODELibrary Required - MFRC522 ************************************************************************************************************/#include SoftwareSerial BTserial(0, 1); // RX | TX#include #include #include #define SS_PIN 10#define RST_PIN 9#define LED_G 5 //define green LED pin#define LED_R 4 //define red LED#define BUZZER 2 //buzzer pinMFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.Servo myServo; //define servo namevoid setup(){ BTserial.begin(9600); // Initiate a serial communication BTserial.println("Waiting for connections..."); SPI.begin(); // Initiate SPI bus mfrc522.PCD_Init(); // Initiate MFRC522 myServo.attach(3); //servo pin myServo.write(0); //servo start position pinMode(LED_G, OUTPUT); pinMode(LED_R, OUTPUT); 핀모드(버저, 출력); noTone(BUZZER); BTserial.println("Put your card to the reader..."); BTserial.println();}void loop(){ // Look for new cards if ( ! mfrc522.PICC_IsNewCardPresent()) { return; } // Select one of the cards if ( ! mfrc522.PICC_ReadCardSerial()) { return; } //Show UID on serial monitor BTserial.print("UID tag :"); String content =""; byte letter; for (byte i =0; i   

    맞춤형 부품 및 인클로저

    This is the basic design that you can use if you want to make the enclosure out of Cardboard/ Wood like me! octopod_v2_ukTmIJ0uMl.f3dProper Enclosure that you can 3D Print! octo_2_v3_sii4tuCF7d.f3d

    회로도

    Pin configuration might be different with Arduino MKR 1010 Without Bluetooth
    For Bluetooth connect Rx (HC-05) --> Tx (Arduino)
    Tx (HC-05) --> Rx (Arduino)
    and 5v to 5v
    Ground to Ground ESP MAX
    AO - - - - - - - - - - - - GPIO2
    A1 - - - - - - - - - - - - - GPIO1

    Soil Sensor MAX
    analog sensor - - - GPIO3

    Gas Sensor (MQ2) MAX
    sensor - - - - - - - - - - - GPIO4

    PIR Sensor MAX
    sensor - - - - - - - - - - - -GPIO0

    Relay MAX
    1 - - - - - - - - - - - - - - - - - M0
    2 - - - - - - - - - - - - - - - - - M1

    제조공정

    1. 가정 자동화 애플리케이션
    2. 스마트 홈 IoT에 대한 교활한 malvertising 먹이
    3. RASPBERRY PI 홈 자동화
    4. 스마트 블라인드
    5. IOT - ESP8266, Arduino 및 초음파 센서를 사용하는 스마트 항아리
    6. 원쉴드를 사용한 스마트 홈 자동화 및 보안 시스템
    7. Tech-TicTacToe
    8. Arduino 카운트다운 타이머
    9. WiFi 로그인 페이지를 사용하는 스마트 도어록 by Arduino &ESP8266
    10. 인더스트리 4.0의 자동화