Getting Started Guide

Introduction

Bevywise IoT Simulator is a GUI based, data simulation tool which is used to load and test the MQTT/IoT Application to know the performance level of that Application. In IoT simulator, you can create virtual IoT network and device, publish events with normal or complex JSON payload, create subscription and more. IoT simulator help documentation will let you know how to simulate IoT networks & IoT devices. For reference, refer to our introduction video tutorial.

System Requirements

OS – Windows 7 or Windows 8 & 8.1, Ubuntu 14.04 or higher, Mac 10.1 or higher

CPU – Pentium 4 or higher.

Memory – 512 MB RAM or more.

Hard drive – 100 MB of free disk space

Installation and Setup

Windows Installation and setup
  • Just Double click the downloaded“Bevywise_IoTSimulator_Win_64.exe” file to open the installation window.
  • In Installation Window, give the installation path and install it.
  • Next, open command prompt and go to the “bin” folder(< Installation path>/Bevywise/Iotsimulator/bin).
  • Now type “runsimulator.bat” and hit enter to start the IoT Simulator. Once you start the IoT simulator user interface will open in your default web browser. If not you can directly go to your browser and navigate to http://localhost:9000/
Linux / Mac Installation
  • Unzip the downloaded “Bevywise_IoTSimulator__Linux.zip.zip” or “Bevywise_IoTSimulator_Mac.zip” file and extract to the location you want, Now Bevywise folder will be created in the extracted location.
  • Open the Linux/Mac terminal and go to the bin folder(< Installation path >/Bevywise/Iotsimulator/bin).
  • To run the simulator, enter the following command : “sh runsimulator.sh”.
  • Once you start the IoT simulator, user Interface will open in the Default web browser, in which you can see the sample IoT network called Health_care. If not you can directly go to your browser and navigate to http://localhost:9000/

$ sh runsimulator.sh

Default running configuration and port
  • Default Data storage – SQLite 
  • Default user interface port – 9000. 
  • Websocket Port -12345.

Creating an IoT Network

  • To create a Network, click the bar icon on the top bar and select ” New Network”
  • Provide Network name & Description of the Network. The network name should be Alphanumeric and can have underscore.
  • After providing the details, hit create. After creating a network, the Simulator Setting window will pop-up.

Simulator Settings

1. Broker Details settings

Manager Application: Manager Application has four options, they are

  • Azure: This option is used to connect the IoT simulator to Azure IoT Hub. 
  • AWS: This option is used to connect the IoT simulator to the AWS IoT core. 
  • Other: If you want to connect the IoT simulator to any other MQTT Application or Broker, choose this option. 
  • Bevywise IoT Platform: This option is used to connect the IoT simulator to the Bevywise IoT platform.
Broker IP address
  • Here you should specify the PC IP address where Broker is running or DNS/Hostname of the MQTT Application. For example, if you want to connect to AWS IoT core, you must specify the Host or DNS name of the AWS IoT Core and suppose if you want to connect to the MQTT broker which is running in your localhost or in any server, then you must give the IP address of the PC or server where MQTT broker is running. If IoT simulator and MQTT Broker are running in the same PC or server, then give “Broker IP address” as “localhost”.

Note: The Manager Application and Broker IP address settings will not be modified after saving the Simulator settings.

TLS/SSL
  • Enable this option if the Broker or your MQTT Application is running with TLS/SSL enabled.
Broker Ports
  • Specify the Broker or MQTT Application port number. By default, if your Broker runs without TLS/SSL then the port will be 1883 and if TLS/SSL is enabled, then the port should be 8883.
Root Certificates
  • Here you should upload the root certificate of the MQTT Application or MQTT Broker. This will enable, only for TLS/SSL.
Clean Session
  • If the clean session is enabled, the broker will delete all the details about the clients after the disconnection. As a result, when the client connects next time, it will look like a new device to the broker and the actions that are in the previous session won’t affect the current section. By default, clean session will be 0.
  • Clean Session = 0, means Clean Session is disabled.
  • Clean Session = 1, means Clean Session is enabled.
2. Advanced Settings
Client IP address:

This feature will assign a separate IP address for each client in the Network. For example, if you create 5 devices, then by default the 5 devices will connect to the MQTT broker with the same IP address. But, when you enable “Client IP address” and give IP address range [like 192.168.1.2 to 192.168.1.5] in First & Last IP address, then the IoT simulator will automatically assign separate IP address for each created client or device. Now the device will connect to the MQTT Application with a different IP address. To enable, follow the below steps

  • Click the setting button on the top left corner.
  • In the Settings window of Simulator, click Advanced tab and enable the Client IP Adrress.
  • Next, specify your IP range in First IP address and Last IP address.[Support only IPV4]
  • Now the simulator will assign separate IP address for each created device.
Random Start/Stop:

