AWS IoT TwinMaker Tutorial | Digital Twins Introduction & Demo
Summary
TLDRThis tutorial demonstrates setting up AWS IoT Twin Maker for visualizing motor data in a factory. It guides through creating a motor model in SiteWise, generating and sending data with a Python script, and visualizing it in Twin Maker and Grafana. The process includes defining attributes, creating assets, setting up workspaces, and configuring data sources, culminating in a real-time 3D visual representation of motor status with color-coded speed indicators.
Takeaways
- 🏭 The tutorial is focused on creating a visual representation of motor data in a factory setting using AWS IoT Twin Maker.
- 📈 The primary data of interest for the motors is their speed, which is measured in RPM (Revolutions Per Minute).
- 📝 AWS IoT SiteWise is used to receive and manage the motor data, with a digital twin created in Twin Maker for visualization.
- 🔧 The process begins by creating a 'Motor Model' in SiteWise, defining attributes such as serial number and measurements like speed.
- 📍 An 'Asset' is then created in SiteWise using the defined 'Motor Model', with properties like asset name and measurement aliases.
- 🔄 Data is sent to the asset using a Python script, simulating motor data transmission in a real-world scenario.
- 🛠️ Twin Maker requires the setup of a workspace, including an S3 bucket for storage, roles, and policies for proper access and execution.
- 🌐 The Twin Maker workspace integrates with AWS IoT SiteWise to fetch and visualize the motor's data.
- 📊 Grafana is used for dashboard management, allowing for real-time monitoring and historical data visualization.
- 🎨 A 3D model of the motor is added to Twin Maker to create a visual scene, with annotations and shaders to represent data.
- 📝 Rules are created in Twin Maker to change the visual representation (e.g., color) of the motor based on its operational parameters, such as speed thresholds.
Q & A
What is the main purpose of the AWS IoT Twin Maker tutorial?
-The main purpose of the AWS IoT Twin Maker tutorial is to demonstrate how to create a visual representation of current and historical status of motors in a factory, specifically focusing on their speed, using AWS IoT Twin Maker and Grafana for visualization.
What does the production supervisor want to achieve with AWS IoT Twin Maker?
-The production supervisor wants to see a visual representation of the current and historical status of the motors on the production floor, particularly their speed, to better monitor and manage the production process.
What is the first step in creating a motor model in AWS IoT SiteWise?
-The first step in creating a motor model in AWS IoT SiteWise is to navigate to the 'Models' section and click 'Create model', providing a model name such as 'Motor Model' and defining attributes and measurements like 'Serial Number' and 'Speed' with appropriate units and data types.
How is the motor data sent to AWS IoT SiteWise in the tutorial?
-In the tutorial, a Python script named 'send_data.py' is used to generate and send motor data to AWS IoT SiteWise. The script sends randomly generated speed values with timestamps at 1-second intervals.
What is the role of a property alias in AWS IoT SiteWise?
-A property alias in AWS IoT SiteWise is used to associate a measurement with a specific asset. In the tutorial, a property alias 'SL_Factory_SL_Motor_One/speed' is created to send data to the 'Motor One' asset.
What is the purpose of creating a workspace in AWS IoT Twin Maker?
-Creating a workspace in AWS IoT Twin Maker is necessary to organize and manage the digital twin components, entities, and scenes. It also involves setting up an S3 bucket for data storage and defining roles and policies for permissions.
Why is an S3 bucket needed when creating a workspace in Twin Maker?
-An S3 bucket is needed to store the data and assets related to the Twin Maker workspace, ensuring that the 3D models, annotations, and other resources are saved and accessible for the visualization.
How is the 3D model of the motor added to the Twin Maker scene?
-The 3D model of the motor is added to the Twin Maker scene by selecting 'Add 3D Model' from the scene interface, choosing the motor model file from the resource library, and placing it within the scene environment.
What is the significance of the 'Factory Rule' created in the Twin Maker scene?
-The 'Factory Rule' is significant as it defines the conditions under which the visual representation of the motor changes color based on its speed. For example, if the speed is greater than 400 RPM, the motor section turns red, and if it is less than or equal to 400 RPM, it turns green.
How is Grafana used in conjunction with AWS IoT Twin Maker?
-Grafana is used as a visualization tool to create dashboards that display the Twin Maker scene and time series data of the motor's speed. It connects to the Twin Maker data source and allows users to monitor the motor's performance in real-time.
What is the final outcome of the AWS IoT Twin Maker tutorial?
-The final outcome of the tutorial is a functional Twin Maker workspace with a 3D model of a motor, annotations for speed display, and a scene that updates based on motor speed. Additionally, a Grafana dashboard is set up to visualize the motor's speed data in real-time.
Outlines
📚 AWS IoT Twin Maker Tutorial Setup
This paragraph introduces a tutorial on setting up AWS IoT Twin Maker for a factory motor monitoring use case. It explains the creation of a motor model in AWS IoT Sitewise, including attributes and measurements like speed in RPM. The tutorial proceeds with the setup of an asset named 'Motor One' and the configuration of data streaming to AWS Sitewise using a Python script. The script simulates motor data being sent to the cloud at one-second intervals.
🛠 Configuring AWS IoT Twin Maker Workspace
The second paragraph details the process of creating a workspace in AWS IoT Twin Maker, which includes setting up an S3 bucket named 'factory WS bucket' and defining necessary roles and policies for Twin Maker, Sitewise, and S3 access. A policy named 'Factory policy' is created for permissive permissions, and a role 'Factory role' is established for service access. The workspace creation involves selecting Amazon managed Grafana for dashboard management and associating it with the previously created role.
🏭 Building the Twin Maker Visual Representation
This section describes the creation of entities and components within the Twin Maker workspace. It involves adding a motor entity and a component that connects to the IoT Sitewise data. The paragraph also covers testing the component to ensure data connectivity and the addition of a 3D model of the motor as a resource. Furthermore, it explains the creation of a scene called 'factory scene' and the integration of the 3D model into the scene, including scaling and annotations for displaying motor speed.
🎨 Customizing Visual Alerts with Rules and Shaders
The fourth paragraph focuses on customizing the visual representation by adding rules and shaders to the Twin Maker scene. It explains creating a 'motor rule' that changes the color of a motor section based on speed thresholds—red for speeds greater than 400 RPM and green for speeds 400 or below. The paragraph also details the process of applying a model shader to the 3D model to reflect these rules visually.
📊 Integrating Grafana for Real-time Data Visualization
The final paragraph outlines the integration of Grafana for real-time data visualization. It covers creating a 'factory workspace, Grafana' and setting up a user named 'Joe' with access to this workspace. The tutorial continues with configuring a data source in Grafana to connect with AWS IoT Twin Maker, and creating a dashboard with panels for visualizing the Twin Maker scene and a time series graph of motor speed data. The dashboard updates in real-time as motor data is sent from the Python script, reflecting the color changes on the 3D model based on speed.
Mindmap
Keywords
💡AWS IoT Twin Maker
💡AWS CloudSiteWise
💡Digital Twin
💡Grafana
💡Asset Model
💡Measurement
💡Property Alias
💡3D Model
💡Scene
💡Annotation
💡Model Shader
💡Rule
Highlights
Introduction of AWS IoT Twin Maker for creating a digital twin of a motor in a factory setting.
Use case scenario where production supervisors require a visual representation of motor status.
Architecture overview involving AWS Cloud, Sitewise, Twin Maker, and Grafana for visualization.
Step-by-step guide on creating a motor model in Sitewise with attributes and measurements.
Asset creation in Sitewise using the predefined motor model.
Adding property aliases to measurements for data streaming to AWS Sitewise.
Utilization of a Python script to simulate motor data generation and transmission to Sitewise.
Data verification in the AWS console to ensure motor data is being received.
Workspace creation in Twin Maker with associated S3 bucket and necessary roles and policies.
Entity creation in Twin Maker representing the physical motor with a component.
Component testing in Twin Maker to validate data source connectivity.
Inclusion of a 3D model of the motor as a resource in Twin Maker.
Scene creation in Twin Maker to visualize motor data with a 3D model.
Annotation addition to the scene for displaying current motor speed.
Rule creation for conditional color changes based on motor speed thresholds.
Integration of model shader for visual representation of motor speed conditions.
Grafana workspace setup for dashboard creation and data visualization.
Configuration of a data source in Grafana to connect with Twin Maker.
Dashboard creation in Grafana with panels for real-time and historical motor speed data.
Real-time data visualization demonstrating motor speed with color-coded conditions.
Tutorial conclusion summarizing the setup and functionality of AWS IoT Twin Maker.
Transcripts
AWS iot twin maker
tutorial our use case is we have a
factory where there are Motors running
on the production floor production
supervisors want to see a visual
representation of current and historical
status of these motors specifically
their
speed and this is what our overall
architecture would look
like for the purpose of tutorial we will
use one motor on AWS Cloud sitewise will
receive motor data digital twin is
created in Twin maker and visualized via
grafana let's begin by creating a motor
model in
sitewise in AWS console under AWS iot
sitewise section select
models and here hit create model provide
a model name
we will call that motor
model add an
attribute a name for that serial
number next we will add a
measurement so that will be
speed and uh unit as RPM and data type
as
double
now create
model we need to provide a default value
for the attribute so let's just call it
default hit that create
model and here we have a new Moto model
right so there you can see the attribute
and measurement
definitions next we will create an asset
in sitewise using the model we just
created select the asset submenu and
then hit create
asset and uh choose the model we just
created which is the motor model and
provide an asset name right so this is
motor
one okay and then hit create
asset so that's our motor one
asset now we will add an allies to the
measurement so for that hit edit
asset come down to the measurement
section and add a property allias of the
form SL
Factory SL motor one/ speed make sure
that mqd notification status is
active hit save now Lis is where we send
data to right so when we want to send
data to an asset
we use the property
allias okay so now we are done with the
asset
Creation in real world the motor would
send its data to AWS sitewise on the
cloud via an iot or Greengrass device in
the factory for our tutorial we will use
a python script to generate and send
motor data to
sitewise hit the cloud shell icon in AWS
console
this will open uh Linux prompt and here
I have already uploaded a send data. py
python script let's take a quick look at
that so this will send uh randomly
generated speed along with timestamp to
sitewise at the top you can see the l/f
factory SL motor one/
speeed now uh let's let's run that file
so python send dat.
py and it should send data with 1 second
intervals right so there you can see uh
double value on the right hand side
that's the speed that is being sent so
let's come to AWS console asset section
in sitewise and under
measurements against speed we can see
the latest
value right
let's focus on Twin Maker Now we will
start by creating a workspace while
doing that we will also create S3 bucket
roles and policies we
need we are in AWS iot twin maker
section hit create
workspace we'll provide a name for the
workspace Factory workspace and and we
need to associate an S3 bucket with that
so let's create an S3
bucket okay provide a bucket name we'll
call
that factory WS
bucket and uh leave everything else as
default hit create
bucket all right now go back to our
workspace creation and U associate this
S3
bucket
all right so that is Factory WS
bucket and for the execution role we
will go to the AWS section first we'll
create a
policy okay let's hit create
policy and uh choose Json and paste this
Json where we provide permissions for
twin maker sitewise and S3 now now this
is a really permissive permission now
for your production workloads make sure
that your permissions are restrictive
and you have only what you need okay now
we'll give that policy a name Factory
policy now we will create a role okay so
choose custom trust policy and uh
provide this trust policy for iot twin
maker and grafana services hit next
okay now choose the policy we had
created
earlier Factory policy hit next provide
a role name we'll call that factory
role okay and hit create role we come
back to the workspace and for execution
role we select the role we just created
Factory
role then hit next and for dashboard
management we select Amazon managed
grafana
and for grafana authentication
provider we again choose the factory
Ro hit
next and for the dashboard policy we
leave that as no video
permissions and for dashboard role we
again select Factory role hit
next review everything and hit create
workspace
so our workspace has been created
successfully now that our twin maker
workspace is ready let's add an entity
to
it choose the workspace and uh here we
are going to create an entity so from
the menu on the left select
entities okay and here hit create
entity and provide in
entity name so that will be motor
one okay and then choose create
entity now it's time to add component to
The
Entity select the entity and hit add
component here we will provide the
component name we will call that motor
and for type you will select iot
sitewise
connector and under asset model we will
select motor
model under asset motor
one and we will leave all the rest of
the properties as they
are and hit add
component so our component has been
created so we have a new motor metrix
component under motor one entity
select the test component option to test
this component to make sure that it is
connected to the right data source and
under test select speed time series
property provide
a Time range and hit run test and you
can see the
data next let's add a resource a
resource is simply a 3D model of the
physical asset so in our case it will be
a 3D model of the motor a 3D model can
be created using a variety of 3D
modeling software and it will be in a
specific file format for example
glb choose the resource Library option
hit add
resources then select choose
file and select your 3D model file it
open okay
so our 3D model file has been can added
as a
resource next we will create a scene and
add our resource or 3D model to it the
scene will be configured to show motor
data from sitewise and update the
display based on
it select scenes on the left hand side
hit create scene provide a scene ID we
will call that factory scene hit create
scene and this is our scene interface
here we can see hierarchy rules and
settings options on the left hand
side and if you hit the plus icon you
will see various submenus like add 3D
model annotations Etc select the add 3D
model option and then add a resource
from the resource Library so here we
select the motor model that we had added
earlier to the resource library and
place it here here on the scene so the
model will be loaded
shortly and uh if the model does not
appear to be of correct scale you can
change that so under transform there is
a scale property and you can change the
values of that so that the model appears
in correct
scale so that's our Moto
model you can move it around to take a
look at it from all all
sides let's explore this a bit and on
the left hand side under hierarchy you
can see that motor and when you expand
that you can see various sub models
there so these are sections of the motor
right so as you move your mouse over
them you can see various parts of the
motor getting highlighted okay and when
you select uh one of
them on the right hand side uh uh you
can see there is an inspector
panel Now using that uh plus icon let's
select the add annotation option
so this will allow us to place an
annotation on the
scene uh we'll provide details for that
in the inspector section so we'll rename
that to speed annotation where we want
to display the current speed of the
motor right and in the markdown
section we just write speed colon and
provider markdown dollar with curly
brackets and then hit add binding
option and here
select entity
ID component name and property
speed
right so let's change the binding name
we'll call that speed and update the
markdown section as
shown next we'll add a rule so under the
rule section on the left hand side let's
create a rule called motor
rule okay and uh expand that and add
statements under it so we provide an
expression something like
speed greater than say
400 okay at that point in time the
target color should
turn this particular color red okay and
uh when the speed is less than or equal
to 400 then uh the color should
be uh let's say green
okay right so when speed is greater than
400 the color is red and when the speed
is less than or equal to 400 the color
is green and we will see how to use
this now let's go to uh hierarchy and uh
expand that motor model and under that
let's select a section which we want to
highlight in different colors right so
we'll select that uh Z exag circular
object right so we will turn that into
red or green depending on the speed of
the
motor okay so with that selected we will
add a model Shader right so which will
appear under the inspector
section select the entity
ID select component
name property s speed and in addition
select the rule we just created motor
Rule now our scene is ready overall we
added a 3D model to the scene and we
added a model Shader to one of its
submodels in addition we have added a
annotation to the scene and there are
many other options that you could play
around
with now we can move on to grafana which
is a visualization tool let's begin by
creating a workspace in
grafana in ews console we are in the
Amazon manage grafana section and here
let's it create
workspace and provide a workspace name
we will call
that factory workspace
grafana okay scroll down hit
next okay choose an authentication
method we'll choose AWS IM identity
Center and uh for permission type
customer managed
and we will select
an role so this is the same role that we
created earlier Factory
role
okay and hit
next all right then hit
next okay review all the settings and
then hit create
workspace so our workspace is being
created this takes some
time and here our workspace is ready
Factory workspace
grafana in the IM identity Center under
users let's add a user so this is the
user who will be able to login into
grafana so we will associate this user
with grafana workspace so we'll call
this username
Joe and uh generate a password for that
hit next okay we need also need to
provide an email ID so so let's provide
an email
ID
okay confirm
that provide a first
name and provide the last
name and now we are ready
to hit
next all right hit
next next review all the
details add
user so not down the pass password that
has been
autogenerated in grafana workspace under
authentication assign new
user select the user Joe assign users
and
groups okay now make this user an
admin now go back to the grafana
worksspace and here hit the grafana
workspace URL this will will open a new
window and sign in
here okay provide
username
next provide
password sign
in now this prompts us to um set new
password since the previous password was
autogenerated so let's do
that okay set new
password
and now we are successfully logged in
right so this is
the grafana interface presented to
us next we will configure a data
source select the data sources option to
add a data
source and here filter by twin
maker and select that AWS iot twin
maker so this takes us to a setting
screen where we have to take a look at
the connection details so provide uh the
factory role Arn this is the role we
created earlier so provide Arn for that
and under workspace choose Factory
workspace this is the twin maker
workspace hit save and test and there
you can see twin maker data source
successfully
configured now we can create a dashboard
and panels one for the twin maker scene
and another a Time series
graph now go back to the home screen and
hit
dashboards select add new
panel and for this panel on the right
hand
side select AWS
iot twin maker scene
viewer okay now let's change the title
of this panel
we will call
it Factory Motor
panel
okay let's scroll down and under scene
select the factory scene this is the
same scene that we had created in Twin
maker so this scene should load here now
okay so that scene has loaded here in
the
UI okay now scroll down slightly and
here under data source make sure that uh
and it is AWS it twin maker for query
type select get property value history
by entity select the entity motor one
then select component motor metric and
uh selected properties select speed so
when you do that you can see that in the
panel uh speed shows
up top right hit the save option provide
a name for the dashboard we will call it
Factory dashboard okay hit
save so that's a dashboard with one
panel Factory Motor
panel for this panel select the view
option now we need to send uh data to
this particular asset so let's do that
we'll go back to our Cloud shell and run
our program python send data so this
again start sending data at 1 second
intervals randomly generated
data and here on the screen let's put
the refresh interval to 5
seconds so here you will see that a
section of the motor turns green the
zigzag uh motor part it turns green or
red depending on the speed so whenever
the speed is less than 400 it is green
and whenever it is greater than 400 it
is red
red this is working on expected
lines back to the dashboard let's select
add a new
panel and make sure that it is of type
time series and under data source it is
AWS iot twin maker query type is get
property value history by entity and
entity is motor one and
component motor
metrics and selected
properties Let's uh select speed
there and here we can see the
graph and uh we can also change the time
range so for last 30
minutes this is what the graph looks
like let's change that again
to 15
minutes and
uh how about 5
minutes to see the details in a more
granular
fashion uh in addition we can change
the view to table view right to
see raw data right as it comes in
so this is working on expected lines
let's save the
dashboard hit
save and that's our time series panel so
we will change the title to speed time
series
panel right and hit
apply back to the factory dashboard here
we can see our two panels now speed time
series panel and Factory Motor panel in
the first panel you can see the speed
data as it comes in in real time and in
the second panel you can see the motor
with a part of it turning green or red
depending on the
speed so with that we come to the end of
our AWS iot twin maker
tutorial
Ver Más Videos Relacionados
Dream Report: FT Historian Connection Configuration
Create an AAA ChatBot: how to connect Voiceflow to Make for maximizing automation; detailed tutorial
Getting Started with Microsoft Azure IoT Central using NodeMCU ESP8266
DP-203: 11 - Dynamic Azure Data Factory
How To Deploy Serverless SAM Using Code Pipeline (5 Min) | Using AWS Code Build & Code Commit
Entity Framework Setup - GRAPHQL API IN .NET w/ HOT CHOCOLATE #5.1
5.0 / 5 (0 votes)