Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.
This robot arm application is part of a series of how-to Intel® IoT Technology code sample exercises using the Intel® IoT Developer Kit, Intel® Edison board, cloud platforms, APIs, and other technologies.
From this exercise, developers will learn how to:
- Connect the Intel® Edison board, which is a computing platform designed for prototyping and producing IoT and wearable computing products.
- Interface with the Intel® Edison board IO and sensor repository using MRAA and UPM from the Intel® IoT Developer Kit, a complete hardware and software solution to help developers explore the IoT and implement innovative projects.
- Run these code samples in the Intel® System Studio IoT Edition (Eclipse* IDE for C/C++ and Java* development) for creating applications that interact with sensors and actuators, enabling a quick start for developing software for the Intel® Edison or Intel® Galileo board.
- Set up a web application server to control a robot arm using a web page served up directly from the Intel® Edison board.
What it is
Using an Intel® Edison board, this project lets you create a robot arm that:
- continuously checks the Grove* Joystick;
- moves 2 stepper motors, based on the control of the joystick;
- can be accessed via a built-in web interface to control the motors;
How it works
This example allows you to control a robotic arm using a thumb joystick. Each axis of the joystick corresponds to a motor to control.
Additionally, the motors can be controlled individually via a web page served up directly from the Intel® Edison board.
Grove* Robotics Kit containing:
- Intel® Edison board with an Arduino* breakout board
- Grove* Base Shield V2
- Grove* Thumb Joystick
- Stepper Motor Controller & Stepper Motor (x2)
- Intel® System Studio IoT Edition (Eclipse* IDE for C/C++ and Java* development)
How to set up
To begin, clone the How-To Intel® IoT Technology code samples repository with Git* on your computer as follows:
$ git clone https:
Want to download a .zip file? In your web browser, go to https://github.com/intel-iot-devkit/how-to-code-samples and click the Download ZIP button at the lower right. Once the .zip file is downloaded, uncompress it, and then use the files in the directory for this example.
Adding the program to Eclipse*
In Eclipse*, select Import Wizard to import an existing project into the workspace as follows:
- From the main menu, select File > Import.
- The Import Wizard dialog box opens. Select General > Existing Project into Workspace and click Next.
- Click Select root directory and then the associated Browse button to locate the directory that contains the project files.
- Under Projects, select the directory with the project files you'd like to import and click OK and then Finish to import the files into Eclipse*.
- Your main .cpp program is now displayed in your workspace under the src folder.
Connecting the Grove* sensors
You need to have a Grove* Base Shield V2 connected to the Arduino*-compatible breakout board to plug all the Grove* devices into the Grove* Base Shield V2. Make sure you have the tiny VCC switch on the Grove* Base Shield V2 set to 5V.
You need to power the Intel® Edison board with the external power adapter that comes with your starter kit, or substitute an external 12V 1.5A power supply. You can also use an external battery, such as a 5V USB battery.
In addition, you need a breadboard and an extra 5V power supply to provide power to both the motors. Note: you need a separate battery or power supply for the motors. You cannot use the same power supply for both the Intel® Edison board and the motors, so you need either 2 batteries or 2 power supplies in total.
- Plug each of the stepper motor controllers into 4 pins on the Arduino* breakout board, for it to be able to be controlled. Connect stepper motor controller #1 to pins 4, 5, 6, and 7, and stepper motor controller #2 to pins 8, 9, 10, and 11. Connect both the controllers to ground (GND), to the 5V power coming from the Arduino* breakout board (VCC), and to the separate 5V power for the motors (VM).
- Plug one end of a Grove* cable into the Grove* Joystick, and connect the other end to the A0 port on the Grove* Base Shield V2.
Intel® Edison board setup
This example uses the Crow* web micro-framework to provide a simple-to-use, yet powerful web server. The Crow* library requires the libboost package be installed on the Intel® Edison board, as well as adding the needed include and lib files to the Eclipse* Cross G++ Compiler and Cross G++ Linker.
Update opkg base feeds so you can install the needed dependencies. Establish an SSH connection to the Intel® Edison board and run the following command:
Edit the file so that it contains the following:
src/gz all http:
src/gz edison http:
src/gz core2-32 http:
Save the file by pressing Esc, then :, then q, and Enter.
This only needs to be done once per Intel® Edison board, so if you've already done it, you can skip to the next step.
Install the boost libraries onto the Intel® Edison board by running the following command:
opkg install boost-dev
Copy the libraries
You need to copy the libraries and include files from the board to your computer where you're running Eclipse* so the Cross G++ Compiler and Cross G++ Linker can find them. The easiest way to do this is by running the
scp command from your computer (NOT the Intel® Edison board), as follows:
scp -r USERNAME@xxx.xxx.x.xxx:/usr/include/boost ~/Downloads/iotdk-ide-linux/devkit-x86/sysroots/i586-poky-linux/usr/include
scp USERNAME@xxx.xxx.x.xxx:/usr/lib/libboost* ~/Downloads/iotdk-ide-linux/devkit-x86/sysroots/i586-poky-linux/usr/lib
USERNAME@xxx.xxx.x.xxx to match whatever username and IP address you set your board to.
~/Downloads/iotdk-ide-linux to match the location on your computer where you installed the Intel® IoT Developer Kit.
Copy the libraries on Windows*
We have a helpful link to get this set up here:
Note: you need to turn SSH on by running the
configure_edison --password command on the board. Once you set the password, make sure you write it down. You only need to do this one time and it is set when you reboot the Intel® Edison board.
Connecting your Intel® Edison board to Eclipse*
- In the bottom left corner, right-click anywhere on the Target SSH Connections tab and select New > Connection.
- The Intel® IoT Target Connection window appears. In the Filter field, type the name of your board.
- In the Select one of the found connections list, select your device name and click OK.
- On the Target SSH Connections tab, right-click your device and select Connect.
If prompted for the username and password, the username is root and the password is whatever you specified when configuring the Intel® Edison board.
Running the code on the Intel® Edison board
When you're ready to run the example, click Run at the top menu bar in Eclipse*.
This compiles the program using the Cross G++ Compiler, links it using the Cross G++ Linker, transfers the binary to the Intel® Edison board, and then executes it on the board itself.
After running the program, you should see output similar to the one in the image below.
Regenerating HTML and CSS
If you make any changes to either the index.html or styles.css file, you need to regenerate the .hex file used to serve up the assets via the built-in Crow* web server. We have a useful tutorial on how to use the shell script here:
Controlling the robot arm via a web browser
The robot arm is controlled using a single-page web interface served directly from the Intel® Edison board while the sample program is running.
The web server runs on port
3000, so if the Intel® Edison board is connected to Wi-Fi* on
192.168.1.13, the address to browse to if you are on the same network is
For a complete list of the 18 How-To Intel® IoT Technology code samples in C++, go to this Intel® Developer Zone blog post 18 How-To Intel® IoT Technology Code Samples Now Available in C++.
For more details about this code sample, go to GitHub*.