loading

In This instructable you will learn how to take data from various sensors and log them on an SD Card, and then display the current temperature on a servo-driven analog style meter. Huge thanks to Intel, Instructables, and Grove for the giveaway!

You Will need:

Intel Edison

Grove Sound Sensor Module

Grove Light Sensor Module

Grove Temperature Sensor Module

Grove Shield

Grove Servo Motor

Micro-USB Cable

MicroSD Card

Step 1: Get Everything Ready

First, ensure that you have installed the Intel/Arduino programming environment. This can be found Here

Ensure that the plastic standoffs included with the Edison are mounted, to prevent shorting solder joints on the bottom of the board.

Step 2: Start Plugging in Components

In this project, I've used ports A0 for the Temperature Sensor, A1 for the Sound Sensor, A2 for the Light Sensor, and D5 for the servo Motor.

Step 3: Create and Plug in the Analog Style Meter

I have simply used cardboard and tape for this project, as I intend to use these parts in other projects. I cut a piece of cardboard with a slot to fit the servo motor vertically. I then plugged the servo motor into Digital 5. If you want, you can easily make the construction more permanent and sturdy by using different materials.

Step 4: Code!

Now, time for the Programming. If you choose to recreate this yourself, you will very likely need to tweak some of the values for this to work for you. The original .ino file is available below for download. I have also intended for the code to be modular, so you can take out bits and pieces to use in your own software if you would like.

#include
#include

#include<SPI.h> <br>#include <SD.h>
int a;
float tempcelsius;
int B=3975;                  //B value of the thermistor(Do Not Change!)
float resistance;
double tempfarenheit = 0;
Servo tempservo;
int temptoservo = 0;

Loop - The loop is the code which will run repeatedly

//Begin Temperature Code<br>  a=analogRead(0);
  resistance=(float)(1023-a)*10000/a; //get the resistance of the sensor;
  tempcelsius=1/(log(resistance/10000)/B+1/298.15)-273.15; //convert resistance to Celsius via datasheet ;
  tempfarenheit=((tempcelsius*9)/5)+31;   //OPTIONAL - Convert from Celsius to Farenheit
    //End Temperature Code

The temperature code shown here is from the Grove Temperature Sensor's Datasheet to determine temperature from the thermistor's resistance.

Data Logging Capabilities

//Begin SD Logging code<br>  File dataLog = SD.open("datalog.txt", FILE_WRITE);
  if (dataLog) {
    dataLog.print("Temp: ");
    dataLog.println(tempfarenheit);
    dataLog.print("Sound Level: ");
    dataLog.println(soundLevel);
    dataLog.print("Light Level: ");
    dataLog.println(lightLevel);
    delay(5000);
    dataLog.close()
    //End SD Logging Code

This code will dump the current sensor data to a .txt file every 5 seconds. You can change the wait time between dumps if you desire.

<p>What a cool gadget, and I love the DIY cardboard piece! Welcome to instructables!</p>

About This Instructable

973views

16favorites

License:

More by Divinecobra:Mini Bic Keychain Pen Analog-Style Temperature meter and DataLogger with Intel Edison 
Add instructable to: