Python Forum
Create sensor data for a IoT project
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create sensor data for a IoT project
#1
Hi all,

Trying to do a little personal IoT project, well 2...

One simulating a Factory with multiple sensors of various types and 2nd a race car team with multiple cars with sensors, so well pretty much the same... basically a container with multiple sensors types and numbers.

Anyone done something similar before, I don't want to simply generate the values between 2 ranges as it might look if we look at say a temp sensor as if the readings are jumping up and down. Or we need to have say a random value that gets added or removed from the current value to create a delta ? thinking out loud.

G
Reply
#2
Anyone...

G
Reply
#3
IoT is very complex thing: there are several designs and scenarios. For example:

- do sensors talk to cloud directly or through gateway (compute at-the-edge)
- how dirty the sensor data is and how it’s cleaned (towards no false positives or no false negatives). There will be gaps and readings that doesn’t make sense
etc

Microsoft Azure has IOT plan. 50000 sensor readings per month free of charge (haven’t checked it lately though)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#4
I work currently on a project, where I receive measurement data over a serial interface.
Generating random Test-Data is not very good, because it will be very noisy.

Example:
   


import random
import matplotlib.pyplot as plt


def random_delta(size, start_value, min_delta, max_delta, precision=1):
    value_range = max_delta - min_delta
    half_range = value_range / 2
    for _ in range(size):
        delta = random.random() * value_range - half_range
        yield round(start_value, precision)
        start_value += delta


plt.plot(list(random_delta(200, 10, -1, 1)))
plt.show()
   
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#5
Generally speaking, at the edge of an IoT system, there are sensors connected to some prototyping boards. In this context, the prototyping board controls the sensors and acquires data from them. At this level, there are also actuators, which are devices that we can use to intervene in the physical world.
Reply
#6
Hi dead_Eye

ye thats my issue also, jsut using a random function will create a random noise,

looking for someone that might have written something a bit more intelligent...

or might have access to a datafile from a real world set of sensors: Temp, pressure, rpm, speed, flow rate,

looking for approx 10 streams, use less... water temp and engine temp I can simulate by taking one and upping the others level by say 50 deg c.

water flow rate can be used to simulate a belt speed also, by increasing decreasing it by x.

this way the lines don't look just like random noise.

G

(Dec-14-2019, 02:26 AM)DeaD_EyE Wrote: I work currently on a project, where I receive measurement data over a serial interface.
Generating random Test-Data is not very good, because it will be very noisy.

Example:



import random
import matplotlib.pyplot as plt


def random_delta(size, start_value, min_delta, max_delta, precision=1):
    value_range = max_delta - min_delta
    half_range = value_range / 2
    for _ in range(size):
        delta = random.random() * value_range - half_range
        yield round(start_value, precision)
        start_value += delta


plt.plot(list(random_delta(200, 10, -1, 1)))
plt.show()

little bit of background,

A:) I'm trying to simulate 5 factories... 100 sensors min each, maybe more towards 200/300... pushing data every minute, I'll have collector processors that in this case would actually run this random generate code (in real world they would be getting data from the sensors.

The idea these collectors would push the data onto a Kafka topic.

B:) think 5-10... race teams, each team 4 cars, each car 20sensors, each sensor pushing 1 data point/second. All grabbed/received by a collector, all collectors pushing onto a topic.

All received, and graphed using Grafana.

so data that looks more than just noise would be great as it will display better on the Grafana dashboard.

G
Reply
#7
I'm not working in the cloud, anywhere close to Azure, but would be great to get access to these 50000 sensor readings ? can you explain what they have on offer in a bit more detail.

G


(Dec-13-2019, 04:09 PM)perfringo Wrote: IoT is very complex thing: there are several designs and scenarios. For example:

- do sensors talk to cloud directly or through gateway (compute at-the-edge)
- how dirty the sensor data is and how it’s cleaned (towards no false positives or no false negatives). There will be gaps and readings that doesn’t make sense
etc