Bevywise IoT Simulator will randomly stop and start the created IoT Devices based on the minimum uptime or runtime using the “Random Start/Stop” feature. For example, if you specify the minimum uptime as 50%, then the devices will randomly stop when it reaches 50% running or uptime. To enable, follow the below steps

  • Click the setting button on the top left corner.
  • In Simulator setting window click Advanced tab and enable the “Random Start/Stop”.
  • Next, specify Minimum Uptime [range for Minimum Uptime should be 1 to 100 percent].
  • Now the Simulator will randomly stop and start the created IoT devices.
Advanced Python Interceptor:

Bevywise IoT Simulator can be customized using a python-based interface called Python interceptor. This interceptor provides all the created clients’ information and its received payload via python file called “default_interceptor.py”. In that python file, you can write your own code based on the received payload and also it allows you to call API to simulate complex scenarios. To enable, please follow the below steps

  • Click the setting button on the top left corner.
  • In Settings window of Simulator, click Advanced tab and enable Python interceptor.
  • Specify the default_interceptor.py file path in Python File. Default path should be [./extensions/default_interceptor.py]
  • Start writing your code in default_interceptor.py file to customize the simulator based on received payload.
  • For reference, refer to our Simulator settings video tutorial.

Creating an IoT Device

  • Click the same   Plus Symbol  icon on the top left corner and select the “Blank Device” option.
  • In the following dialogue box, fill the Device name (Device name should be in Alphanumeric and in underscore) without any Space.
  • Fill unique Device ID (maybe in Special Character, Alphanumeric), which will give an identity for your Devices.
  • Fill Description or Function about the Device and hit the Save button.
  • A Blank device will be created without any Events on the Corresponding Network.

Configuring IoT Authentication

Edge device authentication will provide a secure connection between the MQTT application and device. Likewise, Bevywise IoT Simulator supports edge device authentication to connect the created device to the MQTT application securely. To enable Authentication,

  • Select the Device from the Device list.
  • Click the Red checkbox next to Authentication to enable the Authentication.
  • Next, give the MQTT username in Access Key and MQTT password in Access Token.

IoT simulator has two types of Authentication which help you to connect to different MQTT/IoT applications. They are :

  • SAS: With a SAS token, you can grant created clients access to your MQTT Application. It will be useful when you connect to MQTT Applications like Azure.
  • Self Signed: If your MQTT application allows access to clients with client or device certificate and key, then you can select Self Signed. Here you should upload the client certificate and key which you have got from the MQTT Application.

Note: This Authentication type will appear when you select Azure and AWS in Manager Application on Simulator Settings.

For other MQTT Application, you can directly copy & paste the client.certificate and key inside the client folder[./Bevywise/IotSimulator/Certificate]. After pasting the certificate and key, you must rename the certificate client.crt and client.key. For Root certificate, you can add it via simulator settings.

Configuration of MQTT Will Message

In case, if one of the IoT devices got disconnected due to some issue it can publish the events to the subscriber(who subscribes to the topic in that device) only when the WILL message is enabled. To enable the WILL message, select the WILL checkbox and give the topic, message, QoS, etc.

  • To enable Will message, select the device from the Device list and click the Red Checkbox parallel to the Authentication tab, it will change to the Green Checkbox.
  • Click the edit icon and give the Topic and Message.
  • We can enable Qos and Retain for Will messaging like Device Events.

Configuration of IoT Events

Events are used to create a time-based publishing message for the IoT devices. Based on the time-based publishing Message, Broker will collect the data from IoT Device and send that data to the subscriber.

  • There are Six different types of events with Customized time-based publishing.
  • To create Events, click the plus icon on the top right corner.
  • Select any features which are below the Event title.
  • We can create more than one Event for a Device.
  • Before Configuring the IoT Events you must know about the Following Parameters:
  • Topic: It is a UTF-8 string format, which is used by the broker to filter messages for each connected client. A topic consists of one or more topic levels and each topic level is separated by a forward slash (topic level separator).
  • QoS: It ensures that the events will reach the subscriber. For more information, refer to our Time based publish events video.
  • Retain message: Basically retain means keep or hold something. Likewise, in events, if the retain flag is on, then the broker will hold or keep the corresponding details and message of those events. So it will help the newly subscribed clients to get the status update
  • Events Type: Format of the events or messages to be published. Simulator support two types of events or message type, they are Text [Normal message] and JSON message.
  • Variant: It defines how the events will be sent to the subscriber. It has four types of value. They are :
  1. Constant – This value is used to publish the events in Alphabet and numbers
  2. System variables – This value is used to publish the events with the System variables like $Client_ID, $Current_time, etc.
  3. Random – This value is used to publish the events in random like when the system is ON|OFF
  4. Range – This value is used to publish the events for a certain range of numbers like 1-100
  • Message: The data which are written here will be published. It will published either in Text or JSON format, based on the message type you’ve selected.

JSON & Nested JSON

  • By using JSON, we can easily read the Published message and enclosed multiple data in a single message.
  • In the Nested JSON, we can enclose multiple Object data in a single message. Refer the example below. 
  • To create JSON, click the Plus Symbol icon and just enter the Key & Value and Click “Add”, JSON will be created automatically.
  • To Create Nested JSON, click the  Plus Symbol below the Message and Just enter the Key & Select Value as “Object” and Click “Add”.
  • An object will be added. Click the Plus Symbol icon below that Object and add the Keys and Values. Take the below example. “Accelerometer” is the Object and below that Keys and Values are nested by {}. You can add multiple objects like this.
