How to Send E-mail using PIC Microcontroller and ESP8266
In this tutorial let us learn how to send E-mails from PIC Microcontroller using famous WiFi module the ESP8266. This tutorial uses PIC16F877A IC and MPLABX and XC8 compiler for programming.
At the end of this tutorial you will be able to send E-mail from any normal E-mail ID like Gmail, yahoo etc to any other E-mail ID. Hence this tutorial assumes that you have some basic knowledge on ESP8266-01 Modules and PIC Microcontrollers. If not, the following tutorials will help you
Getting your Hardware Ready:
The complete schematic of the project is shown below.
The LCD display is used here for debugging purpose. It is not mandatory for you to connect this. The program will work fine even without the LCD display. If you want to know more about the schematics you visit this tutorial. (Interfacing PIC with ESP).
You can simply assemble this circuit on a breadboard and then proceed with the programming.
Programming your PIC to send E-mail:
In order to send an E-mail from the ESP8266 a sequence of AT commands has to be sent to the ESP module. The following steps have to be followed to send an E-mail from ESP8266.
- Set the module in AP+STA (Access Point and station) mode
- Connect to an Access point to get internet connection
- Enable multiple connections
- Start a server on any specific port
- Establish a TCP connection with SMPT2GO website
- Navigate to the Login section of the website
- Enter the E-mail ID and Password in base64 format
- Enter From mail ID
- Enter To mail ID
- Enter the Subject of the mail
- Enter the body of the mail
- Indicate the end of mail
- Send the mail
- Quit the TCP connection
It is a bit lengthy and tedious process but do not worry. I have simplified the process by creating a header file and you can use it directly by just calling some functions (explained below) which makes this task very easy. The complete code along with the header file can be downloaded from here.
Note: If you are using the code in a new project make sure you download the header file and add it in your project.
I have explained some important parts of the code below, the other parts are self explanatory. But if you have any doubts feel free to use the comment section.
for more detail:How to Send E-mail using PIC Microcontroller and ESP8266
Current Project / Post can also be found using:
- 3x3x3 LED cube schematic