Sprinkling a little bit of IoT around Contoso’s Dynamics business process to make it more intelligent


I am increasingly hearing Dynamics customers asking about IoT solutions from Microsoft. This article describes a recent experience at a Dynamics AX customer, hope you enjoy. 

Internet of Things is growing at a phenomenal pace and there are so many mind boggling predictions about it that it can be hard to follow. To make things simple you can chose to remember just three predictions from Gartner, apparently these numbers will be valid for next five years 🙂 so you should be ok barring major changes.

  • IoT will include 26 billion units by 2020
  • IoT and service suppliers will generate incremental revenue exceeding $300B, mostly in services by 2020
  • IoT will result in $1.9T in global economic value-add through sales into diverse end markets

As if talk about petabytes and terabytes of data wasn’t sufficient now you also have to remember about billions of sensors and trillions of dollars! Doesn’t it make you wonder where all this is going and how much is really true? Well, if it does, I entertain you to look at this little bit of sprinkling of IoT devices that we are currently doing at Contoso. If this article interests you and you feel like you want to touch and feel some of these devices yourself please come and see us at Atlanta convergence March 16-19 2015 at a general session and a concurrent session. If you miss out on those opportunities you can always find us in the Customer showcase at EXPO hall. 

So I have covered in previous posts what Contoso's business is about. Contoso is UK’s leading foodservice delivery company, supplying full- range of food stuffs across the UK. It is a leading supplier to restaurants, bars, pubs, café's and schools. Forty-five thousand customers place over a million orders a year from a catalogue of about five thousand products. More is here.

Since they make deliveries, they have their own fleet to do this. As you can imagine, any delivery of temperature sensitive products like food or medicine has it's fair share of challenges. One of these challenges for the COO of Contoso is how not to feel terribly sorry while he sits and watches thousands of pounds of food rotting at the backside of a truck which has a broken cooling unit and is stuck in snarling traffic through streets of London on a hot summer day. Half of such an event is enough to justify the meagre cost of implementing a Microsoft Azure based temperature-controlled solution that Contoso has come up with to address their scepticism about internet of things in general! 

On a more serious note it has happened a few times in hot summer months with products like ice-creams, shrimps and peas that customers have called up to complaint about drivers delivering defrosted stuff. There isn't much choice for Contoso other than to provide a credit note when such a thing happens. It's not only lost revenue but more importantly lost customer that is the real concern in such situations - not to mention, the spoilt food. And there is the major risk of big damage with a whole cooling unit breaking down. This is a nightmarish scenario for every distributor engaged in any cold chain.

So, the genesis of what Contoso is building lies in a simple question to Paul Smith, the COO - "Paul, if this is a risk, why don’t you put temperature sensors in your trucks and hook them up to Azure and run some analytics on time series data to alert you before something breaks down? If results tell you something, it would mean there is some substance to all the hype"  

It was a simple enough question and a simple enough proposal. Paul was in as long as we agreed we are not going to hook up sheep pedometers to Azure to measure their health and hence quality of their meat or use automatic devices to feed pets when owners were away deeply engaged in a pub crawl! Convince yourself here - 1, 2, 3, 4, 5, 6

So we looked around for suitable temperature sensors. There are so many sensors in the market sensing so many things that at first, it was hard for us but then quickly we established strict qualification requirements and narrowed down to two sensors. TI sensor and a ZenMeasure sensor from a vendor in China. ZenMeasure is called MiaoMiaoCe (in Chinese, this means "measure it every second"). TI tag has more details here. You are welcome to browse details of their capabilities using the links but I will put here in short, the tests we did and comparisons we made.  

ZenMeasure is pretty cool, pretty slick and seriously small - it is the size of an overcoat button. It was originally designed for consumer use, for measuring skin temperature of older patients and children in hospitals and care homes.

  So you can imagine their surprise when they got a request from Contoso to test their sensors to install in delivery trucks. In the early days (three months ago that is) ZenMeasure didn’t measure below freezing temperatures but this was quickly changed in an update a week later to allow Contoso to measure temperature of its chilled as well as frozen products on the road. (Note: In this market, there are many vendors and they move very quickly to publish changes to their products/apps).

When you go for something like this or any device of this nature you will quickly realize that most important things are signal strength and battery life. Contoso is still evaluating battery life and comparing it with TI. Contoso procured two sensors at first and Paul installed them in his home refrigerator and freezer and used his iPhone app to test the features. He felt pretty excited about its' capabilities. Now it's been three months into testing and several new ZenMeasure sensors have been procured and installed in various places including a few in delivery trucks, none so far indicate much loss in battery life. This is excellent! TI sensor on the other hand is capable of sensing not only temperature but also humidity, motion etc. making it very likely to have lower battery life than ZenMeasure. Both communicate using BLE Bluetooth Low Energy, both are very easily discoverable on iPhone and both meet the connection strength and connection range criteria.

Now about the major drawback. None of the sensor vendors we looked at have a Windows app. (Note: this is pretty common, vendors are building for iOS and Android, not so much for Windows, however this is likely to change quickly with Windows 10 and Raspberry Pi support and a number of other things.) We tapped into teams in Microsoft and found out Chris already had made a WP app for TI. He agreed to build a WP app for ZenMeasure. He quickly got a ZenMeasure sensor for himself and it took him few hours I guess to have the app working. There were a number of issues discovered and resolved, some included here to provide you a flavour of what's in store for you if you go down the IoT road.  

Some mundane stuff - Contoso spent a decent few weeks discussing where exactly to mount the sensors in the delivery trucks. They eventually called refrigeration engineers and got their help to settle on the best location within the delivery truck to mount the sensors. TI sensor comes with a little hook that can be used to hang it on the walls of the truck however ZenMeasure doesn’t come with anything so a DIY sort of casing was built to house the sensor so it could be safely stored and mounted.  

But let's say, we get a sensor, we got it working, we got an app for it to see the reading from anywhere. Now what? After all, this is great for a hobbyist but to be commercially useful to Contoso, there should be some use of this data in some business process. Isnt' it?

It's important to recollect here from one of the previous posts that Contoso has a Windows CE based drivers' app that they use to make drop-offs to customers. Some customers ask for temperature reading of the products being delivered. Today drivers' do this by walking to the back of the truck and manually looking at the manual hard-wired thermometers and entering this reading by hand on drivers' app which then ensures that printed invoice contains the reading. 

So, naturally this brought up all the questions related to integration. So how exactly to integrate this ZenMeasure app and/or data from the sensor to various other things going on with the business process. Contoso is also building a new WP app for drivers that will run on Microsoft Lumia 635 phones running WP 8.1. The backend is Dynamics AX and it uses a number of Azure technologies. More on that is available on links at bottom of main Contoso page. So this is what is happening with ZenMeasure data. With the new drivers' app, when the driver has reached his drop-off destination and is ready to pick goods from truck and drop them at the customer location, the drivers' app interrogates both chiller and freezer ZenMeasure sensors about the current temperature reading. This reading is then stored in the SQLite database on local Microsoft Lumia device. Chris also made a suggestion to keep the interrogating to a minimum, more interrogation means lower battery life. Contoso has a regular maintenance schedule for its' delivery trucks that go through regular check-ups every ten weeks and the goal is that ZenMeasure sensor with all the love and care showered onto them should not need battery changing at a cycle shorter than that. These are very important considerations from a business process point of view, it's important that disruption to regular business process is kept minimum to justify building this solution for essentially an insurance against a future event of some likelihood.

Once the readings are in local Lumia device SQLite, the data is sent to SQL Azure storage along with all the other data from drivers' app. The reading is then picked up to be transferred to Dynamics AX database from where it is used further down in the business process. Note, this is critical for offline scenarios since connectivity on road is poor in most places and really poor in UK. There is also a Bluetooth printer that drivers carry with them to print invoices with their drop-offs. This led to another challenge as for a while we could not get both Bluetooth printer and BLE sensor to pair with the Lumia device at same time. Soon enough this issue was resolved. The drivers now have the ability not only to print the invoices using the Bluetooth printer but also the ability to print temperature at drop-off time on the invoice itself for customers who want that level of service. This helps customer service folks deal better with customer complaints about defrosted goods. Automated thermometer reading into the app ensures reliability - the reading is captured for each and every drop-off and improves efficiency - driver's don’t have to read the thermometers manually as in the old system.

There is no end to surprising problems we encountered while building this solution. Now, after full deployment, Contoso will have over 100 drivers using 100 Lumia phones in 100 vehicles with 200 ZenMeasure sensors installed on any given day. After a long period of contemplation, Paul decided to let his drivers' keep Lumia phones with them after workday is over! So each driver has his phone now. And each truck has two sensors. However driver and trucks are in no way fixed. Any driver can drive any vehicle on any given day on any given route for that day. This meant that after drivers were assigned routes (based on complicated math, topic for another day!) and trucks, they would have to pair the two BLE sensors in that truck to their phones before they set off for the day. This is a step too complicated to add to already complex and very well oiled business process. After all the whole purpose of this exercise is to make the process more intelligent, more efficient and reliable. How can Paul leave this bit to chance? What if driver couldn’t pair properly or pairing itself failed or just didn’t want to, etc. So, Chris is working with the team to build a solution which ensures that all Microsoft Lumia phones are already permanently paired to all ZenMeasure sensors. 

The WP drivers' app also has two additional capabilities.

There are two background tasks running, one to capture battery life from the sensor and another to capture temperature reading every couple minutes form every sensor in over hundred delivery trucks. Keeping in mind the offline scenarios due to poor connectivity these captured time series are also stored locally on Lumia phones and then streamed into Azure Event Hub. There are two plans with these time series. One is to use the battery life time series from all trucks and feed to an Azure ML model that does simple time series forecast to predict when the battery is expected to run out. This will give Contoso a very nice clean way to predict when the battery will run out and use this knowledge to proactively have required batteries available for drivers to change before they head out for the day so sensors are always ON while on road. No excuses!

The temperature time series on the other hand is being used in a number of ways. Contoso is using Azure Stream analytics to run simple temporal queries on the streaming data. Show me average freezer reading for last 30 minutes for all vehicles on the road, Alert me if average reading for last 30 min is beyond a certain threshold for any vehicles on the road etc. Since they already capture GPS co-ordinates for all vehicles they are planning to run finer grained GPS aware temporal queries. Contoso also has a Power BI (if you are keen to know more how to use power BI with AX, see Clay's great series here) dashboard in the transport office that displays current vehicle locations and superimposes average temperature readings from chillers and freezers on to it. Since this is quite new, they are in the process of establishing policies on what to do when temperature readings cross certain thresholds - at what point to call drivers' back to the base etc. Eventually they want to use the temperature time series data for a predictive maintenance Azure ML model that can predict when a particular cooling unit should be sent for an overhaul before it breaks down. There is also a plan in the works to use Anomaly detection Azure ML app to see if it reveals anything interesting and helps in any way.

All in all it was somewhat surprising to note that a consumer device and a consumer app that worked pretty much out-of-the-box for consumer scenarios had to go through pretty rigorous testing and a number of modifications to get to a point where Contoso considers this as a feasible solution to address their scepticism with internet of things! Kudos to this team for their incessant focus on customer service, efficiency and on technological innovation.

Hope this was interesting for you to see how an automated process could be made more intelligent with a live example and how so many new Microsoft Azure tools and technologies can be connected to work with your business processes in Dynamics AX. If you are a Dynamics customer and want to learn more about this solution or want to deploy another IoT solution please write to me aksheyg@microsoft.com

Contributions: Chris Lovett, Akshey Gupta

Comments (0)

Skip to main content