JSON syntax

{ “ KEY 1” : “ VALUE1 ” , “KEY2” : “ VALUE2 “ , “ KEY 3“ : “VALUE 3” }

Example For Nested JSON

{

“Accelerometer”:

{

“Status”: “On|Off-RANDOM”,

“Vibration_level”: “50-55-RANGE”,

“Sensor_On_Time”: “$Client_uptime-SYSTEMVARIABLE”

},

“Gas_Sensor”

{

“Status”:”On|Off-RANDOM”,

“Methane_level”: “10-20-RANGE”,

“Sensor_On_Time”: “$Client_uptime-SYSTEMVARIABLE”

}

}

1. On connect Events
  • This Event will make the IoT Devices publish the data when it is connected to the Broker.
  • If you want to know the status of the device when it is connected to the broker, you can use this Event.
  • Select a Device from the Device list on the left side and click the Plus Symbol icon on the top left corner and Select “On Connect”.
  • In the following Dialogue box, fill the Topic, QoS, Retain & select Text or JSON for Message type and save it.
  • “On Connect” event will be created below the Event tab with the given Topic name, Date and Time. If you want to delete the events, click the Delete button.
Parameters
  • Topic: Coal_Mines/Accelerometer/Vibration_Level
  • QoS level: 1 At least once
  • Retain: 1 Set Retain Flag
  • Events Type: JSON Format
2. On Disconnect
  • These Events will make the IoT Device to publish the data before disconnecting from the Broker.
  • If you want know the status of the Device when it is disconnected from the broker, you can use this Event.
  • Select a device from the Device list on the left side and click the add icon on the top right corner and select “On Disconnect”
  • In the following Dialogue box, fill the Topic, QoS, Retain & select Text or JSON for Message type and save it.
  • “On Disconnect” event will get created below the Event tab with the given Topic name, Data and Time. If you want to delete the events, click the Delete button.
Parameters
  • Topic: Coal_Mines/Ultra_Sonic_Sensor/Depth
  • QoS level: 0 Atmost once
  • Retain: 0 Set Retain Flag
  • Events Type: JSON Format
3. Specific Time
  • This feature will make the IoT Device to publish the data for a specific time.
  • You can set any time on AM & PM to publish the data in the “Publish On” text box.
  • Select a device from the Device list on the left side and click the add icon on the top left corner and select “Specific Time”
  • In the following Dialogue box, fill the Topic, QoS, Retain & select Text or JSON for Message type and save it.
  • “Specific Time” event will be created below the Event tab with the given Topic name, Data and Time. If you want to delete the events, just click the Delete button.

Parameters

  • Publish on: 9:00 AM
  • Topic: Coal_Mines/Humidity_Sensor/Temperature_Level
  • QoS level: 0 At most once
  • Retain: 0 Set Retain Flag
  • Events Type:JSON
4. Instant
  • If you like to test our IoT Device after configuring the Events, you can use this Event.
  • After configuring the events, click the  action button  on the right side next to time column, the message will be published and we can verify it in the “Device log”. But make sure that the IoT Simulator is connected to MQTT Broker.
  • Select a device from the Device list on the left side and click the add icon on the top left corner and select “Instant”
  • In the following Dialogue box, fill the Topic, QoS, Retain, & select Text or JSON for Message type and save it.
  • “Instant” event will get created below the Event tab with the given Topic name, Data and Time. If you want to test it click the action button. You can delete the events by clicking the Delete  button.
Parameters
  • Topic: Coal_Mines/Testing/Switch
  • QoS level: 0 Atmost once
  • Retain: 0 Set Retain Flag
  • Events Type:Text
  • Variant: Random
  • Message: ON|OFF
5. Specific Duration
  • If you like to configure the IoT Device to publish the data for a Specific Duration like 9.00 AM to 10:00 AM with Interval Every of 10sec or Every min, you can use this Event.
  • Select a device from the Device list on the left side and click the + icon on the top left corner and select “Specific Duration”
  • In the following Dialogue box, select Interval like “Every 5 sec” in the “Interval” drop-down box and type the duration in “Starts at” & “Stops at”
  • Next, fill the Topics, QoS, Retain, & select Text or JSON for Message type and save it.
  • “Specific Duration” event will get created below the Event tab with the given Topic name, Data and Time. If you want to delete the events, just click the Delete  button.
Parameters
  • Interval: Every 30 Seconds
  • start at: 9:00 AM | Stop at: 1:00 PM
  • Topic: Coal_Mines/Oxygen_Sensor/Oxygen_Percent
  • QoS level: 0 Atmost once
  • Retain: 0 Set Retain Flag
  • Events Type: JSON
