IoT Project: Integrate Arduino with Yahoo! using Temboo

This IoT project explores how to integrate Arduino with Yahoo! Weather. Internet of things (IoT project) is the next big thing in the near feature. This technology is growing fast and there are many objects that begin talking each other using internet. Prototyping platforms like Arduino and Raspberry PI are supporting these innovations and help many developers to create interesting IoT projects. One pillar of this emerging technology is the cloud IoT platforms that help developers to build Internet of things projects. One great platform, that is very useful, to build great IoT project is Temboo. To explore how to develop an IoT-based project we will connect Arduino with Ethernet shield to Yahoo! Weather information, using this information Arduino controls an RGB led changing its color. In previous IoT project, we explored how external events, measured by sensors connected to Arduino, can trigger actions on Temboo platform, like sending messages and so on. This Internet of things project example uses a different approach: data retrieved from an external source (like Yahoo! Weather) can control and have effects on Arduino connected devices.

IoT project: integrate Arduino with Yahoo! weather using temboo

Remote control #Arduino using @Temboo. #IoT Click To Tweet

Set up the IoT project: getting started with Arduino and RGB Led

Before digging into Temboo platform details, it is useful to create a simple Arduino sketch to control the RGB led. Arduino controls this led type using PWM (Pulse Width Modulation) so that it is possible to change the three basic color value (Red, Green, Blue).
The figure below shows the simple sketch:

how to control RGB led with Arduino


Recently Temboo has changed the way to use to connect boards. Instead of using Arduino UNO you can use one of the compatible boards that use Yun or Wifi101

The code is very simple: Arduino has some PWM pins that can be used for this purpose, in this sketch the PWM pins used are 3, 6, 5.

int delTime = 1000;
int redPin = 3;
int bluePin = 6;
int greenPin = 5;

void setup() {
   pinMode(redPin, OUTPUT);
   pinMode(bluePin, OUTPUT);
   pinMode(greenPin, OUTPUT);

void loop() {
    String val = "120";Serial.print("Value " + val.toInt());
    Serial.print("Value " + val.toInt());
    analogWrite(redPin, 255);
    analogWrite(bluePin, 0);
    analogWrite(greenPin, 0);

Running the example, Arduino controls the RGB Led as shown below:

Yahoo! Wether details

If you are new to Yahoo! Weather, you have to know that to get weather information Yahoo uses Woeid. This is a unique identifier assigned to all cities, areas around the world. Using this parameter, it is possible to get weather information. As you will see later, Temboo requires Woeid so that it is necessary to convert the city name to woeid.
There are two different methods: one that uses Yahoo! API and another one much more simpler.

Yahoo! API : Woeid

This method requires you to create an account on Yahoo! and create a unique key. This can be done easily using Yahoo! developer site.
Once, the unique key is available we can get the woeid easily:'City_Name')?appid=your:key&format=json

The result is a JSON data like this:

            "placeTypeName attrs":{
             "country attrs":{
             "admin1 attrs":{
            "admin2 attrs":{
            "admin3 attrs":{
            "locality1 attrs":{
          "timezone attrs":{
              "type":"Fuso Orario",

The wooed (720187) is on the top so that it is enough to copy and paste this value.

Second method: Website

If you don’t want to waste your time using the method one and you are looking for a fast way to retrieve woeid, you can use this website:

woei lookup

Inserting the city name and clicking on lookup you will find as result the woeid list.

Integrate Arduino with Temboo

Temboo is a great platform that uses Choreos to expose services to Arduino or other dev platforms. Choreos are useful when building IoT system. To get Weather information we have to use Yahoo! Weather Choreos and then GetTemperature. In this case, the project uses the Temperature to control the RGB Led, but you can use any other parameters.
Now everything is very simple, just paste the woeid you get before and click on run to get weather information.
In this example, woeid is used but you can get the weather information using Address for example. Anyway i prefer woeid because it is much more simpler.
There are some other optional parameters you should consider like the Temperature unit and the response format:

Arduino Temboo integration using Yahoo choreos

Once you clicked run, you get the Arduino code that you have to copy and paste in your sketch. Arduino is ready to get weather information, if you run the example you get as result:

Temboo source code for Arduino

As you can see the source code is available to use in the sketch.

Control RGB Led using Temperature

Now that we have all the pieces in our hands we have to mix them to make things working.
The sketch with Temboo code, copied previously, has to be modified so that the result returned is used to change the RGB Led color.
Let’s slightly modify the code so that we get only the Temperature value:

Notice that there is the need to clean a bit the line before converting it to an integer.

Finally, you can implement your rules to covert the integer value to RGB color:

// Now let's countrol the led
int r = ( f1(temp, 20) * 5 ) % 255;
int g = ( f1(temp, 10) * 5) % 255;
int b = ( f2(temp, 5) * 5) % 255;


then add the RGB function to control the led:

void setRGBColor(int red, int green, int blue) {
  analogWrite(redPin, red);
  analogWrite(bluePin, blue);
  analogWrite(greenPin, green);

The functions f1,f2 are very simple:

int f1(int val, int threshold) {
  if (val < threshold)
    return 0;

  return val;

int f2(int val, int threshold) {
if (val < threshold)
  return abs(val);

return 0;

They are just a simple rules, of course, you can change them as you prefer.

All done!!

In this Internet of things project, we connected Arduino to Yahoo! Weather using Temboo chores. Arduino, with the information retrieved, controls RGB led.
What will you create using Temboo? Let me know…..

  • I have just heard about Temboo just now. Thank you, Francesco. If I understood it right, it could serve as a dashboard for everything IoT that you have. Interesting. But, what do you think of its security?

    • Well, it offers a set of choreos (you can think it as integration service) that can be used to integrate your board (like Arduino) with external services (like SMS, Push Notification, and so on). The security aspect is handled using something like application id and authentication.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.