Hardware

Remotely Control Actuators with Temboo


Controls Actuators with Cloud Controls

In this tutorial we'll show you how to use Cloud Controls to remotely control actuators like motors, LEDS, fans, pumps and anything else that you have attached to your internet-connected microcontroller.

Here's what we'll cover:

  • How to set up an actuator to control remotely
  • Auto-generating code for your actuator control app
  • Controlling an actuator via the browser from anywhere in the world
  • Frequently asked questions about how Temboo works with actuators

Remotely Controlling Actuators

Before You Start

Since this tutorial uses the Arduino Yún, you’ll need to download and install the latest version of the Arduino IDE. Once you've got it, make sure that you have the latest version of the Temboo library for Arduino by going to the Sketch > Include Library > Manage Libraries... menu in the Arduino IDE, finding the Temboo library, and upgrading to the latest version as necessary.

You’ll also need to connect your Yún to the internet. If you need help with that, take a look at Arduino's excellent documentation.

Finally, go to the File > Examples > Temboo > ArduinoYun menu and run the CloudControlsConfig sketch to prepare your Yún for running a Cloud Controls application. Now you're ready to start generating code!

Set Up Your Actuator

1Log in to Temboo. If you don't already have an account, you can sign up for free.

2Once you're logged in, go to our code generation tool and find the Gmailv2 > Messages > SendMessage Choreo. A Choreo is a cloud-based process that connects your Yún to any web-based service, and every Temboo application is associated with an least one Choreo.

3Select Arduino from the drop down menu at the top of the Choreo page, then select the Arduino Yún.

4The first step in remotely controlling an actuator is to specify what exactly you want to control, and which pin it's attached to on your development board. You do this via the interactive virtual board. For this tutorial, we're going to generate an application that controls the Yún's onboard LED associated with pin 13. If you'd rather control any other actuator, you can use that and still follow along.

Now, set up your actuator on pin 13 in the manner shown below.

Setting up an actuator for remote control

5When you've created an actuator, you have the option to turn the actuator on or off, or modify its analog value, based on the output of the Choreo that your application is running. For example, in this case we could turn on/off our LED based on whether our email sent successfully. Since we're not focusing on running Choreos in this tutorial, we'll ignore this option for now, but it's worth noting this very useful option for when you need to trigger actions in the physical world based on virtual events.

Setting a condition

Register your device

6While we were setting up our actuator on the virtual board, Temboo was generating all the code we need to remotely control the actuator from the browser. Now, we'll download that auto-generated application and try it out.

Scroll down and find the Code section. Click the gear icon and choose Compiled. Click the Download button that appears.

Downloading compiled code

7Now, register your device. You can use whatever values you like to register your device, and then hit save.

Device registration on Temboo

Upload the .hex file and run the app

8To run the app on your Yún, find the downloaded .zip file and extract the contents (hint: the file name will contain the ID of the device your just registered). Locate the .hex file within - this is the compiled version of the application that you just set up via our website.

9Next, open a terminal window and we'll run some commands to upload the .hex file to your Arduino Yún. Here's a good intro to running shell commands if you need help.

We'll begin by using the SCP command to copy the compiled application to your Yún. In the command below, make sure to substitute in the name of your .hex file in place of the your_app placeholder. If you're on a network with more than one Arduino Yún you should use your Yún's IP address instead of arduino.local. You can find the IP address for your Yún in the Tools > Port menu of the Arduino IDE.

When you've edited the command as necessary, navigate to the location of your .hex file and run your command. Remember, unless you've changed it, your Yún's password is arduino.

scp your_app.hex root@arduino.local:/tmp

Next, SSH into your Yún by running the command below. Again, swap in your IP address in place of arduino.local as necessary. If you need help getting started with SSH on the Yún, Arduino have instructions specific to the Yún that will tell you what you need to know.

ssh root@arduino.local

Once you've gained access to your Yún via SSH, run the following command to merge your sketch with the boot loader. Make sure to swap in your .hex file name in place of the your_app placeholder value.

merge-sketch-with-bootloader.lua /tmp/your_app.hex 

Finally, run this command to program your microcontroller to run the application (again, swap in your .hex file in place of the placeholder value). With the application running on your Yún, you're ready to check out your sensor data graphs and remotely control your Yún.

run-avrdude /tmp/your_app.hex 

Remotely Control Your Device

10Now that your Cloud Controls app is running on your Yún, head over to your Devices page to see it in action. A virtual representation of your device will be waiting for you.

Temboo Devices Dashboard

11Select the device that you registered and you'll be taken to the controls for that device. Go ahead and hit the button and you'll see two things happen - the red LED on your Arduino Yún will turn on, and your browser will update to reflect the state of your actuator.

Remotely control an actuator

That's it! You now know how to remotely control actuators from your browser with Temboo. The process that we just covered for the Yún's LED applies to any other type of actuator, meaning you're just a few steps away from making something extraordinary. With Temboo handling all the small stuff, you're free to think big.

Need help?

We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

Actuators: Frequently Asked Questions

What sort of actuators do you support?

We provide dedicated support for actuators in the following categories:

  • Solenoid
  • Audio
  • Pump
  • Fan
  • Relay

By dedicated actuator support we mean that, within each category, we support specific actuators from manufacturers like Panasonic, Omron, and Crouzet. Dedicated actuator support lets us offer controls that take advantage of features that are specific to a given actuator. However, we also enable you to connect any digital or analog actuator and we'll generate the code you need to remotely control that actuator from any web browser. We currently support the following actuators:

  • Crouzet 81519332 solenoid [datasheet]
  • Omron Automation and Safety M2BJ-B24 audio speaker [datasheet]
  • BLDC DC40C-2460 pump [datasheet]
  • Delta Electronics ASB0412LA-A fan [datasheet]
  • Panasonic JS1-12V-F relay [datasheet]
  • Kohree Nextrox OT364-HM 37mm 12V 15RPM motor [details]

How exactly can I control my actuator?

We offer remote control functionality for digital and analog actuators. Digital actuators can be set low or high, and the user interface is tailored based on the type of actuator you have. For analog actuators, we enable you to set any value from 0 - 1023, so that you can use dimmable LEDs, variable speed motors and any other type of analog actuator.

What happens if my application changes my actuator's state?

No problem, we've got you covered. If your actuator state changes based on an event in your application e.g., you've mapped a Choreo output to the actuator so that you can, for example, blink an LED when the device has fired an email alert, we'll automatically handle this. Since we maintain a connection to your device, your actuator will let us know if its state has changed and we'll update your controls user interface so that the browser is always in sync with your physical actuator.

What happens to my actuators if my device goes offline?

When we detect that your device is offline for a significant period of time following successive retry attempts, we'll reset its actuators to an assumed safe state. This safe state involves setting each active actuator pin to its low state.

What do my actuators do when connectivity is restored to my device?

When your device regains connectivity after a period of disconnection, our controls user interface for that device will immediately be updated to reflect the current state of your actuators. If your device has entered the offline safe state i.e., all active actuator pins are set to low, you'll be able to turn your actuators on again using the remote control switches and sliders in your browser.

I have an actuator that you don't support - what can I do?

We'd love to hear about it! Please get in touch and let us know what you're working on so that we can discuss how Temboo can be a part of it.


Back