www.webx.dk Start page
OZ2CPU Radioamateur mainpage
Homemade electronics Stuff old and new
ESP8266 WIFI enabled mail box with email alert.

The ESP8266 wifi serial modules, are the new HIT, so i had to play with them also,
Here is my second project with this new-wounder, a wireless WIFI enabled mail box with email alert, a very usefull tool for my busy day :-)
So now there is no need to look into the mail box and see it is only empty.
ok I could have drilled a litte look-hole on the side of the mail box, serves the same purpose, but where is the fun in that.
The idea for this project it NOT my own, has been on hackaday and many other sites too, my friend DZL made one with ESP8266 that worked perfectly,
I simply copied his project files and added a few upgrades/changes of my own. Thanks dzl for the saved time :-)

Here is the improved schematic, note the current limit resistor for the pnp, and hold time (47k-10uF) for the n-fet

The ESP12 or ESP8266 modules uses about 130mS to run all the backbone stuff, before user code is executed,
this mean the n-fet must be hold on, when the boot up is performed, GPIO2 signal will go LOW, when program is started, and HI again when program is done,
this way power off the circuit. GPIO2 can not be pulled low during init, else the esp will go into other funny modes of opperation.
so this explain the pnp and GPIO2 "pulled" high during bootup as shown.

My mail box is made of metal, and I did not want to add an ugly plastic box outside the mail box,
also the little PCB track antenna on the ESP12 / ESP8266 modules offer not super long range
so a better full size wifi antenna must be mounted, CUT the PCB as shown, add SMA connector
One hole of the SMA is used for mounting in the mail box

ESP8266 SMA connector bottom side

when SMA is mounted, test range is good and improved as expected,

first version with the small ESP8266 module, here I try without the base resistor on the pnp,
it is a very bad idea, overdrive the current capeabilities of the IO pin, waste alot of current, less battery time

BUMMER !! with a test performed with out antenna, i blew up my only tiny ESP8266 unit.
so I had to start all over with ESP12E, that kind of module is not as easy to mount SMA connectors on
and also it got many cool features like ADC, so it is dumb to use it for a mail box project.

ESP12E with SMA connector, note the much smaller distances, so a lot harder to solder.
the lit is removed due to repair/reuse fron another project.

ESP12E with all the parts mounted

it maybe look funny, but it works fine, i sealed it in compleetly with holt melt glue, this way all parts are hold good in place, and is not water proofed

Inside the mail box, the microswitch got both open and closed contacts, so it is easy to make it click when the lit is moved
the wood block is used to raise the switch to reach a good safe movin part of the lit, and also serves as mounting trick.
switch is mounted to wood, and other screws go into the wood from outside drilled holes, first only one screw, this way the switch can be moved and adjusted
until perfect relaiable opperation, and then add the last screw.

outside of mail box only the antenna is visible, I added hot melt glue arround the antenna, so kids will not steal it.

battery holder for one large li-ion cell, is mounted at the bottom, where it is most easy to access
I had to cut quite a lot of plastic away from the holder, since is was very hard to insert or pull out the cell.
NOTE : there is NO battery polarity protection in this circuit, so dont let the kids change battery.
I suggest a PTC fuse and diode to be added.

The software : Just copy and paste directly into ARDUINO
All this do, is simply a visit to a web link, this way the ifttt.com service is activated, and the pre-configured event, (email) is activated.
you can use any link you like, and any service you like, I just found the: IF THIS, THEN THAT, service very usefull for the email sender function.
(another cool and usefull 5$ project)

#include Arduino.h //(just add <> arround all the 4 h files, for no compile errors) #include ESP8266WiFi.h #include ESP8266WiFiMulti.h #include ESP8266HTTPClient.h ESP8266WiFiMulti WiFiMulti; void setup() { pinMode(2, OUTPUT); digitalWrite(2, LOW); // here we activate the PNP and hold the circuit ON Serial.begin(115200); // use the serial monitor in arduino to see how it works. for (uint8_t t = 4; t > 0; t--) { Serial.println("Connect..."); delay(1000); } WiFiMulti.addAP("wifiaccessname1", "password1"); // you can add as many as you got WiFiMulti.addAP("wifiaccessname2", "password2"); WiFiMulti.addAP("wifiaccessname3", "password3"); delay(100); } unsigned char sending = 1; void loop() { if ((sending == 1) && (WiFiMulti.run() == WL_CONNECTED)) { HTTPClient http; Serial.print("[HTTP] begin...\n"); String URL = "http://maker.ifttt.com/trigger/post/with/key/YOUR-UPDATE-KEY-GO-HERE"; // UPDATE THIS LINE Serial.println(URL); http.begin(URL); //HTTP int httpCode = http.GET(); if (httpCode > 0) { // file found at server if (httpCode == HTTP_CODE_OK) { String payload = http.getString(); Serial.println(payload); } } else { } http.end(); sending = 0; Serial.print("[HTTP] end...\n"); digitalWrite(2, HIGH); // NORMAL POWER OFF, AFTER SEND DATA IS OK } if (millis() == 30000) digitalWrite(2, HIGH); // POWER OFF TIME OUT, DATA MAY NOT BE SEND }


DOORBELL email information.
ever woundered how many times someone ring your door while you are not home to hear it ?
use the same software, and change the alert info in the email sender to write DOORBELL, it is (almost) that simple
ok true if your door bell runs on 3.3V ?? mine run on 7-8V from two lithium cells.

the negative regulator makes 3.3V for the ESP, from the top, (raised ground)
The reason for this is simple, the PNP transistor and its keep alive signal from the esp works from +
and can not handle any type of pull down.
How about optical indicator for the doorbell ? Easy the keep alive signal from the NFET can drive a set of powerfull LED.

mounted in the room with loud music, easy to see if someone ring the door while you have a party.


2017 Thomas Scherrer OZ2CPU
Thanks to OZ5DZL for patience and support, and kick-starter help with the ESP stuff
If you found this page usefull, why not consider donate a bit.. see my contact page.