Hardware

Connect your Arduino to Temboo via Bluetooth Low Energy


Your Arduino 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 Temboo to trigger an email alert whenever an iOS or Android device comes into close proximity with your Arduino board + RedBearLab Bluetooth Low Energy (BLE) shield.

This sketch uses our Google > Gmail > SendEmail Choreo. You'll also need the RedBearLab BLE 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 a free account here.

2You'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.

3Sign 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.

4Scroll down to the "Signing in" box.

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

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

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

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

9Click "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.

10Next, make sure that you've got the required RedBearLab Arduino libraries installed. Their BLE Shield requires two libraries:

  1. An Arduino BLE library which you can find here.
  2. The RedBearLab RBL_nRF8001 library.
    • If you're using Arduino 1.0, use the RedBearLab library.
    • If you're using Arduino 1.5, use a patched version of that library.

An easy way to get these files is by hitting the "Download ZIP" button on both top-level Github repository pages. If you need further help setting up your RedBearLab Shield, you can find their getting started tutorial here.

Auto-Generate the Sketch

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

12Select Arduino from the drop down menu at the top of the Choreo page, then choose your Arduino device.

13Select the RedBearLab Bluetooth LE shield from the "How is it connected?" drop down menu.

14Next you'll see a popup window that prompts you to provide a name for your BLE shield. The name you enter here will be used to advertise your Bluetooth device, so it must be 10 characters or less. When you press Save, Temboo will add this shield to your Profiles so that you can use it later.

RUN THE CHOREO

15Now that you've set up your board, you're ready to try the Choreo in the browser. Fill in the required Gmail inputs, making sure to use a full email address e.g., joe.temboo@gmail.com, for the Username value.

16Click the Generate Code button to try out the Choreo. If you're sending an email to yourself, check your inbox!

Note: The first time you run this Choreo, you may receive a warning from Google prompting you to authorize access from a third-party system. Follow their instructions about visiting this page to clear the warning.

USING THE CODE SNIPPETS

17Scroll down past the OUTPUT section to the auto-generated code. Here you'll find the Arduino sketch that controls the BLE Shield, as well as an option to download an iOS or Android app that uses proximity to your shield to trigger the SendEmail Choreo.

18Copy the Arduino sketch into the Arduino IDE. Make sure you have the relevant RedBearLab and BLE libraries installed so that the sketch will compile. With the BLE shield attached to your Arduino board, upload the sketch.

19Next, select whether you want to try this out with an iOS or Android device. The iOS and Android code you see in your browser represent TembooTask, the parts that are dynamically generated by Temboo based on the Choreo you want to run when you are close to your BLE shield. Click the download links to generate a custom mobile app that includes all the code you need to run the app on your device.

Running the App

20You should already have the Arduino sketch running, so next you'll need to get your downloaded mobile app up and running. This should be familiar if you've worked with iOS or Android before, but we've got dedicated iOS app and Android app tutorials in case you need them.

21When you're ready, launch your mobile app and hit Connect. When the proximity signal value is greater than -50 e.g., -22, the Choreo will be triggered from the mobile device and an email will be sent. You've got mail!

What Next?

Now that you know how use Bluetooth proximity to send an email, 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.

CMSVAR:INTEGRATIONS

Need Help?

If you ever need help with IoT Mode, 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