6. Whole Day
  • Using this Event, you can configure our IoT Device to publish the data for Every hour or Every min or sec of a day.
  • Select a device from the Device list on the left side and click the + icon on the top left corner and select “Whole day”.
  • In the following Dialogue box, select Interval like “Every 20 sec” in the “Interval” drop-down box and fill the Topics, QoS, Retain, & select Text or JSON for Message type and save it.
  • “Whole day” event will be created below the Event tab with the given Topic name, Data and Time. If you want to delete the events, click the Delete button.
Parameters
  • Interval: Every 20 Seconds
  • Topic: Coal_Mines/Gas_Sensor/Harmful_gases_Level
  • QoS level: 0 Atmost once
  • Retain: 0 Set Retain Flag
  • Events Type: JSON
7. From CSV
  • In this event, you can upload the CSV file with different payloads.
  • Based on the number of payloads in the CSV file, you can create events.
  • Select a Device from the Device list on the left side and click the + icon on the top right corner and select “From CSV”.
  • In the following Dialogue box, select start time, and fill the Topic, QoS, Retain, select the interval, upload the CSV file and click save.
  • Now “From CSV” event will create below the Event tab with the given Topic name, Qos, and Retain. If you want to delete the events, click the Delete button.
  • For more information, refer to our create events by CSV file video tutorial.
Parameters
  • Start at: 12:24 PM
  • Topic: Temperature/Room
  • QoS level: 1 Atleast once
  • Retain: 0 Set Retain Flag
  • Once in: Every minute
  • CSV upload: CSV file
  • Number of Events: 1
Event for from CSV

Configuring MQTT Subscription

  • After the event configuration, the broker will collect data from the Sensors and store in the data in DB. But the data will not be sent to the receiver. To send the data to the receiver side, you must want to Subscribe to the existing topic i.e the topic created while configuring the events.
  • Here there are two types of “Subscribe on” value. One is “on start” and another one is “Specific Time”. If you want to receive the data for the whole day, you can select “on Start” value. If you want to receive the data for a specific time, then you can select the “Specific Time” value. In Topics, give the same topic which was given in the Events, so that the MQTT Broker can easily identify the topic and send the data to the subscriber. You can add more than one topic in this tab.
  • To Create, Select a Device from the Device list on the left side and click the  Plus Symbol icon on the top right corner and select the “Subscribe to command” option
  • In the following Dialogue box, type the existing Event Topic name to subscribe to that topic & specify QoS Level and save it.
  • “Subscribe to command” will get created below the ‘Subscribe to Command” tab with topic name, QoS level and time. You delete the “Subscribe to command” by clicking the  delete  button.
Example Topics

 

FIRST TOPIC SECOND TOPIC
Subscribe on: On Start Subscribe on: Specific Time
Topic:Coal_Mines/Gas_Sensor/Harmful_gases_Level Time: 10:00 AM
Topic:Coal_Mines/Oxygen_Sensor/Oxygen_Percent
QoS: At most Once QoS: At most once m,,

Configuring IoT Device Response (Behavior)

  • Bevywise IoT Simulator has an automatic response engine that will respond to the Subscriber based on the messages & topics received. The device will publish a defined message if the required message is received on the required topic.
  • A client, who wants to set a request-response, has to subscribe to the topic it wants to set response property.
  • Make sure the Existing Event topic in which you like to create “response” is subscribed in the “Subscribe to Command”.
  • To create Behavior or Response, select a device from the Device list on the left side and click + icon on the top right corner, in that select “Behavior”.
  • In the following Dialogue box, give the same existing event topic in the “Command Topic” and give the “Command Data” for which you like to get a response. But make sure Command Data will be the same or within the range as existing event Publishing data. Then give the response topic and response message.
  • The client can also subscribe to the response topic i.e, “Event Topic”, by choosing “Subscribe to command” and can receive the response message.
  • Note that, “Behavior” will not work on the JSON message type. It will work only on the Text message type.

Start / Stop Simulator

  • To start/stop the Network i.e all device at a time, then click the dashboard and click the red icon start  button on the top right corner. If the IoT Simulator is connected to the MQTT Broker, then the Red color button will change to green color.
  • Once the whole network gets started, you can see all the Published Events in the “Network Log”.
  • In the “Network log”, Published topics message will appear in “Green Color” and Subscribe topic message will appear in “Orange Color”.
  • To stop the whole Network, click the green button on the top right corner. Now it will change to red color.

Start / Stop Simulated IoT Device

  • To start/stop the particular IoT Device, select any one device from the right side Device list and click the  start  button on the top right corner. If the IoT Simulator is connected to the MQTT Broker, then the Red Color button changes into green color. Make sure that the IoTSimulator is connected to the MQTT Broker.
  • Once the IoT Device gets started, you can see the Published Events in the “Device Log”.
  • In the “Network log”, Published topics message will appear in “Green Color” and subscribe topic message will appear in “Orange Color”.
  • To stop the whole Network, click the start button on the top right corner. Now it will change to red color.

Creating IoT Device Templates

