How to create a Virtual Device

Blog How to create a Virtual Device

Have you ever had an idea for a project, but never started it because you didn't have the necessary hardware on hand? With Virtual Devices we want to solve this problem. In this tutorial we will learn how to start prototyping with just a laptop and a relayr account.


Create a new device

Log in to your relayr dashboard and navigate to the devices section. Once you're there, please click on "Add new Device".




Continue without a Device Model

Since we are prototyping, we don't need to select an existing device model. That way we have the flexibility to send any readings that we want, and the dashboard will be able to interpret them.




Select the node.js template

For this example we will use the node.js template, since node.js is smoother and more elegant code writing experience. Notice that when we change it in the dropdown menu, the code and the library changes accordingly.




Download the code and libraries

Go to relayr's Documentation Center


The necessary code and libraries have been neatly generated so that you can use them right away:

  • Make sure you have node.js installed.
  • Create a folder for your project and add the downloaded package.json file.
  • Add a file called index.js and copy the generated code.
  • In your command line, navigate into the folder, and run "npm install".
  • Once the libraries are downloaded and installed, run "node index.js".
  • Click on the test button and see if you are getting data. Once the process is finished, you'll see it in the devices page.



Give it a name

Finally select a name to identify the device.




Stream data

See the data in our dashboard or stream it using one of our libraries.





You've created your first Virtual Device! Just edit the code until you are happy with the data that you are sending and receiving.


Go to relayr's Documentation Center


Check out our libraries and examples to stream data using your favorite language. Here's an example using the Java SDK.


But don't stop here! Go ahead, buy or create your device and start developing for the real world!