INTELLIGENT VENDING MACHINE with SAP Leonardo Internet of Things Service
Hello everyone, I’m Jose and this is my first SAP blog, so don’t be too hard on me 🙂
I am currently working at Accenture, precisely at the Madrid Liquid Studio, as part of the SAP Leonardo Team. We work with multiple SAP technologies. I’m focused on proofs of concept/value to show our clients an idea of what they can do with this new SAP technologies.
Now you know a little bit more about me, let’s talk about this amazing project. What I am presenting you today is an Intelligent Vending Machine, controlled via MQTT and COAP, connected to SAP Leonardo IoT Service 4.0. With this solution, we have total control of the machine properties such as stock, temperature, humidity, “predictive” maintenance… But don’t be impatient, I’ll tell you everything about it, just continue reading!
As you can see by the architecture, we can separate this project in 4 different segments:
- This part of the project refers to what the user/customer can touch/use to control the vending machine. In this case, it is a pair of MQTT (a kind of wireless comms. protocol) mobile applications, one for the customer and another for the technician who is going to perform the maintenance tasks on the machine.
- With these applications, the user has the possibility to choose a beverage/snack and make the Vending Machine dispense it via MQTT (I’ll explain how this works in the next segment). For the other app, the maintenance technician can control the following:
- Door closed/opened.
- If the machine is under maintenance.
- Turn on/ turn off the machine (via Sonoff smart relay).
- Failure Alert.
- This segment is the one integrating the physical and cloud world where we have used an Arduino and a Raspberry as main components.
- The Arduino we are using is an ESP-32 and we installed a series of sensors and actuators in the machine that allow us to have its control. All information about these sensors is sent via MQTT to the broker where is redirected to the cloud. These sensors are:
- 5 Servos to drop cans.
- 1 Dht sensor to control temperature and humidity.
- 1 proximity sensor to control if the status of the door and if the machine is under maintenance.
- 1 Sonoff to control the machine status (on/off).
- The Raspberry is the operational enabler of this project, where every bit of information is received and sent.
- This RPI has an (open source) MQTT broker installed, called mosquitto. It allows us to send and receive data to and from sensors. The process goes like this: we want to have something from the machine, so we click in the product on our mobile app, then, the MQTT message is published in the RPI mosquitto broker topic where our Arduino is listening. As a result, it moves the corresponding servo and the product is dispensed.
- This RPI runs a python script to parse all data retrieved from sensors and to upload it to the SAP IoT EDGE Gateway (via COAP).
- The RPI also runs the SAP IoT EDGE Gateway with the COAP protocol. A good question here is, why are we using now COAP instead of MQTT? The answer is, as a proof of concept, we are trying to show that we are able to exchange communications between protocols without interruptions and still not compromising our SAP service.
In the cloud segment we have 2 different parts:
- Internet of Things Service Cockpit
- This is the place where you can organize your devices, sensors and its properties.
- This service has a management API where you can create, delete, or modify the characteristics that it offers.
- Application Enablement – Thing Modeler
- This service allows you to create a Digital Twin based on your physical device where it is synchronized with the IoT Service Cockpit structure.
- This service also has its own type of UI5 application template. It comes with its particular UI5 entities to create a web as visual and user-friendly as possible. It includes IoT specific elements such as a map where all connected Things are placed, highly customized pins for Things where status color codes can be implemented, or Gauges to visually control temperature thresholds and create alerts if they are exceeded.
As we have mentioned before, Application Enablement (+ Web IDE component) allows us to create end-user applications. In this case, it was meant for higher level managers. In this application you can control:
- If the door is closed/opened.
- If the machine is under maintenance.
- Drop cans.
- Turn on/ turn off the machine (via Sonoff).
- Temperature and humidity alert.
- Stock alert.
- Machine’s temperature and humidity.
So the bottom line for this solution is being capable of the following:
- A proof of concept/value, so the point here is about experimenting the most with the new SAP Leonardo technologies and prove the wide range of versatile possibilities that this service unlocks.
- Currently working on 3 apps, 2 mobile apps (customer user, maintenance technician) and a cloud SAP UI5 application with the Application Enablement service (managers).
- Use of various IoT protocols, being controlled by MQTT and COAP protocol it’s possible to retrieve data to and from the machine’s sensors.
So that’s all for today, I hope you are now as excited as I am about the Intelligent Vending Machine and I can’t wait to read your questions and suggestions.
Thank you so much for your time.
Jose David Larrubia Elich.
BTW: Thanks to all my colleagues from Liquid Studio in Madrid and the Accenture SAP Business Group for supporting this initiative.