In Templates, you can create a pre-defined device with events, subscription and device response. This will save time by creating a new device and also help you to add a bulk number of devices.

  • To create a new template click the icon on the top left corner and select Templates. Select the “Add New Template” option to create a new template.
  • Click the “Add Template” button and give the Template name & Template ID without any space and Click “Create” button.
  • A template will be created without any events. You can create events for Template, the same as the Device (For more, refer Configuration of IoT Events above).
  • Like Device, you can also Configure Authentication and Will message for Templates.

Creating Bulk IoT Devices

  • If we are implementing IoT Devices in large scale Industries, we should connect the large or bulk amount of Devices, so if we add one by one, it will take more time. For that, we can create a bulk amount of devices in a network using “Add Device from Template”.
  • You can add up to 10000 devices by a single click.
  • To create Bulk IoT Device, open the Existing Network or create a New Network. Then click the “Add device from Template” button if you’ve created New network or Click the + icon on the top left corner and select “Device from Template” option.
Create Device from Template
  • In the above Dialogue box, Select template from the drop-down list box and give the number of devices in the “No of Device” box (maximum 10000). Enter the “Device Prefix Name” and hit “Create” button.

Connecting Bevywise IoT Simulator to Microsoft Azure IoT Hub

Microsoft Azure has a built-in IoT application called IoT Hub. Azure will allow the client via TLS/SSL connection only. Message Broker will run with TLS/SSL at port 8883. There are two methods to connect to Azure IoT over TLS/SSL. They’re as follows :

  • Self-signed Certificates
  • CA Certificate
Requirements
  • Open SSL to generate self-signed certificates
  • Azure IoT hub C SDK
Self-signed
Azure configuration
  • First, you must create IoT Hub in the Azure cloud platform. For reference, check this link.
  • Once you’ve created it, open Azure IoT HUB portal.
  • In the IoT Hub portal, select “IoT Devices” from the left side panel and create a new device by clicking the ‘+’ button.
  • Specify the name[Name should be unique] and select authentication type as “X.509 Self Signed”
  • Next, to add the Primary Thumbprint and Secondary Thumbprint, you must need a self-signed client certificate. Follow the below steps to create a self-signed certificate and thumbprint for that certificate.
  1. Install OpenSSL in your environment. For windows user, please set an environmental variable for OpenSSL
  2. Open the terminal or command prompt and give the below command
  3. openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate.crt
  4. Next, skip the all other steps by clicking enter and only give the Common Name as the device name
  5. Now certificate.crt and private.key will be generated in the current location.
  6. Next, you must get the fingerprint for the created certificate which is to be uploaded in Azure IoT Hub device as a thumbprint. Use the below command to get a fingerprint for the created certificate.
  7. openssl x509 -noout -fingerprint -sha1 -inform pem -in certificate.crt
  8. Output will be similar to
  9. SHA1 Fingerprint= D7:A8:16:71:AF:22:DA:E0:AA:26:7A:48:4A:52:A5:83:B7:89:C7:96
  10. Now, copy the fingerprint alone and paste it in any text editor and remove ‘:’
  11. [For example, D7A81671AF22DAE0AA267A484A52A583B789C796]
  • Now copy the fingerprint from the text editor and paste it in both Primary and Secondary thumbprint.
  • Click save to create a Azure IoT Hub device.
Simulator Configuration
  • Before starting the Simulator, you must need an Azure root certificate. To create, follow the below steps
  1. Clone or download the zip in the Azure IoT SDK for C from github
  2. Extract the downloaded zip and go to the certs folder
  3. Inside the certs folder, open certs.c and you can see many root Certificates for Azure IoT Hub.
  4. Next, create the file with the name root.crt and copy & paste any one certificate [including the lines BEGIN CERTIFICATE and END CERTIFICATE, also remove“,\\r,\\n from all lines].
  5. Then run the IoT Simulator in your environment.
  • Create a new network.
  • After creating a new network, the Simulator Setting windows will appear.
  • In that, change the Manager application as Azure IoT.
  • Next, give the Azure IoT hub Hostname in Broker IP Address.
  • In Root-Certificate, browse and upload the root.crt file which you’ve copied & pasted from Azure IoT SDK github.
  • Once you’re done, click save to save the configuration.
  • Next, create a device with the same name which you have given while creating IoT device in IoT Hub.
  • After creating the device, enable authentication by clicking the red checkbox next to Authentication.
  • In the drop-down, select the Authentication type as Self Signed.
  • In the drop-down, upload the created certificate.crt & private.key file and click upload.
  • Next, give Access Key by using the below syntax and click save
  • “< hostname >/< devicename >“
  1. hostname – Azure IoT Hub hostname
  2. devicename – The name of the device
  • Leave Access Token tab empty.
  • Next, create events for the device by using the below topic syntax.
  1. Publish event topic – “devices/{devicename}/messages/events/ ”
  2. Subscribe topic – “devices/{devicename}/messages/devicebound/#”

Note: Change the device name alone. Other than that don’t change any other field.

  • Start the network by clicking the start button and if the connection is successful, you can see the published message in the simulator Network log or device log.

Connecting Bevywise IoT Simulator to AWS IoT core.

