Buy from US | Buy from UK | Buy from DE | Buy from IT | Buy from FR | Buy from ES | ここでご購入を! |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
This lesson is our final project which is a little bit complicated and more exciting. In previous lesson, we only use browser or cell phone to make human talk. In this lesson, we will one mainboard to talk with another mainboard through Internet UDP protocol. You need to buy two set of our IoT learning kits.
We will use first OSOYOO basic board(call basic A) to connect PIR motion sensor and another mainboard(basic B) to connect buzzer. When an intruder is detected by PIR motion sensor in basic A, an Alarm signal will be sent from basic A to basicB and make the buzzer beep.
First, please insert the ESP8266 wifi Shield into your mainboard,
OSOYOO Basic Board | PIR |
D3 | OUT |
GND | GND |
5V | VCC |
Hardware B)OSOYOO Basic Board B+ESP8266 WIFI shield connects to buzzer
Buzzer I/O pin connect to D9 as per following picture:
OSOYOO Basic Board | Buzzer |
D9 | I/O |
GND | GND |
5V | VCC |
Step B) Connect the OSOYOO Basic Board to computer via USB cable,
Step C) Open the IDE and choose corresponding board type and port type for you project.
Step D) Download the sketch file from:https://osoyoo.com/driver/Esp8266_Arduino_IOT/lesson12/esp8266-lesson12.zip
After unzip above file, you will see a folder “esp8266-lesson12” , enter this folder, you will see two sub-folders(buzzer and motionsensor).
Enter buzzer folder and double click the buzzer.ino file, find following lines:
char ssid[] = "******"; // your network SSID (name) char pass[] = "******"; // your network password
please replace the ****** with your correct wifi SSID and password, otherwise your project can not connect to Internet.![]()
Step E) After change above lines, load the sketch into IDE.![]()
Open your Serial Monitor, you can see your router will assign an IP address to your IDE as following: In above example, 192.168.50.31 is the IP address assigned by router to your buzzer IDE.You have to write down this IP address in a paper. We need to use this IP address to change the sketch code in motionsensor.ino file. You can unplug this IDE from PC and use some other USB adapter to power this buzzer IDE.
Step F) Now connect your PIR motion sensor IDE to your PC, open the folder motionsensor and open the motionsensor.ino file, find following lins:
char ssid[] = "******"; // your network SSID (name) char pass[] = "******"; // your network password
please replace the ****** with your correct wifi SSID and password, otherwise your project can not connect to Internet.
Step 5) Then search following line:
byte remoteIp[] = { 10,0,0,244 }; //...
You need to change the line remoteIp[] variable , replace the IP address 10.0.0.244 with the one your recorded from Step A. In our example, Step A shows buzzer IDE IP is 192.168.50.13, so we make the line to:
byte remoteIp[] = { 192,168,50,31 }; //…
Then you can compile and upload the motionsensor.ino file to IDE.
Test result:
Turn on power of both ESP8266 shield and OSOYOO Basic boards . When you move your hand in front of the motion sensor, the remote buzzer will beep.
DownLoad Url osoyoo.com