Hardware

Connect your Arduino to Temboo via Ethernet


Your hardware can do a lot, but when you connect it to Temboo the possibilities are endless. In this tutorial, we'll show you how to use the Arduino Yún shield to add Ethernet connectivity to your Arduino board and send an email from your Arduino using Temboo.

This sketch uses our Google > Gmail > SendEmail Choreo. You'll also need the Arduino Yún Shield and a compatible Arduino board.

Get Set up

1Make sure you have a Temboo account. If you don't already have one, you can register for free.

2Make sure that you have the latest version of the Arduino IDE. You should also be sure that you have the newest version of the Temboo Library by checking the Arduino Library Manager.

3You'll also need a Gmail account, which you can create here. To authenticate with Google, you'll want to enable 2-Step Verification and generate an App Password for Temboo.

4Sign in to your Google Account settings page by clicking on your name or picture in the upper right corner of the screen and then clicking Account.

5Scroll down to the "Signing in" box.

6Click 2-Step Verification. This will bring you to the 2-Step Verification settings page.

7You will then see a step-by-step guide which will guide you through the setup process.

8After you've enabled 2-Step Verification, you'll be prompted to create an App Password.

9In the Select app dropdown menu, choose "Other", and give this app a name (e.g., TembooApp).

10Click "Generate". You'll be given a 16-digit passcode that can be used to access your Google Account from Temboo.

Note: If you wish to authenticate with OAuth credentials, you should use the Google > Gmailv2 Choreos.

Auto-Generate the Sketch

11Go to the Google > Gmail > SendEmail in our Library.

12Select Arduino from the drop down menu at the top of the page, then choose your Yún Shield compatible Arduino board.

13Select the Arduino Yún Shield from the "How is it connected?" drop down menu.

Selecting the Arduino Yún Shield from the drop down menu

RUN THE CHOREO

14Now that you've set up your board, you're ready to try the Choreo in the browser. Fill in the required Gmail Password, Username, FromAddress, MessageBody, Subject and To Address.

15Save the inputs into a profile for the next time we want to run this Choreo by clicking Save Profile at the top of the INPUT box. Give your profile a name, and press Save again. Then click the Generate Code button to test out the Choreo from our website.

The 'Run' button at the bottom of the Choreo inputs on a Choreo page

16If you'd like the Choreo to be triggered by a sensor event, or if you'd like the Choreo result to trigger an actuator event, you can configure sensors and actuators on the visual pin board at the top of the page. Then you'll be able to specify conditions above and below the Choreo inputs and we'll generate the application logic code you need.

Setting a Choreo to be triggered by a sensor event

USING THE CODE SNIPPETS

17Scroll down past the OUTPUT section to the Code snippets. Copy and paste the code snippet into your Arduino IDE.

The generated code for your Arduino Ethernet Shield application

18You'll also need to create the header file for your sketch, where your Temboo account credentials and shield information are stored. To incorporate it into your sketch, you'll create a New Tab in the Arduino IDE and call it TembooAccount.h.

19Copy the code snippet in the HEADER FILE found directly following the code snippet that you just copied and paste it into the TembooAccount.h tab.

The header file containing your Temboo account details

Running the Sketch

20That's it, now your code is ready to upload! Once you upload the sketch to your board, open the serial monitor and you should see the success message indicating that your email has been sent. If you sent the email to yourself as a test, you should see a new email from your Arduino in your inbox.

What Next?

Now that you know how to connect your Arduino to Temboo via an Ethernet connection, you're ready to create a project that uses auto-generated code from any of our 2000+ Choreos. We'd love to hear about what you make - hey@temboo.com.

Once you've got your code up and running, you're ready to move on and do more. From monitoring your running applications, to moving your generated Temboo code to your preferred development environment and sharing it with colleagues, collaborators and friends - we've got you covered.

Need Help?

If you ever need help building your IoT application with Temboo, now or in the future, please don't hesitate to get in touch.

Email us at support@temboo.com and we'll answer your questions.


Back