AWS platform as a built-in IoT platform is called as AWS IoT core. AWS will allow client via TLS/SSL connection only and has Message Borker running with TLS/SSL at port 8883. Below steps will help you to connect IoT Simulator to AWS IoT core

AWS Configuration
  • Login to AWS account
  • Click on services and select AWS IoT core
  • Create a device policy by clicking “Secure” on the left side. Then select policies
  1. Give policy name and in the action section give iot:*
  2. Resource ARN give *
  • Click “Create a Single Thing” to create a Device/thing
  • Give a name to the device in the “NAME” field & select “THING TYPE” if you’ve already created or create a new one and select that. After that, click Next.
  • Follow the below steps to create “Thing TYPE”
  1. Click the “Create a type” button next to the Thing type drop-down box.
  2. In “Create a type” window give the type name and description. Except this every fields are optional.
  3. Click “create thing type” to create a thing type.
  4. Now select the create thing to type in the “THING TYP” drop-down box.
  • Click “Create Certificate” to download TLS/SSL certificate for AWS IoT Core.
  • AWS IoT itself generate certificates for you as AWS uses TLS for device communication

 

  • Download first & last certificate and download the root certificate that is found above the “Activate button”
  • Click on the activate button to activate the created device.
  • Next, click the “Attach Policy” button. In that window, select the policy that you have created and click “Register Thing”
Simulator Configuration
  • Rename the downloaded *****.crt file to client.crt and *******.key as client.key.
  • Also, rename the downloaded root certificate as root.crt.
  • Copy these certificates as instructed.
  • Client.crt and .key file in Bevywise/IOTSimulator/Certificates/client
  • Next, run the IoT Simulator in your environment
  • Create a new network
  • After creating a new network, the Simulator Setting windows will appear.
  • In that, change the Manager application as AWS IoT
  • Next, give the AWS IoT Hostname which is present in the settings menu in AWS IoT Core in Broker IP Address.
  • In Root-Certificate, browse and upload the root.crt file which is downloaded from the AWS IoT
  • Next, click Advanced and change “Clean session” as “1″ and save the configuration
  • Create a device with the same name, which you have given while adding Device to AWS registry [refer steps 4 & 5 ] in AWS configuration.
  • Create events for the created device.
  • Start the network by clicking the red color start button and if the connection is successful, you can see the published message either in the simulator Network log or device log.

Connecting Bevywise IoT Simulator to Bevywise IoT platform

Bevywise IoT platform configuration

Bevywise IoT platform as a demo server called Device manager for users to test the IoT platform. Follow the below steps to connect IoT Simulator to the Bevywise IoT platform.

  • Sign-in and login to Device manager. After login, you can see the Device Manager user interface.
  • In the user interface, click the Security tab on the left side panel.
  • In the Security window, click Plus Symbol button to create new Authentication keys.
  • In the “Device Authorization Key Generation” window, give the key description and select permission for the keys and click save.
  • Now you can see the newly added Auth key and the Auth token. Here the Auth key will act as the username and Auth token as the password.
IoT Simulator Configuration
    • Start the IoT Simulator in your environment
    • Create a new network
    • After creating a new network, the Simulator Setting windows will appear.
    • In that, change the Manager application as Bevywise IoT Platform
    • Next, leave the Broker IP address, port number, and root certificate as default.
  • Once you’re done, save the configuration.
  • Create a device and enable authentication by clicking the red checkbox next to Authentication.
  • In drop-down, click the edit icon that is next to the Access key. Copy & paste the Auth key from the Device manager and click save
  • For Access token, copy & paste the Auth token from Device manager and save it
  • Create events and publish messages.After that start the simulator.
  • Start the network by clicking the start button and if the connection is successful, you can see the published message either in simulator Network log or device log and also in the Device manager dashboard or user interface.

Connecting Bevywise IoT Simulator to other MQTT/IoT Applications

If you’re using MQTT/IoT application other than AWS, Azure or Bevywise IoT platform,

  • You should download the root certificate, client certificate and client key from your IoT application.
  • Note down the hostname of the IoT application
  • Also if your IoT application has the option to create an IoT device with it, create the device and choose the suitable Authentication type which was supported by the IoT simulator.
Simulator Configuration
  • Rename the downloaded *****.crt file as client.crt and *******.key as client.key.
  • Also, rename the downloaded root certificate as root.crt.
  • Copy these certificates as instructed
  • Client.crt and .key file in Bevywise/IOTSimulator/Certificates/client
  • Next, run the IoT Simulator in your environment
  • Create a new network
  • After creating a new network, the Simulator Setting windows will appear.
  • In that, change the Manager application as Others
  • Next, give your MQTT/IoT Application hostname in Broker IP Address and enable TLS/SSL only if the MQTT application runs with TLS/SSL. After that mention the port number and save the configuration.
  • Create a device with the same name which you have given while creating an IoT device in your MQTT application. Suppose if you haven’t created any IoT device in your MQTT/IoT application, then create the device as per your wish.
  • Next, create events and publish messages and then start the simulator.
  • Note: If your MQTT Application has some topic restriction, then you must create an event with that topic format. For example, refer Azure IoT Hub
  • Start the network by clicking the start red button and if the connection is successful, you can see the published message either in the simulator Network log or device log.
  • Note: For more help and support to connect IoT Simulator to your own MQTT Application, please contact Bevywise Support team

