Simulated IoT Environment


Simulated IoT Environment is useful in many cases:

  • to learn a new IoT concept/application
  • to verify system design assumptions
  • to test data models
  • to simulate physical devices during the back-end development
  • to perform a load-test of the back-end system

Those are the most common use cases based on my experience.

Today I will talk about a simulated environment focused on application, communication, and data modeling.

I will not cover the physical layer and low-level firmware simulation (I do not have hands-on, production experience in those areas).

Simulated entities

Those are the most common entities represented in simulated IoT environments:

  • connected devices
  • OPC-UA servers
  • MQTT brokers
  • edge gateways
  • local IT systems
  • back-end/cloud

There are multiple ways to create a simulated IoT environment - I will show the approach that works for me.

Sophistication levels

To keep this post organized, I propose three sophistication levels of simulated entity. The level of details you want to simulate for a given entity (i.e. edge gateway) will depend on a specific project.

If your engagement is focused on the edge gateway deployment, you will simulate it in great detail (and simulate connected devices in a simplified way (or not)).

⚠️Very important: before you start building your simulated IoT environment, you should define the business use case - “what do I want to achieve using this environment”?

Do not jump into development before you can answer this question.

Once you know what you need, you can assign the sophistication level to entities you will simulate.


By low sophistication, I mean simulating some entity as easily as possible and focusing only on required aspects.

I typically create a Python script to simulate the MQTT communication between a device and the MQTT broker.

The Paho Python Client provides a client class with support for MQTT v5.0, MQTT v3.1.1, and v3.1 on Python 2.7 or 3.x. That is a great tool to create a simulated IoT device. It allows modeling simple MQTT communication and extending it with advanced features of this protocol when needed.

Using Python script, you can simulate:

  • sensor readings
  • device logic
  • connectivity issues

Sometimes you care only about the MQTT communication (device –> broker) or want to trigger some action on the back-end/cloud via the MQTT message. In those cases, I recommend further simplification and using the command line Eclipse Mosquitto MQTT Client.

lmtx@lmtx: mosquitto_pub --help
mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.

Those are just examples, feel free to use other languages than Python and other tools than Mosquitto. I mentioned those cause I use them myself.

It is totally fine to increase the sophistication level for a given entity once you feel it would be beneficial for your project.


What if you want to simulate a more complex use case - for instance, the fleet provisioning?

Simplified Fleet Provisioning process using AWS Cloud looks as follows:

  • Devices are manufactured with a provisioning claim certificate and private key embedded in them.
  • They can exchange manufactured credentials for unique device certificate.
  • In the process device generates a certificate signing request and keeps the private key secure.

You can implement this use case using Python script, but that would not be an effective approach (if you want to provision multiple simulated devices this way).

In such cases, I recommend using Docker.

You can create a Docker Image with embedded device logic and provisioning credentials. Docker Images are static - they can emulate devices in the manufactured state.

Using a single Docker Image, you can spawn multiple Docker Containers - a running container can emulate a provisioned device.

This way, we separated multiple instances of unique devices ‘provisioned’ from a single Docker Image. You can attach (connect) to any of the running containers to inspect generated credentials and unique device configuration (generated from the configuration template file you burned into the Docker Image).

Once again, Docker is just a sample tool - use a tool that you know and prefer. If you are just starting your IoT journey, I highly recommend you learn the basics of Docker - that is a very handy tool in the IoT space.


High sophistication means that you want to simulate an entity as accurately as possible. The typical example is the edge gateway server.

I use a virtual machine with hardware and OS setup similar to the production environment. Additionally, I configure network constraints to simulate the target environment (open ports, white/black listed domains, etc.).

Once I have the base infrastructure deployed (i.e. using the CloudFormation), I simulate the Operating System level configuration.

You should automate the configuration setup for every environment (the simulated environment is not an exception to this rule). For OS and application-level configuration, I recommend the Ansible.

After you create the simulated edge gateway, you can use a less sophisticated approach to simulate devices communicating with it (provided that approach would realize your business use case).


This was not meant to be a comprehensive guide on how to create a simulated IoT environment. I wanted to present my approach when I design and build a simulated IoT environment.

I hope that this post was useful for you.

Feel free to reach out in case of any questions!

Support quality content❤️ Donate💰

Sign up for news: (by subscribing you accept the privacy policy)