Introduction: Intel Edison: Ambient Sensor (data to Cloud)

Picture of Intel Edison: Ambient Sensor (data to Cloud)

I was one of the proud winners to receive the Intel IoT development kit. This kit included an Intel Edison and a Grove Starter Kit Plus.

In this instructables, I will build a simple ambient sensor which will upload the data to the cloud. The Ambient sensor consists of three sensors: sound, temperature and light. The sensors send updates of their value to the cloud. The system can be powered off and back on without the need to reconfigure the cloud settings (device-id problem). It automatically sets the device-id to the your default one and restarts the service which is required to upload data.

If there are errors in this instructable or if you have suggestions, please contact me asap. If I made spelling/grammatical errors, please excuse me for this.

Step 1: Step 1: What You'll Need

Picture of Step 1: What You'll Need

Hardware:

Sensors:

  • Grove Starter Kit: Temperature sensor v1.1.
  • Grove Starter Kit: Sound sensor v1.4.
  • Grove Starter Kit: Light sensor v1.0.

Other:

  • Grove Starter Kit: Button v1.0.
  • Grove Starter Kit: LCD RGB Backlight v2.0.

Software:

This instructable assumes you've installed every other necessary software and flashed your Intel Edison. If this is not the case, please follow this link. The link leads to the Intel website were they explain it very well.

Step 2: Step 2: Configuring the Intel Edison

Picture of Step 2: Configuring the Intel Edison

Use your favorite terminal, I use putty like almost everyone else. Select "Serial". In the "Serial Line" text box enter the correct COM port which you can find using your device manager. Look for "Intel Edison Virtual Com Port (COMX)" the COMX is the COM port which you'll need to enter in the text box, for me it's COM4. In the "Speed" textbox enter "115200" this is the bit rate, 115200 bits/s.

Let's configure it, you don't need to reconfigure your device! Only do this if you want to be sure your device is configured the same as my device in this instructable:

  1. Hit the enter-key 2 times.
  2. Type root.
  3. Optional: enter your password if prompted.
  4. We'll start with a fresh config. Type reboot ota
  5. Type root.
  6. Type configure_edison --setup
  7. Optional: change the DeviceName of your device.
  8. Optional: set a Device Password for your device.
  9. Type Y, to configure your wifi
  10. The Intel Edison is scanning all the local wifi spots. This takes a few seconds.
  11. Type the number corresponding to your wifi network. Confirm by typing y.
  12. Enter the network password if prompted.
  13. The device will try to connect with your wifi network, if it's connected successful you'll get such a message: "Done. Please connect your laptop or PC to the same network as this device and go to http://192.168.0.186 or http://192.168.0.186 in your browser."
  14. Open your browser and type in the address bar the given address, in my example: 192.168.0.189 and check if it opens a webpage.

Above is the basic configuration which you already did when receiving your device. We'll continue with configuring the cloud part.

  1. First let's verify we can actually communicate with the cloud: type iotkit-admin test. This should give positive feedback. To which it's connected, the environment and build number.
  2. Now we need to know the Device ID. Type iotkit-admin device-id. This should give an ID that looks a bit like this XX-XX-XX-XX-XX-XX. One of the things I noticed is the device ID changes when the device is restarted. We'll fix this later on.
  3. Now let's go to to the IoT Analytics Dashboard. Login and add a new device. Type the Device ID in the "ID" box and also in the "gateway" box. Type the Device Name in the "name" box.
  4. Go to the "Account" tab, generate a new Activation Code if needed. Copy this code.
  5. Now go back to your terminal and type iotkit-admin activate Code. Replace Code with your personal Activation Code.

Your device is registered and activated to your account. Let's continue...

Step 3: Step 3: Register the Sensors

Picture of Step 3: Register the Sensors

Now it's time to register our sensors to our Intel Edison. I will not register them using a terminal. I'm going to register them in my Arduino code. I assume you have correctly installed the iotkit library, you should be able to view the examples. I'm using code lines from the IoTkitRegisterExample sketch.

First of all you can find all the possible components in your Catalog which you can find on your IoT Analytics Dashboard. There are standard three sensors already registered:

  • humidity humidity.v1.0
  • powerswitch powerswitch.v1.0
  • temperature temperature.v1.0

We're going to make two additional sensors: the sound and light sensor.

  1. Click on Add a New Catalog Item
  2. Give your sensor a name and type this in the Component Name box.
  3. Select a Type: Sensor or Actuator, in our case Sensor.
  4. Select a Data type, we can pick Number.
  5. Select a Format, pick Integer or Double if you want decimals (for example the temperature sensor).
  6. Select a Display, there's only one option so pick Timer Series.
  7. Type a Unit of measure, for examples Celcius.
  8. Optional: set min and max values.

You can review the sensors on the Catalog tabs. Or you can use the terminal and type iotkit-admin catalog this should bring up a table of all the sensors. Bellow you can find the IoTkitRegisterExample sketch. It's very well commented so read carefully and apply the changes. You'll have to replace YOUR_DEVICE_ID with your Device ID. Also, you'll have to replace the XXXXXXXX with your generated Activation code. Edit the register sensor part to meet your used sensors. Upload this modified sketch to your Arduino.

Step 4: Step 4: Final Code

Picture of Step 4: Final Code

Attach the Grove Starter Kit Base Shield to your Intel Edison. Attach the sensors, display, button using the cables to the Base Shield:

  • A0: Grove Starter Kit: Sound sensor v1.4.
  • A1: Grove Starter Kit: Temperature sensor v1.1.
  • A2: Grove Starter Kit: Light sensor v1.0.
  • D3: Grove Starter Kit: Button v1.0.
  • I2C: Grove Starter Kit: LCD RGB Backlight v2.0.

Bellow you can download the code. The code is actually composed of different examples which were shipped with Grove Starter Kit and the IoTkit library. Don't forget to replace YOUR_DEVICE_ID with your device ID.

The data is updated every 2 seconds. The button is used to switch between the different information on your LCD screen. I used a little "hack" to make sure my device ID doesn't change from the original by setting it to the original value used to register and activate my device.

If you've got any questions, PM me or comment bellow.

Comments

gau999 (author)2017-01-27

problem while installing iotkit library "at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Zip doesn't contain a library"

tomatoskins (author)2015-02-04

This is great and I'm excited to see more from you in the future.

glenntech (author)tomatoskins2015-02-04

Thank you very much. Actually, this is instructable is part of much bigger project which will include a Zybo board with linux flashed connected to EtherCat (Beckhoff protocol) and all of that connected to an OPC server so other PLCs can connect and use my data.

tomatoskins (author)glenntech2015-02-04

What are you wanting the end result to be?

glenntech (author)tomatoskins2015-02-05

Well, it's a project for college. They decided which features this project would have. But it hasn't got a practical goal. It's just to learn new skills and methods. However, the end result will be a set up which everyone can connect to and use the data which is acquired by the Intel Edison to visualise or control other appliances using a PLC. I know this could be made much easier and less expensive since the set up costs a few thousands of dollars.

tomatoskins (author)glenntech2015-02-05

That makes sense. I had a PLC class a few years ago. We mainly programmed SLC500's. Honestly, that class was one of my favorite classes I've ever taken.

About This Instructable

3,846views

20favorites

License:

More by glenntech:Intel Edison: Ambient Sensor (data to cloud)K'nex tin holder
Add instructable to: