Please see the past ESP8266 tutorial in order to learn more. You have a lot more details about this in that tutorial. We detect the door open with a hall sensor and a magnet. The Arduino will send the data to a database that we have on our website and we do that with the ESP8266. The php file on the website, will compare the received sensor value with a threshold value and if the received is higher, then we send a mail to our own account so we could know that somebody opened the door from anywhere in the world. This is a push notification made with ESP8266.
Part list is very short. We need the Arduino and the ESP8266. If you supply the Arduino at 3.7V you won't need the 1K and 2.2K resistors as a voltage divider. The ESP usually won't work at 5V. See the schematic below for more. We need a hall sensor with a 10K pullup and a magnet to palce on the door.
Remember that we supply the arduino to the Vcc pin with 3.7V to 4.2V. More than that might damage the ESP8266. Don't worry, the Arduino can perfectly work with 3.7V. Mount everything as below. The D12 pin is connected to the Reset pin of the ESP8266 in order to take it out of Deep Sleep mode manually.
Ok, now that we have the schematic and everything connected, we first need to prepare our database. The database is where the values are stored and then we show those values to the website interface, so we can see those from anywhere in the world. Step 1 is to create a domain and get a hosting. Hosting is where our website data will be. As in the past tutorial, you can use a free domain and hosting service from 000webhost. See past tutorial on how to get a domain and hosting.
Once you have your domain, go to your "hosting" part on your C-panel (1). Then enter the database menu by clicking manage (2). There create a new database. Click add new and give it a name. In my case I've named my database noobix_v1 (3). Finally, open the database details (4) in order to get the details such as database name, username, host and the password will be the one you've placed when created your dataabse. Now we have a database, but is empty.
Ok, now open the created database, in my case the "noobix_v1" in php my admin. You will see that the database is empty, it has no tables. We meed to create a table where we will store the values for the id of the noobix, a password, the sensor value we receive, the threshold and the alarm status. As you can see on step (1), the database is empty. So, on the side on step (2), click add new table and give it a name. I give the name NOOBIX_V1_TABLE and I select 5 rows for all the values we need. Then click next. In the next step (3), you will have to insert the names of the rows as I did and the longitude value as well. The names must be the same, otherwise it won't work or you will have to change the php code. So, click save and we will have a table with rows for id, password, sensor value, threshold and alarm status.
Ok, as you can see now, the table is empty. That means it has no user for a NOOBIX device. So, we have to add at least one id and a password. For that click the insert button (1). On the enxt step (2), add the id and password that you want but with a maximum of 5 characters. In my case I add id= "1" and password= "12345". Then click save, so now we have a user for a noobix device. So as you can see on step (3), the table now has one row with the id, passowrd and the rest, but the rest are empty because we haven't reveieced data yet.
Ok, go below and downlaod a zip file.Extract it. Inside you will have a folder called NOOBIX_V1 with 3 php files inside. You have to open each of these php files with your own desired software. I use Dreamweaver. In each php file you mush cange the database data according to your own database. Also the table name. I've placed comments in the php files so you should know where to change the data. First open Change_SQU.php file and change the database server, user name, password that you've used and the database name we've crearted before. Get those values form step (4) from Part 3.1 above. Then change the table namme from NOOBIX_V1_TABLE to the table name you have used.
Now open index.php and change the database info and the table name as well. Save this file and then open the RX.php file. In the RX.php change all the data taht is between "/////////" lines because you will have to change the database info and table name a few times. Also, change the email address where you want the mail to be sent.
Save the files and uplaod the entire NOOBIX_V1 folder to your website, in my case I uplaod it to electronoobs.com. So, now if I go to electronoobs.com/NOOBIX_V1, I should get the interface and start using it. Now let's see the Arduino code.