In this lesson, we will show you how to make use Internet to monitor remote sound sensor status.
We will use Osoyoo Mega-IoT Shield to connect sound Sensor, LEDs and MEGA2560 MCU board. OSOYOO Advanced Board for Arduino MEGA2560 can work as a web server. Remote browser can access this web server to shows sound sensor real time status.
First, please plug OSOYOO MEGA-IoT Extension Board into OSOYOO Advanced Board for Arduino MEGA2560:
Then connect the modules with the OSOYOO MEGA-IoT Extension Board with four 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
Sound Sensor-A2
Step 1 Install latest IDE (If you have IDE version after 1.1.16, please skip this step)
Download IDE from https://www.arduino.cc/en/software, then install the software.
Step2 WifiEsp Library Installation (if you have installed WifiESP library, please skip this step).
OSOYOO MEGA-IoT extension TX/RX pin to OSOYOO Advanced Board for Arduino MEGA2560 A9/A8 pin by default. So in the sketch code, we need use Software Serial Port to communicate with ESP8266 (set A9 as TX and A8 as RX in softwareserial object).
To use this wifi shield in IDE, we need download WiFiEsp-master library from following link:
https://osoyoo.com/driver/WiFiEsp-master.zip
You need go to 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-lesson11”:
https://osoyoo.com/driver/smarthome/smarthome-lesson11.zip
Step 4 After above operations are completed, connect OSOYOO MEGA2560 Board to PC with USB cable.
Step 5 IDE: Choose corresponding board type and port type for you project .
Step 6 IDE: Click file – Open, then choose code “smarthome-lesson11.ino” in the folder, load up the sketch onto your OSOYOO Advanced Board for Arduino MEGA2560.
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 OSOYOO Advanced Board for Arduino MEGA2560, open the serial monitor in the upper-right corner of 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 sound signal is detected. The Red LED on the D11 pin of MEGA-IoT shield is off and Green LED is ON which shows the same result.
Now let’s make some noise. We connect a buzzer pin to D5 slot. You will hear very big noise. Put the buzzer close to sound sensor. 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.
DownLoad Url osoyoo.com
You must be logged in to post a comment.
Hello,
I am having some trouble on lesson 11. When I load the sketch after putting in my SSID and PASSWORD as soon as it starts to upload sketch to the mega board the buzzer goes off very loud. The only way I can stop it is to pull the programming cable out or loading a previous sketch. I tried letting it run to see if it connects to the web and it does that with no problem and it says no noise all the while the buzzer is still very loud. The microphone card switch is on the D side like in the lesson’s picture. when I open the serial monitor it shows I am connected to internet and then it scroll by real fast with the words no noise and the buzzer is loud.
The buzzer noise is for test purpose(buzzer noise is the signal source of sound sensor). If you want to stop the noise, please pull the buzzer signal cable from D5 pin. If you want some noise to test the sound sensor, insert the cable back into D5 pin.