We use data analysis and visualization capabilities of ThingSpeak, our favorite Internet of Things platform to capture and analyze performance data, to help with performance monitoring and to generate alerts
2. 2
Agenda
The Internet of Things (IoT)
ThingSpeak
A few of our favorite IoT applications
Performance Trends and Alerts on ThingSpeak
3. 3
The Internet of Things is…
The internet of things (IoT) is the internetworking of physical devices, vehicles
(also referred to as "connected devices" and "smart devices"), buildings and
other items—embedded with electronics, software, sensors, actuators, and
network connectivity that enable these objects to collect and exchange data.
https://en.wikipedia.org/wiki/Internet_of_things
4. 4
Things…
Typical “thing”
– A sensor with connectivity
– An actuator with connectivity
They are constrained
– Processing
– Memory
– Protocols
– Clock
– Power
They run code over and over – sometimes they sleep wake up and run
code, and go back to sleep
There are lots of them
5. 5
What is the Internet of Things?
Edge Nodes Exploratory Analysis
Analytic IoT Platform
Deploy analytics
to aggregator
Deploy algorithms to nodes/devices
6. 6
Agenda
The Internet of Things (IoT)
ThingSpeak
A few of our favorite IoT applications
Performance Trends and Alerts on ThingSpeak
7. 7
What is ThingSpeak?
Analytic IoT platform
– Collect data from sensors, “things”
– Visualize data instantly
– Has more than 60,000 users
Analyze data
– MATLAB integration allows users to run
scheduled code on data coming into
ThingSpeak
Act on data
– E.g. send a tweet when the temperature in
your backyard reaches 32 degrees
8. 8
Who is ThingSpeak for?
Makers
Academics
Engineers and scientists
https://thingspeak.com/
9. 9
ThingSpeak: Collecting Data using Channels
For any new data, first login and
create a channel in ThingSpeak
Channels have read and write API
keys and can be public or private
A channel is made up of 8 fields and
can store 8 streams of data (Temp,
Humidity, etc.)
Channels can be updated at a
maximum rate of once every 15
seconds
ThingSpeak Weather Channel
10. 10
Agenda
The Internet of Things (IoT)
ThingSpeak
A few of our favorite IoT applications
Performance Trends and Alerts on ThingSpeak
11. 11
Objectives
Measure, explore, discover weather patterns
Provide niche weather service
Solution
Arduino station with weather sensors
Cloud-based aggregation and analysis
Full example available at
makerzone.mathworks.com
Example 1: Monitoring Weather
12. 12
Fun with Arduino!
Arduino Serial Monitor
records the data from
the temperature sensor,
the pressure sensor,
and the humitidity
sensor, as transmitted
to ThingSpeak!
Placing ice on
the Arduino temperature
sensor to cool it off!
13. 13
Fun with Raspberry Pi
Building a circuit with a
temperature sensor in this
week's
Posting the temperature
readings from the sensor
to ThingSpeak using
Twitter.
14. 14
Objectives
Measure, explore, discover traffic patterns
Provide live local traffic information service
Solution
RaspberryPi + webcam
Automated deployment of vision
algorithms on embedded sensor
Full example available at
makerzone.mathworks.com
Example 2: Monitoring Traffic
16. 16
Agenda
The Internet of Things (IoT)
ThingSpeak
A few of our favorite IoT applications
Performance Trends and Alerts on ThingSpeak
17. 17
Case Study: Performance Optimization of MATLAB Code
A customer ran into slow performance issues with her code in MATLAB.
She saw such slow performance in that she decided to recode her
algorithm in another language. We wanted to show her some simple
techniques in MATLAB that could bring her code down to a more
reasonable running time.
18. 18
What is the problem the user was trying to solve?
The code generates locations on a 2D
grid with dimensions nx1 by nx2
The code iterates through all possible
combinations of these initial and final
positions
23. 23
Focusing in on the Performance Improvements
February 1 – baseline at 23.8s
If we hover over the data points in the trend plots, or zoom in, we will spot the key
optimizations that helped performance of Sarah's code. Initial Code measured at around
23.8s:
26. 26
Focusing in on the Performance Improvements
Optimization #1: February 20 – 22.3s
On February 20, we switched to Code with Preallocation, speeding up to
around 22.3s, or by 6%:
28. 28
Focusing in on the Performance Improvements
Optimization #2: May 20 - down to 0.2s!
On May 2, we implemented the optimization to Vectorize the Inner Two loops; this sped up
the code 100+-fold, to 0.2s.
30. 30
Focusing in on the Performance Improvements
Optimization #3: June 9 – dipped down to 0.06s!
Finally, on June 9, we implemented Vectorize the Inner Three Loops, and the code sped up
to 0.06s, or by 67%.
32. 32
In all, our trends capture pretty awesome 400+-fold performance improvement in the past
few months!
The result: 400x as fast overall!
33. 33
What’s Next?
Use Analysis and Visualization tools on ThingSpeak for more advanced
data analysis like displaying error bars, normalizing performance across a
suite of tests
Set up email alerts in response to changes in performance
Use machine learning for anomaly detection and to generate smart alerts
34. 34
Thank you!
Many thanks to the ThingSpeak team for help with these slides and for
creating and growing ThingSpeak!
A big thank you to Andy Campbell for helping me publish a MATLAB Central
blog post on this
@anoushnajarian
Anoush.Najarian@mathworks.com
linkedin.com/in/anoushnajarian
Notes de l'éditeur
Internet of Things (IoT) describes an emerging trend where a large number of embedded devices (things) are connected to the Internet. These connected devices communicate with people and other things and often provide sensor data to cloud storage and cloud computing resources where the data is processed and analyzed to gain important insights. Cheap cloud computing power and increased device connectivity is enabling this trend.
IoT solutions are built for many vertical applications such as environmental monitoring and control, health monitoring, vehicle fleet monitoring, industrial monitoring and control, and home automation. MATLAB® and Simulink® products support IoT systems by helping you develop and test edge node devices, access and aggregate data, and analyze IoT sensor data.
At a high level, many IoT systems can be described using the diagram above. The left side of the diagram illustrates edge nodes. Edge nodes are devices that collect data and include devices such as wireless temperatures sensors, heart rate monitors, and hydraulic pressure sensors. The middle of the diagram shows the data aggregator. The aggregator collects, processes and stores data from many edge nodes that are often geographically dispersed, and it may have the capability to analyze and take action on the incoming data.
The right side of the diagram depicts the historical analysis of data. In this case, the data is pulled from the aggregator into a software environment to allow researchers to gain insight from the data and to prototype algorithms that may eventually execute on the aggregator or on the edge node device itself.