Microsoft Azure has IOT plan. 50000 sensor readings per month free of charge (haven’t checked it lately though)
Reply
#8
(Dec-15-2019, 04:05 PM)georgelza Wrote: A:) I'm trying to simulate 5 factories... 100 sensors min each, maybe more towards 200/300... pushing data every minute, I'll have collector processors that in this case would actually run this random generate code (in real world they would be getting data from the sensors.

I guess you can do this with my example (you've to modify it). You need to know the rate of change. For example a temperature sensor never jumps from 0°C to 100°C.

For gas sensors there is the T50, T70 and T90 value.
Quote:Response Time (T50) refers to the time it takes the sensor to respond with an output signal that is 50% of the full value of the gas being detected; i.e. if the sensor is exposed to a methane concentration of 2% by volume, it would take the sensor 10 seconds to give an output equivalent of 1%

I guess you've already the specification, which sensors to use.
You have too know about the characteristics, then you can model a value-generator for it.
Here is an example: https://cdn.sick.com/media/docs/8/68/668...041668.PDF
Response Time: (T50) 10 seconds

So my example is not enough, because the time is missing.
Measuring temperature is not an easy task.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#9
Azure IoT Hub is for handling the data, not generating it.

Quote:The IoT Hub Free Edition is intended to encourage proof of concept projects. It enables you to transmit up to a total of 8,000 messages per day, and register up to 500 device identities. The device identity limit is only present for the Free Edition.

/.../
The messages sent by devices connected via the free edition are metered in 0.5 KB blocks. For instance, if the device sends a 16 KB message via the IoT Hub free tier it will be billed as 32 messages.

/.../
The maximum message size for message sent from the cloud to a device is 64 KB /../ using the free edition are metered in 0.5-KB blocks. For instance, an 8-KB message sent via the IoT Hub free tier will be billed as 16 messages.

There is bundle of free services for first 12 month on top of that.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#10
So used the basics of your code to create random data, pushing it into a redis database... from where I then suck and publish it, that way I can use the exact same values repeatedly, with only different sleep times between messages.

But keen to define different sensor types and define (going to need help here) a algorithm for each to create more "real" data.

so far:
  • temperature
  • pressure
  • fluid level
  • fluid flow rate
  • brightness
  • ?

G

(Dec-16-2019, 09:02 AM)DeaD_EyE Wrote:
(Dec-15-2019, 04:05 PM)georgelza Wrote: A:) I'm trying to simulate 5 factories... 100 sensors min each, maybe more towards 200/300... pushing data every minute, I'll have collector processors that in this case would actually run this random generate code (in real world they would be getting data from the sensors.

I guess you can do this with my example (you've to modify it). You need to know the rate of change. For example a temperature sensor never jumps from 0°C to 100°C.

For gas sensors there is the T50, T70 and T90 value.
Quote:Response Time (T50) refers to the time it takes the sensor to respond with an output signal that is 50% of the full value of the gas being detected; i.e. if the sensor is exposed to a methane concentration of 2% by volume, it would take the sensor 10 seconds to give an output equivalent of 1%

I guess you've already the specification, which sensors to use.
You have too know about the characteristics, then you can model a value-generator for it.
Here is an example: https://cdn.sick.com/media/docs/8/68/668...041668.PDF
Response Time: (T50) 10 seconds

So my example is not enough, because the time is missing.
Measuring temperature is not an easy task.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 1,072 Feb-16-2024, 12:02 AM
Last Post: deanhystad
  Create X Number of Variables and Assign Data RockBlok 8 977 Nov-14-2023, 08:46 AM
Last Post: perfringo
  Better python library to create ER Diagram by using pandas data frames as tables klllmmm 0 1,150 Oct-19-2023, 01:01 PM
Last Post: klllmmm
  Create simple live plot of stock data dram 2 2,938 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
  Trying to Get Arduino sensor data over to excel using Python. eh5713 1 1,726 Dec-01-2022, 01:52 PM
Last Post: deanhystad
  Create a function for writing to SQL data to csv mg24 4 1,179 Oct-01-2022, 04:30 AM
Last Post: mg24
  An important question is how to create a zigzag in price data? epsilon 0 1,313 Nov-18-2020, 08:06 PM
Last Post: epsilon
  PyTest >> Yaml parsed data to create api test request AmR 0 1,850 Apr-14-2020, 11:41 AM
Last Post: AmR
  Project, Reading Data from a spreadsheet. Error message!! Shafla 1 5,226 Sep-27-2019, 10:44 AM
Last Post: buran
  Code Wireless Temperature sensor and send sensor readings to google sheet jenkins43 0 2,203 Nov-29-2018, 12:44 PM
Last Post: jenkins43

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020