Intel® Edison | BrainHack();

Introduction: Intel® Edison | BrainHack();

About: Interested in Programming, Algorithms, Arduino, Intel Iot, edison, Music.. Google my name(Ramith Hettiarachchi) to get an idea about me... :) add me on linkedin

This project might be different from bunch of Instructables on the web as,

  1. This is a game between you & edison,
  2. This project needs only 2 main parts! (that is the Edison & the grove starter kit)
ohh yes I've named it as Intel Edison:: BrainHack();

How the Idea Came...

I created this C++ program for International Olympiad of Informatics Selection test problem.. (contestants had to make a bot to play against another program)
Finally thought of implementing on my Edison!

This is a Brain Game which can be played by two players. In this project the two players are YOU & Edison!

Oww yes, you have to play with an AI (kind of..) which plays optimally in each move, who is trying to beat you!

so here's a challenge by the Intel Edison,

Can You Beat Me? | -Intel Edison... 

In simple terms here's the game statement,

  1. There are n numbers in a line displayed on the LCD. (n is even).
  2. Two players (you & Edison) take turns to take a number from one of the ends of the line LCD Screen until there are no more numbers left.
  3. The player with the larger amount of numbers wins!

It sound's kinda simple right? see this video below to see it in action!

This project is for anyone who owns,

  1. Intel® Edison and Arduino Breakout Kit
  2. Grove* Starter Kit Plus—Intel® IoT Edition
  3. 8 LED's & Wires
  4. 9V battery (not compulsory)

So you're good to go!

After you complete this project you will,

  • Create an interesting game in which the other player makes the best possible move.
  • Create a C++ program which identifies user input & plays music too! (see you again, mama mia.. )

Note : website of this project

Step 1: An Outline of Our Project.

It's good to know what the process of creating this project looks like..

It's a plus point if you're,

  1. Having an Edison which is running the Latest Yocto Image
  2. Have tried out the blink program
  3. Already connected the Edison via wifi
  4. Familiar with the Eclipse* IDE (it's ok if you're not)
  • If you're new to Edison please check this awesome tutorial which will teach you the basics (flashing,connecting to wifi etc).
  • .
  • To make this instructable a simplified one I request you to follow this tutorial in order get a basic idea about the Eclipse* IDE.
  • (This guide explains how to install the Intel® IoT Developer Kit version of the Eclipse* IDE on a system with Windows*, Mac* OS X*, or Linux*.)

This project can be divided to following parts,

  • 1. Setting up the Eclipse* IDE. (explains how to create a basic project & copying my code)
  • 2. Connecting the base shield & sensors to the Edison.
    • Grove - LCD, Rotary Angle, Touch Sensor, Buzzer
  • 3. Running the Project without errors!

So as you know the framework of BrainHack(); it's time to start making!

note : All the video resources are located here

Step 2: Setting Up Eclipse* IDE

You can get the latest Eclipse* IDE version from here. I suggest you to read the official doc from intel on setting up eclipse.(believe me it's super easy) installing-the-eclipse-ide

after you've done that,

Launch Eclipse

  1. Once the file is extracted, navigate to the directory you created in the steps above:
  2. Double-click devkit-launcher.bat to launch Eclipse.

Now as you've opened eclipse,goto,

File-> New -> Intel(R) IoT C/C++ Project (see figure 1)

so you get a dialog box where you can type the project name, in my case I named it "intel-Edison-brainhack"

select Empty C++ Project from the projects tab, then click -> Next (see figure 2)

The Dialog box you will get next is "Create a target connection".

here you have to specify the ip address of your Edison (which is on the same wifi network)

to do so, you can either "search for target" or manually enter it's ip (if you already know it)

(If you don't have a wifi network at home,you can create a hotspot from your android phone & connect your computer & Edison to that network so both of them are in the same network)

After you've done that you will get a blank c++ program. (see figure 5).

congrats! now you have your Edison communicating with eclipse & it's ready to code!

Step 3: Copying the Original Code

The next step is to copy my code to your blank c++ project,

to do so please navigate to my GitHub and download copy this code & paste it to your blank intel IoT c++ project

Now compile it using Project-> Build All

Don't worry there should be errors, it's because you have just copied the code.

View Larger

It's necessary to include the libraries manually
so you need to select the tab "IoT sensor Support"

the you have to tick the relevant libraries you need,

  • Jhd1313m1.h

  • GroveButton

  • Grove.h

here are the screenshots on how I added those libraries...




So now you must be error free...

to view all the screens I came across check this link

Step 4: Connecting Stuff to the Edison

Now you need to connect Grove Base shield to the Edison,

after that you must connect the following to the base shield

  • LCD-> I2C
  • Rotary Angle -> A1
  • Touch Sensor -> D2
  • Buzzer -> D5

you need to connect 8 LEDs to the Edison.

led positions (from left to right) ={4,6,7,8,9,10,11,12}

Starting from Digital Pin 4 (omitting pin5 as we are using it for the buzzer) to Digital Pin 12 you need to connect the + part of the LED, and the other to GND.

  • Positioning the LED's from left to right is [important] ( place those along the Grove LCD as shown in the picture below)

Please see above video to see how I explain!

The grove touch doesn't look like a touch in the pic above :/ I couldn't find that part in I showed it as a Grove Button :)

Step 5: Run the Program

You should have connected the Edison to the same wifi as your pc as connected to, then click the run button.

  1. After a couple of seconds on the LCD screen a sample problem will be displayed.
  2. Now use the rotary angle to specify left or right. (turn clockwise to select 'Right' & anti-clockwise for 'Left')
  3. then touch the touch sensor to confirm, You'll hear a beap.
  4. At the same time the Edison's move will be displayed.

continue until all the numbers are taken...

See the video in action!

I've included two videos, one I won & the other Edison won :)

Step 6: Final Thoughts.

I hope y'all were able to create your own Brainhack();

Please express your thoughts in comments below, it will help me to create more instructables in the future.
This was my 1st instructable :) so I'm excited about it!

Hope y'all could understand the steps without any trouble. If you encountered any problem at any step please let me know..

I had the intention of making this game more attractive but due to lack of time I couldn't make it *that* good sorry for that :/

Ideas to implement in future.

if you need to start this game as soon as the Edison boots up, you'll need to make a startup script. & it would be great if it had a button to restart the game. :)

This project can be made more compact if we used SparkFun Block for Intel® Edison - OLED, and we can add some animations too.. unfortunately I didn't have any of the sparkfun blocks, so ended up doing this with the Grove Kit.

Good Luck!

Intel® IoT Invitational

Participated in the
Intel® IoT Invitational

Be the First to Share


    • Big and Small Contest

      Big and Small Contest
    • For the Home Contest

      For the Home Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge



    7 years ago

    Congrats on sharing your first instructable! Very ambitious, I like the idea. Good luck in the intel contest :)


    Reply 7 years ago