Buy form US Buy form UK Buy form DE Buy form FR Buy form IT Buy form ES ここでご購入を!

In this lesson, we will show you how to make use Internet to monitor remote Smoke Sensor status.

We will use Osoyoo Mega-IoT Shield to connect Fire Sensor, LEDs and MEGA2560 MCU board. Arduino MEGA2560 board can work as a web server. Remote browser can access this web server  to shows fire sensor real time status.

First please plug OSOYOO MEGA-IoT Extension Board into MEGA2560 board:

Then connect the modules to the OSOYOO MEGA-IoT Extension Board with  3-pin PnP cables as below. (Jumper Cap should connect ESP8266 RX with A8, TX with A9)

Green LED module—D12

Red LED module—-D11

Gas Detection module—A3 (Make sure the Gas Detection module’s switch is put on D (NOT A) on the left side)

Notice: Unplug your power adapter when upload sketch code to Arduino.

Step 1 Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip this step)

Download Arduino IDE fromhttps://www.arduino.cc/en/software,then install the software.

Step 2 WifiEsp Library Installation (if you have installed WifiESP library, please skip this step)

OSOYOO MEGA-IoT extension TX/RX pin to Arduino A9/A8 pin by default. So in Arduino sketch code, we need use Software Serial Port to communicate with ESP8266 (set A8 as RX and A9 as TX in softwareserial object).

To use this wifi shield in Arduino IDE, we need download WiFiEsp-master library from following link:

https://osoyoo.com/driver/WiFiEsp-master.zip

You need go to Arduino IDE ->Sketch ->Include Library ->Add ,Zip library to load above zip files into Arduino IDE.

Step 3 After installing above library, please download the main code from following link, unzip it, you will see a folder called “smarthome-lesson9”:

http://osoyoo.com/picture/Smart_Home_IoT_Learning_Kit_with_MEGA2560/lesson9/smarthome-lesson9.zip

Step 4 After above operations are completed, connect OSOYOO MEGA2560 Board to PC with USB cable.

Step 5 Arduino IDE:  Choose corresponding board type and port type for you project .

Step 6 Arduino IDE:  Click file – Open, then choose code “smarthome-lesson9.ino” in the

folder, load up the  sketch onto your Arduino.

Note: In the  sketch, find  line 24,25 as following:

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.

After loading the sketch to Arduino , open the serial monitor in the upper-right corner of Arduino IDE, you will see following result:


From the serial monitor, you can see the IP address of your MEGA2560 board in the read circle (in above picture, 192.168.50.102).

Then use your browser to visit the website http://mega2560-ip-address (in above case, http://192.168.50.102), you will see following result:

Above result means there is no Smoke signal is detected. The Red LED on the D13 pin of MEGA-IoT shield is off and Green LED is ON which shows the same result.

Now let’s use a gas lighter to leak some gas to fire sensor, the gas will trig  fire signal to Arduino. You will see the Green LED on IoT shield will be off and Red LED will turn ON.

Now check the web browser , after about 2 to 5 seconds, the browser will show following result.