Not long ago, I reached 50 000 views on my ESP8266 Wi-fi module. I was quite amazed and wanted to thank everybody that watched it, liked it and commented on it. On September 2., I published instructable on Weather station and got featured only 15 min after publish. I was very motivated to do more as I see all the views, comments and wanted to say thank you all.
Now, let's go to the meat of this project.
My father asked me to do a little project with Arduino that would send an e-mail when a push button is pressed or anything, can be based on temperature reading, so make sure you watch my previous instructable on that or to send that something has closed up on the distance sensor. Be sure to watch those tutorials on my profile.
So I started looking on the web for a way to send emails with bare arduino and an ethernet shield. I already did a mini project that was sending email by pushing a button, but was done with some python on a pc or Raspberry pi. That can be a waste of money, if you want to leave your Raspberry or any small computer inside of a project.
So as I wanted to do it with only and ethernet shield, I came upon an obstacle. A code for this very purpose can be found in first google searches on Arduino playground site, but it gave me errors as it works with smtp protocol but most email services like gmail want a more reliable connection with some safety like SSL. Arduino just might not be able to do that. Now correct me if I'm wrong, but those were some facts that I found on forums regarding the errors that I was getting. Now what.
Than I found this amazing site called Temboo. It spins around IoT and everything related to that. They also support sending mail by their library, that is believe it or not, already implemented inside Arduino IDE by default.
I will guide how to set up a GMAIL account, how to set the electronics and get the thing working.
Step 1: PARTS THAT YOU WILL NEED
You will need:
-Arduino Uno or any board alike
-momentary Push button
-10k/1k Resistor (depends what you have in stock and you can use any resistor above 1k but those are most common)
You can start by attaching the Ethernet shield on the Uno and in my case I added a prototyping shield so I don't need an external breadboard (you can see that in the introduction picture).
Step 2: Connecting Hardware
Now that you have your Ethernet shield on your Uno, let's connect the push button to one of the free I/O pins. Keep in mind that Ethernet shield uses quite a lot of them. The ones that are free are 2, 6 and 8. I'm going to choose the pin 2.
As you can see in the picture, the push button is wired the way, that when the button is pressed, the current from 5v starts flowing threw the resistor and into GND and the PIN 2 so it puts it HIGH. But when the button isn't pressed, the resistor pulls PIN 2 LOW as it is connected to the GND so that PIN 2 doesn't read anything else when the button isn't pressed.
That's all for the hardware part of side so now let's start with setting up a GMAIL and TEMBOO account .
*If you happen to have one of those small Ethernet adapter things, I will try to show how to operate with one of those if I will find one.*
Step 3: Setting Up GMAIL Account
Now we will configure your GMAIL account so It can be accessed by Temboo servers. For any project it is good, to make yourself another gmail account just for these kind of purpose.That way you don't need to worry about your personal account. All that said, that doesn't mean that the site will hack into it, as it can be trusted.
Now, these steps will be shown for each picture, so 1 picture 1 step, so follow the pictures while reading.
*NOTE, TE TEXT IS IN MY LANGUAGE AND I CAN'T DO ANYTHING ABOUT THAT; BUT EVERYTHING THAT YOU NEED TO CLICK WILL BE MARKED AND TOLD*
STEP 1 *has no related image*: Make yourself a gmail account to use it for sending emails.
STEP 2 *starts with first picture*: When you have logged into your new gmail account, 2-step Verification setting, that will get you the the 2-step verification setup. You can get to this setting in your gmail setting page, but it would take you some time, so go ahead and click on that link. This is going to generate a 16 character code for the Temboo to be able to access your gmail account to send emails. The page should look like this (first picture). The orange circle shows you, when your 2-step verification is active.
STEP 3: Click on the second tab on the banner that reads "Gesla za dostop...." It will say different in English but just click on the same button. It will take you on this site and now click on that bottom button that is circled with orange color.
STEP 4:Than this page should pop up that will contain all the "Apps" that have access to your gmail with each one having a unique code.
STEP 5: Click on the bottom to select the App and click "Other" and name it the way you like it.
STEP 6: This screen should pop up with a code. You want to copy that code somewhere else like an empty browser tab as you will need it later as the password. This is that 16 character code that I was talking about.
This is the end of the GMAIL part, now let's go set up your Temboo account.
Step 4: Setting Up Temboo Account
Same thing as before, every step for 1 picture.
STEP 1: Go to Temboo site and you will be prompted with this site. Enter your email and your password (not your email password, your new Temboo password).
STEP 2: Once you have done that, you will get to this site. Sellect other Arduino board +ethernet shield as this is what we have today.
STEP 3: When you get to this site...
STEP 4: ...click on the tab "Send an email from your gmail account".
STEP 5: This is the site that will open.
STEP 6: Now we will start by selecting Arduino board and Arduino ethernet on the tab nex to it. Mine is renamed, because I saved my configurations on that name, as you can do that with a click on a button on the top right corner of the form that we will fill up.
STEP 7: First thing in the form is the password, that we saved before. Put that in, everything is self explanatory.
STEP 8: Now you click the RUN button that will take your info and will put it in a code. The code can be downloaded on the bottom button. The code will look like this and doesn't need any new libraries to install. The next picture shows another arduino tab that hold your username and password and account of Temboo. In the future, you can change things like subject and body text or anything else in the code, or just simply correct the form and click again on the run button.
Step 5: COMPLEATED
Now you are all set to go and all you need is to connect your arduino sandwich to power and internet, wait a few seconds and press. You will se mail on the recipients side soon. What is all great about this is that you can add more recipients in the code and more buttons or something, so it sends mail to different people or to select a different subject or body text.
I managed to film this short demo on how does it work. Don't comment on the messy table ;)
Step 6: CONCLUSION
I would like to thank you for watching my tutorial. It took me a day to make it without any pauses with all the pictures, writing and finishing all together. I would appreciate if you recommend it if you found it useful and drop a like (favorite) or ask me anything as it keeps me motivated to do these instructables. I have lost of good ideas for the future so until than, have fun and be sure to share if you did something amazing around this project.
Johnson Selva made it!