IoT Reference Implementation: How to Build a Transportation in a Box Solution

Published Date
18 - Jan - 2017
| Last Updated
19 - Jan - 2017
 
IoT Reference Implementation: How to Build a Transportation in a...

The Transportation in a Box solution is based on a previous IoT path-to-product connected transportation solution, which involved a comprehensive development process that began from ideation and prototyping, through productization. Taking advantage of that prior work, which was demonstrated at Intel® Developer Forum 2016, the Transportation in a Box solution demonstrates how path-to-product solutions can provide a point of departure that streamlines the development of IoT solutions. To read the full IoT Path-to-Product Transportation Case Study, check out The Making of a Connected Transportation Solution.

An Intel team based in Europe began work on the Transportation in a Box solution after identifying value in creating a variation on the existing path-to-product connected-transportation solution that was better suited to use at workshops, conferences and other industry events. The team’s goal was to build a variation that was functionally similar to the scale truck model used in the previous solution, but built to fit into a compact carrying case. The two solutions are shown side-by-side in Figure 1.

Figure 1. The connected-transportation model compared to the Transportation in a Box solution.

The exercise in this document describes how to recreate the Transportation in a Box solution. It does not require special equipment or deep expertise, and it is meant to demonstrate how IoT path-to-product solutions can be adapted to the needs of specific project teams.

Introduction

The Transportation in a Box solution was developed using an Intel® IoT Gateway, the Grove* IoT Commercial Developer Kit, and the Intel® System Studio IoT Edition. It monitors the temperature within a truck’s refrigerated cargo area, as well as the open or closed status of the cargo doors. The gateway generates events based on changes to those statuses, to support end-user functionality on a tablet PC application.

From this exercise, developers will learn to do the following:

  • Set up the Dell iSeries* Wyse 3290 IoT Gateway, including installation of the OS, update of the MRAA* and UPM* libraries, and connection of the Arduino 101* (branded Genuino 101* outside the U.S.) board for connectivity to sensors.
  • Install the rest of the solution, including connection of sensors and other components, as well as cloning of the project software repository.
  • Add the program to Intel® System Studio IoT Edition, including creating a project and populating it with the files needed to build the solution.
  • Run the solution using the Eclipse* IDE or directly on the target platform.

What the Solution Does

The Transportation in a Box solution simulates the following parts of a transportation monitoring solution:
 

  • Door: The driver is notified of a change in door position (open or closed).
  • Thermometer: The inside temperature of the truck’s cargo area is monitored and that temperature data recorded.
  • Alarm: For temperatures above a specified threshold, the user interface plays an audible alarm. The alarm is cancelled by pressing the push button or when the temperature returns to normal (temperature below the specified threshold).
  • Cooling fan: The fan cools the truck’s cargo. The cooling fan is connected to the door and when the door is open, the fan shuts off (allowing the temperature to rise). Similarly, when the door is closed, the fan is on (in order to keep the cargo area of the truck below the specified temperature threshold).
  • Display: Displays the status of the system, temperature and door status.

How it Works

The solution operates based on sensor data that includes the open/closed status of the truck door, the temperature of the truck interior, and a number of events, including open and close actions of the door, changes in temperature, changes to settings in the temperature threshold, and trigger/stop events for the alarm. All data is forwarded to a web interface that can be used to monitor the status of the truck.

Set up the Dell iSeries* Wyse 3290 IoT Gateway

This section gives instructions for installing the Intel® IoT Gateway Software Suite on the Dell iSeries Wyse 3290 gateway.

Note: If you are on an Intel network, you need to set up a proxy server.

1. Create an account on the Intel® IoT Platform Marketplace if you do not already have one.
2. Order the Intel® IoT Gateway Software Suite, and then follow the instructions you will receive by email to download the image file.
3. Unzip the archive, and then write the .img file to a 4 GB USB drive:

  • On Microsoft Windows*, you can use a tool like Win32 Disk Imager*:https://sourceforge.net/projects/win32diskimager.
  • On Linux*, use sudo dd if=GatewayOS.img of=/dev/ sdX bs=4M; sync, wheresdX is your USB drive.

4. Unplug the USB drive from your system, and then plug it into the Dell iSeries* Wyse 3290 gateway along with a monitor, keyboard, and power cable.
5. Turn on the Dell iSeries Wyse 3290 Gateway, and then enter the BIOS by pressing F2 at boot time.
6. Boot from the USB drive:

1. On the Advanced tab, make sure Boot from USB is enabled.
2. On the Boot tab, put the USB drive first in the order of the boot devices.
3. Save the changes, and then reboot the system.

7. Log in to the system with root:root.
8. Install Wind River Linux* on local storage:
~# deploytool -d /dev/mmcblk0 --lvm 0 --reset-media -F

9. Use the poweroff command to shut down your gateway, unplug the USB drive, and then turn your gateway back on to boot from the local storage device.
10. Plug in an Ethernet cable, and then use the ifconfig eth0 command to find the IP address assigned to your gateway (assuming you have a proper network setup).
11. Use the Intel® IoT Gateway Developer Hub to update the MRAA* and UPM* repositories to the latest versions from the official repository (https://01.org). You can achieve the same result by entering the following commands:

~# smart update
~# smart upgrade
~# smart install upm
12. Connect the Arduino 101* board using the USB cable.
13. Connect the Omega* RH-USB Temperature sensor to a USB port.

Install the Rest of the Solution 

This section gives instructions for the rest of the installation required for the solution, including connection of sensors and other components, as well as cloning of the project software repository.

1. Connect the sensors and other components to the Dell iSeries Wyse 3290 IoT Gateway according to the connectivity schema that is provided in the bill of materials in Table 1.

Table 1. Bill of materials and connectivity schema for the Transportation in a Box solution.

2. Clone the Path to Product repository with Git* on your computer as follows:
$ git clone https://github.com/intel-iot-devkit/reference-implementations.git

3. To download a .zip file, in your web browser go to 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.

Add the Program to Intel® System Studio IoT Edition

Note: The screenshots in this section are from the alarm clock sample; however, the technique for adding the program is the same, just with different source files and jars.

1. Open Intel® System Studio IoT Edition. It will start by asking for a workspace directory; choose one and then click OK.
2. In Intel® System Studio IoT Edition, select File | New | Intel® IoT Java Project, as shown in Figure 2.

Figure 2. New Intel® IoT Java* Project.

3. Give the project the name “Transportation Demo” as shown in Figure 3 and then click Next.

Figure 3. Naming the Intel® IoT project.

4. Connect to the gateway from your computer to send code to it by choosing a name for the connection, entering the IP address of the gateway in the Target Name field, and clicking Finish, as shown in Figure 4.

Note: You can also search for the gateway using the "Search Target" button. Click finish when you are done.

Figure 4. Creating a target connection.

5. The preceding steps will have created an empty project. Copy the source files and the config file to the project:

  • Drag all of the files from the git repository's src folder into the new project's src folder in Intel® System Studio IoT Edition.
  • Make sure previously auto-generated main class is overridden.

6. The project uses the following external jars: commons-cli-1.3.1.jar, tomcat-embed-core.jar, andtomcat-embed-logging-juli. These can be found in the Maven Central Repository. Create a "jars" folder in the project's root directory, and copy all needed jars in this folder. In Intel® System Studio IoT Edition, select all jar files in the jars folder, right-click them, and select Build path | Add to build path, as shown in Figure 5.

Figure 5. Adding project jars to the build path.

7. Add the UPM* jar files relevant to this specific sample, as illustrated in Figure 6:

1. Right click on the project's root and select Build path | Configure build path.
2. Select Java Build Path.
3. Select the Libraries tab.
4. Click the Add external JARs... button.
5. Add the following jars, which can be found at the IOT Devkit installation root path\iss-iot-win\devkit-x86\sysroots\i586-poky-linux\usr\lib\java:

  • upm_grove.jar
  • upm_i2clcd.jar
  • upm_rhusb.jar
  • mraa.jar

Figure 6. Adding external jars to the build path.

8. Copy the www folder to the home directory on the target platform using scp or WinSCP*. Create a new Run configuration in Eclipse* for the project for the Java* application. Set the Main Class ascom.intel.pathtoproduct.JavaONEDemoMulti in the Main tab. Then, in the arguments tab enter the following:
-webapp <path/to/www/folder>

Note: To run without an IDE, download the repo directly to the target platform and run the start.sh script.

For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone

Source:https://software.intel.com/en-us/articles/iot-reference-implementation-how-to-build-a-transportation-in-a-box-solution