Humidity and Temperature Sensor DHT11 on Intel Galileo


Para la versión en Español Haz Clic Aquí


Connecting a Humidity and Temperature Sensor to an Intel Galileo or Edison board is not as simple as one would like; but after looking into the right forums, it is not difficult either, took us 1 day to realize.

So here we share what we learned in the process (so far).

  1. The DHT11 is a very cheap and easy to find sensor. It has great precision and it is easy to utilize.
  2. We were able to prove to ourselves that instructions provided by DinoT_Intel in the forum work in an Intel Galileo GEN 1
  3. Basically we can download the three code files as we did in our most recent experiment in GITHUB) into one single folderwhere the Sketch resides; and it will work fine. You can also create a folder “DHT” in “~/Arduino_version/libraries/” and place the two files DHT.h y DHT.cpp there (but you’ll need to reload the IDE)
  4. Our tests worked in a Galileo GEN1 perfectly using an ARDUINO IDE version [arduino-1.5.3-Intel.1.0.4] that we downloaded here.
  5. IMPORTANT: Use 7ZIP to extract the arduino IDE from the file into c: … you can download 7ZIP here.

This time we were not able to make it work in an Edison; but we’ll tell you when we get to that point.

Special thanks to @spider_kenny for his contribution of knowledge about deterministic time devices and interfaces. I think it will be the foundation we’ll use to make it work in EDISON.

Dynamic calls to LINUX system from an ARDUINO sketch in Intel Edison – 10 minutes learning


Spanish Version Here

One of the many super-powers of Galileo and Edison platforms from Intel is the availablity of LINUX and the possibility of executing LINUX commands from an ARDUINO sketch.

In this recipe I am sharing how to make dynamic calls to LINUX from an ARDUINO sketch, concatenating values in an String object and then converting such object into a char array, needed to make system() calls.

The idea is to be able to concatenate system commands with sensor values and make calls to the LINUX OS to do something based on those values.

In summary:

  1. The system() function receives a char array parameter (not a String)
  2. Concatenation is very easy to do in String objects
  3. Conversion is made by creating a char array of the size of the command string plus one ending character.
  4. The sketch below is a modification of BLINK sample, that has a counter for how many times loop() function is executed.
  5. The function “dynamicCommand(c)” receives the value of the counter (it could be a sensor reading instead) and generates a command to LINUX system to do a folder listing into a file whose name is crafted based on the cunter value.


// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
int c = 0; //just a counter

// the setup routine runs once when you press reset:
void setup() {                
    // initialize the digital pin as an output.
    pinMode(led, OUTPUT);    

// the loop routine runs over and over again forever:
void loop() {
    c++; //un simple contador
    Serial.println("Count: ");  

//  Serial.println("Count: " + c); //This behaves weird...  
    if( c < 10){ 
    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);               // wait for a second
    Serial.println("Loop Complete!"); } 

void dynamicCommand(int counter){
     Serial.println("dynamicCommand function..."); 
     String command = "ls > resultFile";
     command += counter;
     command += ".log";
     Serial.println("Concatenated command looks like this:");
//UPDATE: THIS COULD BE ACHIEVED USING THE buffer propery of the String object
//     Serial.println("Converting to char array...");
//     int commandLength = command.length() + 1;
//     char commandCharArray [commandLength];
//     command.toCharArray(commandCharArray, commandLength);
//     Serial.println("Command array looks like this:");
//     Serial.println(commandCharArray);
//     Serial.println("Making system call...");
//     system(commandCharArray);