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.
To demonstrate a rapid path-to-product IoT solution for retail using cloud data analytics, a proof of concept was created using the Intel® IoT Developer Kit and Grove* IoT Commercial Developer Kit that was scaled to an industrial solution using an Intel® IoT Gateway, industrial sensors, Intel® IoT Gateway Software Suite, Intel® System Studio, and Microsoft* Azure* cloud services. This solution monitors the inventory, product sales, and maintenance of a vending machine. The gateway gathers data from temperature sensors, stepper motors, a coil switch, and a product-purchasing application for edge data analytics.
This article contains an overview of the creation of the Intelligent Vending Machine Prototype. For a how to, see IoT Path-to-Product: How to Build an Intelligent Vending Machine.
Visit GitHub for this project's latest code samples and documentation.
A key vector of opportunity related to the Internet of Things (IoT) springs from adding intelligence to everyday devices, as a means to improve their operation as well as the efficiency and effectiveness of the business operations associated with them. For example, vending machines are ubiquitous, and the familiar, common machines with coin or currency acceptors represent a significant potential revenue stream for retailers of various types. It’s no wonder that the scope of goods available in vending machines has grown dramatically in recent years, including consumer electronics being commonly sold in airports and other facilities.
Figure 1. Completed intelligent vending machine.
Vending machines have the advantage over other retail points of presence that they operate 24 hours per day, 365 days per year, without the requirement for human cashiers. They also give distributors significant control where it would otherwise not be possible, such as in public spaces and office buildings. At the same time, however, vending machines require regular service: frequently to replenish the product being sold and less frequently for scheduled and unscheduled maintenance.
Giving the owners of vending machines greater insight into the status of each unit in their vending fleet has the potential to improve the efficiency of that service effort. Intel® undertook a development project to investigate this and other opportunities associated with building an intelligent vending machine. The completed device is shown in Figure 1. This project drew inspiration in large part from the existing solution blueprint for intelligent vending machines from Intel and ADLINK Technologies. This document recounts the course of that project development effort. It begins with an abstract description of a structured project methodology, divided into phases, and then recounts the process of the project’s development in detail, phase by phase.
Interested parties can use this narrative to retrace the steps taken by the Intel® project team in developing the intelligent vending machine. Perhaps more importantly, however, it can be generalized as a set of guidelines to address the needs of other types of projects. Intel® makes this document freely available and encourages the use of this methodology and process to drive inquiry, invention, and innovation for the Internet of Things.
By its nature, IoT embraces open-ended innovation, with endless diversity of projects to add intelligence to objects from the simple to the complex, and from the mundane to the exotic. At the same time, every project builds on experience the industry has gained from IoT projects that have gone before, and best practices suggest structural elements in common among IoT projects in general.
To take advantage of those commonalities and help increase the chances of success during development, Intel has developed a structured approach to IoT project development. It consists of a six-phase model that guides the entire path to product, which begins with the first glimmer of an idea and follows through until the final solution is in commercial use. It is intended to be general enough that it can be adapted to the needs of any IoT project.
Initiation phases (1-3)
The first three phases of the project methodology are investigative. They focus on ideation and assessing the potential of the project to solve a given problem, in preparation for ultimately leading to a commercially viable product. As such, these phases value brainstorming and proof of concept over rigorously addressing finer points of design.
Rapid prototyping is facilitated by using the Grove* IoT Commercial Developer Kit, which consists of an Intel® NUC system, Intel® IoT Gateway Software Suite, and the Grove* Starter Kit Plus (manufactured by Seeed). The project also uses the Arduino* 101 board.
Note: Known in the United States as "Arduino 101," this board is known elsewhere as "Genuino* 101." It is referred to throughout the rest of this document as the "Arduino 101" board.
- Phase 1:Define the opportunity that the project will take advantage of. The first step of an IoT project is to identify the problem or opportunity that the project will address. Documentation at this stage should identify the opportunity itself, the value of the solution (to end users as well as the organizations that build and implement it), and limitations of the project concept, including design challenges and constraints.
- Phase 2: Design a proof of concept to take advantage of the opportunity. The initial solution design proposes a practical approach to building the solution, including hardware, software, and network elements. The design must address the design challenges and constraints identified in Phase 1 to the extent that is possible before building a prototype, including due consideration of factors such as cost and security.
- Phase 3: Build and refine the proof of concept. The solution prototype is based on the design established in Phase 2, making and documenting changes as needed. Design changes based on shortcomings and additional opportunities identified during testing should be documented as part of this phase.
Completion phases (4-6)
The last three phases of the project methodology proceed only after the decision has been made to go forward with productizing the solution. As such, these phases are explicitly concerned with hardening the solution in terms of stability, security, and manageability, preparing it for mass production, and monetizing it to realize its commercial potential.
The completion phases of the project involve shifting the solution to industrial-grade sensors and related components, building it out using a commercial-grade gateway, and finalizing the feature set.
- Phase 4: Produce a solid beta version. Once the project has been approved as a viable solution to develop toward production, the next step is to produce a product-oriented version that is explicitly intended to finalize the design. This version represents a significant investment in resources, including commercial-grade sensors and other components, as well as a commercial IoT gateway.
- Phase 5: Evaluate functionality and add features. The completed beta version of the solution is tested to verify that it functions correctly according to the design parameters. As part of the testing process, the project team also identifies additional features and functionality and incorporates them into the solution to make it more robust and valuable to end users.
- Phase 6: Finalize design and move into production. Once the product is feature-complete, the team hardens the solution by adding advanced manageability and security features, as well as optimizing the design as needed to enhance factors such as marketability and efficiency of manufacturing. The production user interface (UI) for the solution is finalized. This phase also includes final planning for merchandising and marketing the solution before moving into full production.
Phase 1: Defining the opportunity
While traditional vending machines represent lucrative revenue streams, they are woefully inefficient. Each machine must be serviced on a regular basis by a human attendant to replenish the machine’s stock of product. This task is typically handled by assigning machines to regular routes that are followed by personnel in trucks.
To understand the inherent inefficiency in this approach, consider the activity along a route that includes a high-rise office building. Here, the attendant pulls up in front of the building and has the choice either to guess what will be needed in the machines up on the 15th and 20th floors, bring the product up, and then make another round trip to bring the rest of what was needed, or else to make a dedicated inventory trip with a notepad in hand. Either approach takes needless time and effort that costs the vending company money.
Moreover, distributors must seek a balance between dispatching too many trips by attendants (wasting payroll hours) or too few (leaving machines depleted of stock and missing out on revenue). The situation becomes even more problematic because the distributor must depend to some degree on end-customers to report when a machine is out of order.
Project initiators at Intel® determined that an intelligent vending machine is viable as the basis for a potential project to demonstrate IoT capabilities and the project methodology described in this document. That core group identified skill sets that were likely to be required during the project, including project management, programming, cloud architecture, and documentation. Based on that list of required skills, the core group formed the full project team, with personnel on the project mostly drawn from Intel employees, with external personnel included in a small number of instances to round out the expertise of the team.
The full project team’s first order of business was to quantify the potential opportunity associated with the project, as the basis for the initial prototype design. The core opportunity for this use case was identified as enabling a vending machine to intelligently monitor its level of product inventory and its operational status, and to be able to report that information back through an IoT gateway to the cloud.
The team elected to integrate cloud resources for the data store and administrative functionality. The goal of this approach was to facilitate a fully connected and scalable solution that optimize operations using an overall view of a fleet of vending machines. The key value to the cloud approach lies in the potential for analytics, which could potentially predict sales to optimize the supply chain among many distributed machines. It could also be used to optimize the efficiency of the personnel who replenish the inventory in the machines and perform unscheduled mechanical maintenance.
Phase 2: Designing the proof-of-concept prototype
The project team determined that, for this project to be as useful as possible for the developer community, it should be based on readily available parts and technologies. Based on that decision, it was decided to limit the bill of materials to the Grove* IoT Commercial Developer Kit, Intel® IoT Developer Kit, and Intel® IoT Gateway Software Suite (https://software.intel.com/en-us/iot/hardware/gateways/wind-river), using software technologies that are widely used in the industry and available at low or no cost, with the use of free open-source software (FOSS) wherever practical.
To accelerate the prototype stage and reduce its complexity, the team elected to build the local portion of the prototype as a bench model that would consist of the compute platform and sensors, without incorporating an actual vending machine, although such a device would be added at a future stage of the project.
Prototype hardware selection
The Intel® NUC Kit DE3815TYKHE small-form-factor PC was chosen for this project. This platform is pictured in Figure 2, and its high-level specifications are given in Table 1. In addition to its robust performance, the team felt that, as Intel’s most recently introduced hardware platform specifically targeting IoT, it was a forward-looking choice for this demonstration project. Based on the Intel® Atom™ processor E3815, the Intel NUC offers a fanless thermal solution, 4 GB of onboard flash storage (and SATA connectivity for additional storage), as well as a wide range of I/O. The Intel NUC is conceived as a highly compact and customizable device that provides capabilities at the scale of a desktop PC.
To simplify the process of interfacing with sensors, the team elected to take advantage of the Arduino* ecosystem using the Arduino* 101 board, also shown in Figure 2, with specifications given in Table 1. This board makes the Intel NUC both hardware and pin compatible with Arduino shields, in keeping with the open-source ideals of the project team. While Bluetooth* is not used in the current iteration of the project, the board does have that functionality, which the team is considering for future use.
Figure 2. Intel® NUC Kit DE3815TYKHE and Arduino* 101 board.
Table 1. Prototype hardware used in intelligent vending project.
| || |
Intel® NUC Kit
Intel® Atom™ processor E3815 (512K Cache, 1.46 GHz)
Intel® Curie™ Compute Module @ 32 MHz
8 GB DDR3L-1066 SODIMM (max)
196 KB flash memory
24 KB SRAM
Networking / IO
Integrated 10/100/1000 LAN
14 Digital I/O pins
6 Analog IO pins
190 mm x 116 mm x 40 mm
68.6 mm x 53.4 mm
For the sensors and other components needed in the creation of the prototype, the team chose the Grove* Starter Kit for Arduino* (manufactured by Seeed Studio), which is based on the Grove* Starter Kit Plus used in the Grove* IoT Commercial Developer Kit. This collection of components is available at low cost, and because it is a pre-selected set of parts, it reduces the effort required to identify and procure the bill of materials for IoT prototypes in general. Selection of sensors and other components for the prototype (detailed in the following section) are guided by the following key data:
- Internal temperature of the machine
- Inventory levels of each vendable item in the machine
- Door open or closed status
- Detection of a jam in the vending coil
Prototype software specification
For the prototype OS, the team considered Yocto Linux* as well as the Intel® IoT Gateway Software Suite. Yocto Linux supports the project’s ideal of using free open-source software (FOSS), and it offers a high degree of flexibility, as well as robust control over the source code and the ability to create a custom lightweight embedded OS that is tailored to the needs of the system. Intel IoT Gateway Software Suite, on the other hand, provides an out-of-the-box implementation, without requirements for customization. The team identified this combination of factors as a best practice for prototype development, and so Intel IoT Gateway Software Suite was chosen as the OS for the prototype.
The following applications were identified to be developed as part of the solution:
- Control application will run on the vending machine itself, gathering data from sensors and handling operation of the electromechanical aspects of the solution (e.g., turning the vending coils) as well as data exchange with both human users (e.g., customers and administrators) and with the cloud.
- Administration application will operate on a PC or tablet and allow for a detailed view into the operation of the vending machine, including events, status, and logs, as well as access to the cloud data and analytics. This application will also support regular maintenance.
- Customer application will operate on a smartphone or other mobile device, enabling a customer to purchase products from the machine.
Phase 3: Building and refining the proof-of-concept prototype
Using the Intel NUC Kit DE3815TYKHE, the Arduino 101 board, and the Grove Starter Kit Plus IoT Edition, the team developed the proof of concept prototype illustrated in Figure 3 to simulate a simple vending machine that dispenses two products. It includes a 2x16-character LCD display that shows product names and price information, as well as two product selection buttons, a step motor to dispense products, and two LEDs (green and red) to show the machine status. It also includes a temperature sensor and a "fault detection" button. Once the buy button on the customer application is pressed, the product is dispensed; for simplicity, payment processing hardware was left out of the prototype.
Figure 3. Intelligent vending machine proof of concept prototype.
Prototype Hardware Implementation
The bill of materials for the prototype is summarized in Table 2.
Table 2. Intelligent vending machine prototype components.
Prototype Software Implementation
The development environment used to develop the software for this solution was Intel® System Studio, a plug-in for the Eclipse* IDE that facilitates connecting to the NUC and developing applications in C/C++.
In addition, the development of this solution used Libmraa, a C/C++ library that allows for direct access to I/O on the NUC, as well as Firmata, which allows for programmatic interaction with the Arduino development environment, taking advantage of Arduino’s hardware abstraction capabilities. Abstracting Firmata using Libmraa enables greater programmatic control of I/O on the NUC, simplifying the process of gathering data from sensors. UPM provides the specific function calls that are used to access sensors.
Phase 4: Producing a Solid Beta Version
With a proof of concept prototype up and running, the team turned its attention to creating the production version of the intelligent vending machine. The solution as a whole was conceived as including the following main parts:
- Vending machine, which dispenses products and communicates data back through the gateway. This part of the solution is complex and custom-built, including a variety of sensors and related components.
- Gateway, which is purchased as a commercial product based on Intel architecture and implemented using custom-developed software.
- Cloud analytics, based on Microsoft Azure, which allow for the development of insights to improve business processes, based on usage data from the vending machine over time.
Selecting Vending Machine Components
An early effort in the completion phases of the project involved selecting the specific components that would make up the final solution in production.
Vending Machine Device Procurement
Whereas the team had elected to create the proof of concept prototype as a board-level simulation of a vending machine, the production version was to be an actual, functioning vending machine. The team investigated having a custom machine purpose built, as well as purchasing a used machine that could be retrofitted for the purposes of this project. Ultimately, a custom machine was selected in order to support selling the widest possible range of products. The initial specification for the custom vending machine and a picture of the machine itself at an early stage of fabrication are shown in Figure 4.
Figure 4. Vending machine specification and photo of device during fabrication.
Vending Machine Model Specification
Custom tabletop vending machine for a variety of small products packed in boxes, blister packs, or bags. Each of three coil-driven vend trays will be configured for a different size product:
- 3" close pitch coil for 12-14 small blister packs
- 4" medium pitch coil for 9-12 medium size boxes or packages
- large 5-6" coil for 6-8 larger packages such as t-shirts
The coils will be driven from one stepper motor per coil and drop product in to a singlewide tray at the bottom of the machine. There will be a plexi-window to view vend selections and optional cutouts for Intel choice of flatscreen and/or keypad.
Machine body will be powder-coated steel, trays will be aluminum, and vend coils will be plated steel. Front of machine will open to refill product, and rear will open to install and service vending mechanism.
Approximate dimensions of machine will be 24-30" deep x 36" tall x 30" wide. Overall target weight is under 70lbs.
Customer applications allows for purchasing products.
Other key decisions to be made at this stage included the choice of industrial-grade sensors, an Intel® architecture-based commercial gateway, a fully supported production OS, a cloud service for data storage and analytics, and software technologies for the administration and customer application.
Sensors and Related Components Selection
Industrial-grade sensors and related components to replace those from the Grove Starter Kit that were used in the proof of concept prototype are detailed in Table 3.
Table 3. Production intelligent vending machine components.
Vending Machine Model
Chassis with a hinged front door and removable back panel
Removable tray with three coils for dispensing products
Three stepper motors (one per coil), each equipped with switches for sensing a full coil rotation
Removable tray for electronic parts
Dell Wyse* IoT Gateway
USB Type A to Micro-USB Type B Cable
Connects I2C/GPIO controller to gateway
12V 5A Power Supply
For stepper motor driver board
UMFT4222EV USB to I2C/GPIO Controller
PCA9555-Based GPIO Expander
SparkFun Quadstepper Motor Driver Board
AM2315 Temperature and Humidity Sensor
Grove LCD with RGB Backlight Module
Red LED Panel Mount Indicator
White LED Panel Mount Indicator
Factors in selecting the gateway to be used in the product version of the intelligent vending machine included the following:
- Robust compute resources to ensure smooth performance without errors due to bogging down during operation, particularly considering the need for communication with the cloud as part of normal usage.
- Ready commercial availability was clearly needed so the project could proceed on schedule. While some members of the team expressed preference for the Vantron VT-M2M-QK gateway, difficulty in obtaining that device in a timely manner disqualified it from use in the project.
Ultimately, the Dell iSeries Wyse 3290 IoT Gateway, specifications of which are summarized in Table 4, was chosen for implementation in the product phase of this project. That gateway provides the needed performance for present and foreseeable functionality, as well as ready availability (potentially in large quantities) for hypothetical distribution of the vending machine as a commercial product.
Table 4. Gateway specifications for intelligent vending machine product phase.
| || |
Dell iSeries Wyse* 3290 IoT Gateway
Intel® Celeron® processor N2807 (1 M cache, up to 2.16 GHz)
4 GB DDR3 RAM 1600 MHz
Continuing to use Intel IoT Gateway Software Suite (which the prototype was already based on) was a straightforward decision, particularly because the gateway is pre-validated for that OS. Moreover, Intel NUCs and gateways can both run Intel IoT Gateway Software Suite, simplifying the process of porting software elements from the prototype to the product version of the intelligent vending machine model. Likewise, the other core software components such as Intel System Studio and the libraries used in the prototype were held constant to simplify the transition to the product phase.
The system includes the software running on the IoT gateway, the Azure cloud, and a server-side application, as illustrated in Figure 5.
Figure 5. Intelligent vending machine topology: online operation.
IoT Gateway Software Implementation
- The IoT gateway software consists of three parts: Control application is implemented in C++ using the IoT Developer Kit libraries libmraa and libupm; it performs the following tasks:
Check for mechanical failures and report failure/no-failure events to the local database.
Monitor for temperature fluctuations in and out of the allowed range, reporting events when the temperature goes out of and returns to that range.
Check for events from product selection buttons that occur in the customer application, followed by the application generating a "dispense" event, which is sent to the machine through the cloud.
- Local DB is used for inter-process communication between the control application and the DB daemon. The local SQLite database uses the file $HOME/Vending_Prototype/events.sqlite3, which contains the "events" table with the events to be reported to the cloud. The events table is replicated both ways to and from the machine.
- DB daemon is implemented using Node.js; it sends reported events bi-directionally between the local database and the cloud.
Azure Cloud Implementation
The Azure cloud maintains information about product inventory for the intelligent vending machine, keeps track of the events received from customer app and vending machine, and provides functionality to analyze this data and trigger responses to various conditions (e.g., low inventory or mechanical failure). Primary cloud analytics functions are as follows:
- If a product is out of stock, that information is sent to the cloud and an alert displays in the admin app for the user.
- If the vending machine internal temperature reaches above or below a preset threshold, that information is sent to the cloud for analysis. An alert displays in the admin app for the user.
- If any of the three vending machine coils function improperly, that information is sent to cloud for analysis. An alert displays in the admin app for the user.
- If the vending machine tray is pulled out, "Machine Opened" status displays red in LCD and LED. Once the tray is pushed back in, "Machine is ready" status displays green in LCD and LED.
The Admin app provides information regarding home, setup, log history, inventory status and alert details.
Phase 5: Finalizing Design and Releasing to Production
The project team tasked with developing this solution was engineering-centric, and so producing first-rate UIs for the final product was somewhat outside the team’s core competency. Therefore, the team engaged an external resource on a contract basis for that purpose. The UI provider participated in regular team meetings and dedicated meetings with the core software-development team.
During those discussions, the UIs were refined to incorporate additional capabilities and functionality. For example, the team added color coding and options for switching between Fahrenheit and Celsius temperatures to the administration application UI. Functionality was added to the customer application UI asking users to verify that they wish to make the purchase before the transaction is made, along with other minor refinements.
The administration application UI, shown in Figure 6, is designed to operate on a tablet computer and to provide administrative functionality on the intelligent vending machine.
Figure 6. Intelligent vending machine administration application UI.
The administration application UI incorporates the following primary elements:
- Menu system contains a "home" button to go the home screen (shown in the figure), an "About" screen with information about the software, a "Setup" button that provides hardware-setup details (including placement and connectivity of sensors), a "Log" button to access an events log that tracks purchases, alerts, and maintenance, and an "Alert" button that provides information about active maintenance alerts, including the type and time of occurrence for each alert.
- Inventory panel reflects inventory levels that are set within the cloud, using color coding to indicate those levels: dark blue for levels above two thirds of capacity, lighter blue for levels one third to two thirds, and orange for levels below one third. Clicking on the panel generates a detailed inventory window that displays exact inventory quantities, which tray the item is in, and price for each item.
- Temperature module is a dual-threshold radial temperature graph, with display of the machine’s current internal temperature selectable as Fahrenheit or Celsius. The white bar represents the acceptable temperature range; if the temperature goes outside that range, the system generates an alert. The software polls the temperature and updates the UI every few seconds.
- Coil status module reports on the status of the vending coils and motors, indicating if there is any malfunction, such as a jam or electrical failure.
- Vending unit module provides visual information about the presence and location of error conditions, as well as the door open/closed status.
The customer application, shown in Figure 7, is designed to operate on a mobile device, allowing customers to interact with the vending machine in order to make a purchase.
Figure 7. Intelligent vending machine customer application.
The customer application incorporates the following primary elements:
- Status pane indicates whether the machine is ready for an order to be made, and it also functions as a shopping cart to display a list of items selected by the user, pending sale. When items are added to the shopping cart, a "Buy" button appears that indicates the sale total; clicking on that button completes the purchase by sending the order information to the cloud and upon receipt of confirmation from the cloud, dispensing the item and updating the inventory number.
- Ordering pane contains a selection button for each product in the machine; when clicked, the button adds the item to the shopping cart list in the status pane. Each product button is accompanied by fields that display the amount of inventory in stock as well as the price of the item.
Completed Production Vending Machine
The assembled intelligent vending machine, with the gateway, sensors, and other components installed, is shown in Figure 9.
Figure 9. Fully assembled intelligent vending machine.
Phase 6: Evaluating Functionality and Adding Features
Once the actual product version of the vending machine was operational, several team members began to identify possible future functionality that could be built into the product.
Enhancing Cloud Analytics
The team identified the opportunity to enhance cloud-analytics functionality using the Microsoft Power BI service and Power BI Desktop, a cloud-hosted business intelligence and analytics service that is integrated into Microsoft Azure. These capabilities offer data-visualization enhancements for the intelligent vending solution.
Enhancing Event Notification Data Flows
During the evaluation phase, the team identified possibilities to automate certain aspects of the machine’s operation using event notifications in conjunction with Azure analytics. Specifically, future enhancements based on the following data flows were identified:
- Inventory. If the quantity of a product drops to two units, a future enhancement could cause a notification to be sent to the cloud for analysis, and an alert could be sent to the administration application as a notification to reorder stock. This sequence could be repeated if the quantity drops to zero, and notification could also be sent to the machine display and the mobile application, indicating that the item is out of stock.
- Maintenance. If the machine malfunctions (e.g., the coil fails to make a full turn, the temperature goes outside preset limits, etc.), a future enhancement could cause a notification to be sent to the cloud for analysis, and service personnel could be notified. An alert could also be sent to the administration application to monitor the status of the service call.
Tracing the path to product during the development of the intelligent vending machine is intended as a pattern for teams to consider as they build their own solutions. Beginning with an ideation phase and rapid prototyping on low-cost equipment and a simplified physical model allows projects to take off quickly. Decisions can therefore be made early about the potential viability of the project, when a relatively small investment in time and money has been made.
This project also suggests a model for thinking about cloud analytics in IoT solutions. Rather than focusing just on opportunities for big-data insights, this implementation reveals how the cloud can function foremost as a communication nexus and centralized data store. At the same time, the cloud data provides substantial opportunities for generating business intelligence to optimize supply chains, increase maintenance efficiency, and enhance profitability.