Creating random data on devices

How can I make the devices generate random data on its own?

Hello, @thadam.pm

You can generate random data using Google Sheets. To do this, follow the steps below.

Create a new analysis with the “Simulating devices with GoogleSheet” example

Now select the device you want to receive the random data and copy that device’s token

image

Go back to your analysis, and create a new environment variable using your device token

After that, go to your Google Drive and create a new spreadsheet.

Now, to populate your spreadsheet, place the variables in the first row and the data for that variable in the lower rows. For data to be random use the command “= RANDBETWEEN (low; high)”. In the image below, I used in all cells the command “= RANDBETWEEN (10; 30)”.

image

Click on the Share button and then click on “Advanced”

Now click on the “Change” option

image

Select the option highlighted in the image and save the setting

image

Now copy the spreadsheet link

image

Go back to the analysis on TagoIO and add a new environment variable with a “url” key and the value being the link you copied in the step above.

Your analysis is ready, you can set a time interval to run your analysis or click the “Run” / “Save and Run” button.

I hope this helps you and anyone else who wants to simulate random data for some device. To simulate for more devices, just create another analysis and follow the steps explained here.

Thanks!

1 Like

Thank You Kelvin. :+1:

And if you want to create more than 1? With independent values? Hundreds? Thousands?

You can use MIMIC MQTT Simulator, eg. in this 2-minute video of a vehicle fleet.

The temperature is random, whereas the GPS coordinates are deterministic, and the speed is
controllable. Eg. if you wanted to do reactive analytics, you could monitor speed, and if 0
for a while, call the repair truck. You could do predictive analytics to reduce breakdowns
by monitoring engine temperature and other telemetry and correlate to schedule maintenance.

2 Likes

Hey Kelvin,

Trying to use google sheets as a data feed, every time i run it i’m getting the below error…basically it is not working, what could be the problem?
[2020-02-17 15:04:43] Variable field should NOT contain special characters such as *?!<>.-=$ or space
[2020-02-17 15:04:43] Running script
[2020-02-17 15:04:42] Starting analysis 5e4afa70cf64f8002654497b

Hi @Nicolas

I’ve had the same problem as you previously, to solve, I did the following steps:

1 - Select all variable names in your Google spreadsheet. The names are all the non-empty cells that are in the first row of your spreadsheet.
2 - Press the delete button to delete them and remove any hidden formatting or characters that may be in these cells.
3 - Rewrite the name of the variables in these cells, be careful with formatting. Keep everything in lowercase and use only the underline character for separation. Also remove any settings other than the default for these fields such as color, line break, centering, etc.

Now, try again. The steps outlined above worked for me, but there is no guarantee that they will work for you too. If you still have problems, let me know in this post and send me more details of your spreadsheet.

Thanks!

This is the link to the google sheet, can you try it your your side?

Another different subject, have you worked with Bosch XDK before?

Hi, @Nicolas

I managed to use your spreadsheet smoothly here. Can you confirm to me that you have set the environment variables correctly? They should look like the image below:

If you have it all set up, you only need to run Analysis. Let me know if you’re still having trouble.

And regarding your question about Bosch XDK, unfortunately I never got a chance to work with that. :confused:

Thanks!

Well, seems to be fine now, i had the device_token first then the url entry, now when i switched the order, it seems to be working…not sure if that was the problem. The run action can’t be less then a minute?

Anyway i want to on board an actual physical sensor , so Bosch XDK is a good option because it has 7-8 data points you can collect from…beside bosch XDK, any other device sensor that you worked with that you recommend?

Thanks,

Nicolas

Hi, @Nicolas

You are right, the Action by schedule can’t be less then a minute.

Regarding the device recommendation, I haven’t a specific recommendation for you. But, you can check the MQTT devices in the Add Devices list on the platform. To know more details about them, just select them and a modal with more information will appear.

Thanks!

Hi kelvin,

Can you help me please parse this raw payload into tago JSON format, so it can be stored in the bucket and displayed
on dashboard? I got this from Live Inspector.

21:58:19:

[POST] MQTT Request:

“From: ::ffff:10.0.2.48 - Content-Type: JSON - Token Ending: d38c5”

“From: ::ffff:10.0.2.48 - Content-Type: JSON - Token Ending: d38c5”

21:58:19:

Raw payload:

{ “acc”: { “x”: “-4”, “y”: “1”, “z”: “1031” }, “mag”: { “x”: “52”, “y”: “-13”, “z”: “-29” }, “gyr”: { “x”: “61”, “y”: “-61”, “z”: “-122” }, “env”: { “l”: “0”, “r”: “66”, “p”: “99345”, “t”: “24.341” } }

{ “acc”: { “x”: “-4”, “y”: “1”, “z”: “1031” }, “mag”: { “x”: “52”, “y”: “-13”, “z”: “-29” }, “gyr”: { “x”: “61”, “y”: “-61”, “z”: “-122” }, “env”: { “l”: “0”, “r”: “66”, “p”: “99345”, “t”: “24.341” } }

Thanks,

Nick