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 range finder scanner application is part of a series of how-to Internet of Things (IoT) code sample exercises using the Intel® IoT Developer Kit, Intel® Edison board, Intel® IoT Gateway, cloud platforms, APIs, and other technologies.
From this exercise, developers will learn how to:
- Connect the Intel® Edison board or Intel® IoT Gateway, computing platforms designed for prototyping and producing IoT and wearable computing products.
- Interface with the Intel® Edison board or Arduino 101* (branded Genuino 101* outside the U.S.) 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 board or the Intel® Galileo board.
- Set up a web application server to view range finder data using a web page served up directly from the Intel® Edison board or Intel® IoT Gateway.
What It Is
Using an Intel® Edison board or Intel® IoT Gateway, this project lets you create a range finding scanner that:
- continuously checks the Grove* IR Distance Interrupter.
- moves the stepper motor in a 360-degree circle.
- can be accessed via a built-in web interface to view range finder data.
How It Works
As the stepper motor turns, it pauses to get readings from the Grove* IR Distance Interrupter.
These readings can be viewed on a web page served up directly from the Intel® Edison board or Intel® IoT Gateway.
Grove* Robotics Kit containing:
- Intel® Edison board with an Arduino* breakout board or Intel® IoT Gateway with Arduino 101* (branded Genuino 101* outside the U.S.) board.
- Grove Base Shield V2
- Grove IR Distance Interrupter
- Stepper Motor Controller & Stepper Motor
How to set up
This sample is already one of the IoT examples included in Intel® System Studio. To start using it, follow these steps:
- From the main menu, select Intel® IoT > Import IoT Examples.
- Expand the tree view for C++ > How To Code Samples > Range Finder Scanner and click Import Example.
- Select your developer board from the selection window then select Next.
- Select Intel® IoT C/C++ project from the Select a project type window then click Next.
- Select Yocto from the Selct target OS dropdown menu then click Next.
- The next tab will ask for connection name and target name. If you do not know these click Search Target.
- Select your Edison from the dropdown list. Select OK.
- Your connection name and target name should be filled in. Select Finish.
- A new window will open for you and you will need to choose a name for your project and click Next.
- Your project source files will now be available on the on the upper left of your IDE by default.
Connecting the Grove* sensors
You need to have a Grove* Base Shield V2 connected to an Arduino 101* (branded Genuino 101* outside the U.S.) board 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 or Arduino 101* (branded Genuino 101* outside the U.S.) 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 the stepper motor.
Note: You need a separate battery or power supply for the motor. You cannot use the same power supply for both the Intel® Edison board and the motor, so you need either 2 batteries or 2 power supplies in total.
- Plug the stepper motor controller into four pins (9, 10, 11, and 12) on the Arduino* breakout board. It also must be connected to ground (GND), to the 5V power coming from the Arduino* breakout board (VCC), and to the separate 5V power for the motor (VM).
- Plug one end of a Grove* cable into the Grove* IR Distance Interrupter, and connect the other end to the D2 port on the Grove* Base Shield V2.
Connecting your Intel® Edison board or Intel® IoT Gateway to Intel® System Studio
If prompted for the username and password, the username is root and the password is whatever you specified when configuring the Intel® Edison board.
Intel® IoT Gateway setup
You can run this example using an Intel® IoT Gateway connected to an Arduino 101* (branded Genuino 101* outside the U.S.) board.
Make sure your Intel® IoT Gateway is setup, by following the directions on the web site here:
The Arduino 101* (branded Genuino 101* outside the U.S.) board needs to have the Firmata* firmware installed. If you have IMRAA installed on your gateway, this will be done automatically. Otherwise, install the StandardFirmata or ConfigurableFirmata sketch manually onto your Arduino 101* (branded Genuino 101* outside the U.S.) board.
Running the code on the Intel® Edison board or Intel® IoT Gateway
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.
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. For help using the shell script, go to this link:
Viewing the range finder data
The web server runs on port
3000, so if the Intel® Edison board or Intel® IoT Gateway is connected to Wi-Fi on
192.168.1.13, the address to browse to if you are on the same network is
IMPORTANT NOTICE: This software is sample software. It is not designed or intended for use in any medical, life-saving or life-sustaining systems, transportation systems, nuclear systems, or for any other mission-critical application in which the failure of the system could lead to critical injury or death. The software may not be fully tested and may contain bugs or errors; it may not be intended or suitable for commercial release. No regulatory approvals for the software have been obtained, and therefore software may not be certified for use in certain countries or environments.