First Look – Intel Edison and Grove Starter Kit

Hello World!

In an attempt to learn something that I can connect with a new crowd on, I’ve decided to pick up embedded systems, IoT, Robotics, whatever the cool kids are calling it these days.  So I called up my buddies over at Intel and asked if they could ship me something useful.  Boy did they ship me something fun!  This article is all about playing with the Grove Starter Kit and Intel Edison + Arduino Board.

Unpacking your Edison.

I could write an article about this, but my good friend, Jeremy Foster, already has done so.  I highly suggest you read his article on setting up the Intel Edison, he does a phenomenal job.

Setting up the Edison

Start Writing JavaScript

(Optional)Using Visual Studio + Edison

Onto the Grove Kit

This kit has a little bit of everything.  Most of the tutorials walk through how to use individual sensors or modules, I really wanted to showcase how to use multiple together.

Wiring it up

Start with the Edison disconnected from power, and then add the module board.  Like pictured below:


Ensure that the tiny black switch is flipped from 3v3_vcc to 5V (pictured below)


On the dev board, you will notice items labeled

“Ax”: These are analog slots – anything that provides back essentially continuous data (ie 3.1415….) (x refers to pin)

“Dx”: These are digital slots – anything that can be dealt with in 1s and 0s. (x refers to pin)

“I2C”: Inter-Integrated Circuit, or simply look at the protocol your device requires and plug it here if needed.  More complex devices use this.

“UART”: Universal Asynchronous Receiver Transmitter, same sort of thing. More complex devices use this.

We will only be using the Servo, Screen, Button and Touch Sensor in this example.

Wire up the device such that:

Screen: I2C slot closest to the power LED

Regular Button: D2

Servo: D3

TouchButton: D4

Rotary Angle Sensor: A0

Barrel Power: into power slot

There are known issues with D7 in regards to interfering with wifi.  There also appears to be an issue plugging the servo into D3.


Onto the Code:

//make sure we have cylon as a dependency
var Cylon = require("cylon");
//create a more general function for writing to the screen
function writeToScreen(screen, message)
    screen.setCursor(0, 0);
//Define the robot
Cylon.robot({ name: 'HelloEdison' })
    //setup connection
    .connection('edison', { adaptor: 'intel-iot' })
    //define devices connected to device
    .device('led', { driver: 'led', pin: 13 })
    .device('touchButton', { driver: 'button', pin: 4, connection: 'edison' })
    .device('button', { driver: 'button', pin: 2, connection: 'edison' })
    .device('screen', { driver: 'upm-jhd1313m1', connection: 'edison' })
    .device('servo', { driver: 'servo', pin: 3, connection: 'edison' })
    .device('rotary', { driver: 'analogSensor', pin: 0, connection: 'edison', lowerLimit: 1, upperLimit: 179 })
    //kick off the robot...
    .on('ready', function (robo) {
        //every second blink the LED on the arduino board
        //"Hello IoT"
        every((1).second(), function () {
        //When you touch and hold the button, it prints this to the screen.
        robo.touchButton.on('push', function () {
            writeToScreen(robo.screen, "Release to Ask Azure...");
        //when you release, bring in request module and 
        //make a get request to an azure hosted web service
        //print result to screen.
        robo.touchButton.on('release', function () {
            var request = require("request");
            request("", function (error, response, body) {
                writeToScreen(robo.screen, body);
        //When push normal button print to screen.
        robo.button.on('push', function () {
            writeToScreen(robo.screen, "Ouch!");
        //every .05 seconds check state of rotary sensor, adjust 
        //servo angle to align with sensor angle
        every((.05).second(), function () {
            //rotary goes from 0 to 1023, normalize by dividing by ~5.6
            var nAngle = parseInt(robo.rotary.analogRead() / 5.6);
            //what is the difference between the current angle and the proposed new angle?
            var aDelta = nAngle - robo.servo.currentAngle();
            //is the angle difference greater than 7?
            if (aDelta > 7 || aDelta < -7 
                //Servos can't go below 0 or over 180,
                //lets give a 5 degree buffer for safety
                && nAngle > 5 && aDelta < 175) {
                //set the angle of the servo to the new one


To deploy this to your Edison:

Open a command prompt, navigate to the directory that holds this javascript file.  Execute the command “scp YOURFILENAME.js root@YOURDEVICEIPADDRESS:/home/root/YOURDIRECTORY

To execute this code on your Edison:

Open a command prompt, execute the command: ssh root@YOURDEVICEIPADDRESS

enter your password.  Navigate to the location where your file is (ls to list files and directories, cd to change directories)  Type: node yourfilename.js

if files are missing

type npm install -g MISSINGPACKAGENAME

Known Issues:

If you touch the touchSensor, release and then start playing with the servo, it will crash.  There is not enough power being supplied to the board for all of these items.  The next article will be about using Relays to add more power so you can have multiple servos being controlled by low powered logic as we have here.


So that’s a taste of IoT and getting a few sensors on a board and working together to do a few interesting things.  We will just keep getting more and more advanced with it.

Leave a Reply

Your email address will not be published. Required fields are marked *