Connecting IoT Simulator to MQTT Broker

This section helps you to connect IoT Simulator to MQTT Broker. Below, we have shown the connection of IoT simulator to MQTT Broker with TLS/SSL and to MQTT Broker without TLS/SSL.

For more information, refer to our video tutorial.

Connecting to MQTT Broker running with TLS/SSL enabled.
MQTT Broker configuration
  • The maximum number of MQTT brokers in the market will not provide client & root certificates. For that you can create your own self-signed root, server, and client certificates. To create, refer to this link. But if your MQTT Broker provides a client & root certificate, you can download and use it.
  • Once you got the certificates, rename the client certificate as client.crt and client key as client.key and paste the certificate as follows:
  • Paste Client certificate & key –> Bevywise/IotSimulator/Certificate/client
  • Also, rename the downloaded root certificate as root.crt and save it in any location.
  • Now, enable the TLS/SSL in MQTT Broker and check the port number[ by default 8883 port]
Simulator Configuration
  • Start the Simulator in your environment and it will lead you to an IoT simulator user interface.
  • Next, create a new network and the Simulator Setting windows will appear.
  • In the Simulator settings, choose as follows:
  1. Manager Application – Others
  2. Broker IP Address – IP address of PC or server where you run the MQTT Broker
  3. TLS/SSL – Enable
  4. Port – By default 8883, if your MQTT broker runs in a different port, specify here.
  5. Root certificate – Upload the root.crt file which you have created or downloaded before[ Don’t forget to click upload]
  • Once you’re done, save the configuration.
  • Next, create devices and events with published messages.
  • [Only for Authentication enabled in the MQTT Broker] – If Authentication is enabled in the MQTT Broker side, then you can enable authentication by following the below steps. But if the Authentication is disabled in the MQTT Broker side, skip this step.
  • click the red checkbox next to Authentication.
  • In drop-down, click the edit icon next to the Access key and paste the username from MQTT Broker and then save it
  • For Access token, paste password from the MQTT Broker and save it.
  • Start the network by clicking the start button and if the connection is successful, you can see the published message either in the simulator Network log or device log.
Connecting to MQTT Broker running without TLS/SSL enabled.
MQTT Broker configuration
  • Start the MQTT Broker in your environment.
  • Check the running port of MQTT Broker[by default 1883]
Simulator Configuration
  • Start the Simulator in your environment and it will lead you to an IoT simulator user interface.
  • Next, create a new network and the Simulator Setting windows will appear.
  • In the Simulator settings, choose as follows:
  1. Manager Application – Others
  2. Broker IP Address – IP address of PC or server where you run the MQTT Broker
  3. TLS/SSL – Disable
  4. Port – By default 1883, if your MQTT broker runs in a different port, specify here.
  5. Root certificate – Leave it as such

 

  • Once you’re done, save the configuration.
  • Only for Authentication enabled in MQTT Broker – If Authentication is enabled in the MQTT Broker side, then you can enable authentication by following the below steps. But if the Authentication is disabled in the MQTT Broker side, you can skip this step.
  1. Click the red checkbox next to Authentication.
  2. In drop-down, click the edit icon next to the Access key and paste the username from MQTT Broker and then save it
  3. For Access token, paste password from the MQTT Broker and save it.
  • Next, create devices and events with published messages.
  • Start the network by clicking the start button and if the connection is successful, you can see the published message either in the simulator Network log or device log.

Using Protocol Buffers

Protocol buffers are google’s structured format that are used to serialize and encode your data. You can specify how your data should be in a structured format and you can make such structured data easy to read & write using the language you prefer.

Here is a step by step procedure to use protocol buffers in python. You can follow the below steps to add Python support for MQTT payload of Protocol Buffer type in Bevywise IoT Simulator.

Start compiling .proto file

  • Depending upon your requirement, create .proto file
  • Following is an example for .proto type file. As per your requirement, you can make your own .proto file

syntax = “proto2”;
package screen;

message Payload {
optional string contrast_ratio = 1;
optional string viewing_tech = 2;
optional string color_depth = 3;
optional string touch_type = 4;
optional int32 ntsc = 5;
optional int32 temperature = 6;
optional int32 backlight_longevity = 7;
optional int32 luminance = 8;

}

  • Compiling the .proto file is the next step. You can compile it using protobuf compiler. The compiler then generates a Python file.

(Note:) Protobuf compiler can be installed using the following command : $ sudo apt install protobuf-compiler.

If you are using Bevywise MQTT Broker, you have to download binary MQTTRoute to get utilized with the protocol buffer. Use this link to download binary MQTTRoute. Then follow the similar steps of connecting Bevywise IoT simulator with MQTTRoute. Before connecting the simulator, you have to add protocol buffer support to both simulator & MQTTRoute. Let’s start doing it.

Add Protocol Buffer support to MQTTRoute

  • Copy the protobuf class file which is generated by the compiler. Paste it in Bevywise/MQTTRoute/extensions/
  • Then copy the custom_store.py to Bevywise/MQTTRoute/extensions/. Let the file undisturbed if it already exist in the extensions folder.
  • In the next method “handle_Received_Payload()” in Bevywise/MQTTRoute/extensions/custom_store.py, replace the imported ProtoBuf class name with the one used. Modifications can be done if needed.
  • In Bevywise/MQTTRoute/conf/data_store.conf, change the settings of custom storage from disabled to enabled. (CUSTOMSTORAGE = ENABLED)
  • Google protobuf needs to be installed in MQTTRoute/lib. This can be done in two ways. First is by extracting the google.zip and copying the directory ‘google’ into MQTTRoute/lib. And the second way to install it via pip into the lib folder. For the second method, you can use the following command : $ pip install protobuf -t MQTTRoute/lib
  • After completing this method, run the MQTT Broker

Add Protocol Buffer support to IoT Simulator

  • Copy the protobuf class file which generated by the compiler to Bevywise/IoTSimulator/lib folder
  • Copy the file named default_interceptor.py to Bevywise/IoTSimulator/extensions/
  • In the next method “on_before_send()” in Bevywise/IoTSimulator/extensions/default_interceptor.py, replace the imported ProtoBuf class file with the one used. Modiciations can be made if needed.
  • Once the above steps are done, you can run the simulator.

Then navigate to the user interface of IoT Simulator.

Go to the python interceptor field which is present in the Advanced tab on the settings option. Enable the Interceptor and point to interceptor file by choosing ‘Enabled’ option. In the ‘Python file’ text box, add the path of the new file, if default interceptor is not used.

In the Simulator UI, choose an existing device or create a new device. Also create an event that corresponds to the .proto file which is used.

  • Choose a device or create a new device by selecting the ‘+’ symbol 
  • Choose an event or create an event by choosing the ‘+’ sign
  • Give a topic to it
  • In the Message Type, choose JSON.
  • Enter the keys and values corresponding to the .proto file which is used.

For instance, paste the following commands into the message text area.

{“luminance”: “100-1000-RANGE”, “color_depth”: “65M-CONSTANT”, “temperature”: “1-100-RANGE”, “ntsc”: “45-60-RANGE”, “contrast_ratio”: “200:1-CONSTANT”, “backlight_longevity”: “20000-60000-RANGE”, “touch_type”: “capacitive-CONSTANT”, “viewing_tech”: “oled-CONSTANT”}

MySQL Configuration

By Default, IoT Simulator will run with SQLite. But for more device connection or load testing, SQLite is not efficient. For that case, you can change the storage configuration to MySQL. Before configuring MySQL in IoT Simulator, you must install MySQL 5.7 or higher on your PC. After installing MySQL, please follow the below steps.

For Linux and Mac user:
  • Open the Terminal and go to ./Bevywise/IoTSimulator/bin.
  • Run “sh installer.sh”. This file will install all the dependence and MYSQL-connector
  • Install MySQL 5.7 server or higher.
  • Go to ./Bevywise/MQTTRoute/conf and data_store.conf
  • In data_stor.conf, set DB_SERVER = MYSQL and give MYSQL username and password.
For Window/Windows server users:
  • Right-click  on the ‘My Computer’ folder in the desktop.
  • Choose Properties from the context menu.
  • Click the Advanced system settings link.
  • Click the Environment Variables. In the System Variables section, find the PATH environment variable and select it. Choose Edit. If the PATH environment variable does not exist, click New.
  • In the Edit System Variable (or New System Variable) window, specify the path where wget.exe is located. Click OK. Close all other remaining windows by clicking OK.
  • Open cmd and go to ./Bevywise/MQTTRoute/bin
  • Type installer.bat and hit enter. This file will install all the dependence which is required to establish the connection between MQTTBroker and MySQL
  • Dependency gets installed after running the “installer.bat” file
  • Python 2.7
  • Pip 2.7
  • Mysql-connector-python
  • Note: The Above dependencies can skipped if it is already installed in PC.
  • Once the “installer.bat” got installed successfully, open db.conf [./Bevywise/IotSimulator/conf] in file.
  • In that file change the following :
  • DB_Server = MYSQL
  • Also, give the MySQL username and password below the DB details.
  • Note: Check whether MySQL is running on 3306 port.
  • Note: Please don’t use XAMPP or MAMP for MySQL.
  • MySQL for Window [Windows (x86, 32-bit), MSI Installer]
  • MYSQL MAC [macOS 10.14 (x86, 64-bit), DMG Archive]
  • Python installation in windows
  • If you run the installer.bat file, python2.7 will be downloaded  automatically and the installation will start at once it gets downloaded. [The python installation step can be skipped if it is already installed]
  • Follow the below steps in order to install python2.7:
  • Following window will show up. In that, select the first option and click next

Download Bevywise IoT Simulator for free