Hans on IoT

Things peak,matlab和物联网

实时地震交通监控,用ThingsPeak,Matlab和Raspberry Shake进行

We’ve set up a new way to monitor the traffic and made some unexpected discoveries using MATLAB along the way. You may be familiar with the ThingSpeak交通监视器渠道它使用来自网络摄像头的图像处理来计算繁忙的高速公路上的汽车。我的朋友和合作者Alan Kafka在韦斯顿天文台,波士顿学院和雷瑟的杰伊·普利(Jay Pulli)让我知道,我们可能能够通过地震分析来验证交通数据。所以,我们买了一个Raspberry Shake® seismograph并将其设置在交通监视器下方的三层楼的一楼。这是Mathworks总部的家中设备的图片,与流量数据相比,过滤后的地震数据的快照。

“摇动”已经使数据在云中可用。但是有了ThingsPeak,我可以设置一个自动化过程,以过滤原始数据并使用流量数据绘制它。现在我能see the comparison data每当我需要并用实时数据验证预测时。例如,我可以看到在高峰时段,交通强度的增加存在相关性。最近,在一次大降雪期间,我能够验证(从雪地)验证地震数据与较低的交通数字相关(从远离路上的旅行者那里。

这是实现此操作的过程,并带有一些代码提示(虽然不是完整的脚本)。

  1. 使用FSDN RESTFULES服务APIto read the data in MATLAB from the shake and filter it to 1 second or less resolution so you can write it to a ThingSpeak channel.
urlQuery =... 'https://data.raspberryshake.org/fdsnws/dataselect/1/query?starttime=2022-02-28T00:30:00&endtime=2022-02-28T01:00:00&network=AM&station=RF23B' data = webread(urlQuery);

2. If you usedMATLAB分析in ThingSpeak, then you can set up aTimeControlto get the data at regular intervals; I chose 5 minutes, so the data is nearly live.

3. UseMATLAB visualizationsto read the traffic monitor data and the filtered shake data, and plot over the same time range.

mydata = themingpeakRead(channelId,'depaterange',[starttime,endtime],'outputformat','timetable');

地震数据通常会模仿流量数据,但没有100%的相关性。原因之一可能是夜间开车的卡车可能会发生大型的地震活动,但在网络摄像头数据中仅显示一项计数。另一个问题是,从道路到地震探测器的距离至少为100 m,许多地面振动可能会抑制或散射。最后,在比较数据中,建筑振动仍然存在一些。

The building makes a lot of noise so choosing the right frequencies for a band pass filter is important to get good comparison data. Since the processing is done in MATLAB, it’s easy to generate anFFT光谱并将夜间数据(当汽车较少)与白天数据进行比较,也许在高峰时段,当时流量最高。这是一个比较frequency spectrafor the start of rush hour and the middle of the night.

The difference line (in yellow) does not have a specific value since the two FFT’s are not normalized, but it provides a hint of where to look for differences. Choosing the right frequencies removes features in the seismic data that do not match the traffic data, as expected. Note the missing building noise features in the plots below.

The real benefit to live IoT data is that you can view the plots whenever and wherever you need them. For example, when the road gets closed, or the local quarry is blasting rocks, you can see how the live data responds when you ae looking for particular features or insights.

|
  • 打印
  • 发送电子邮件

评论

要,请,请点击此处登录到您的 MathWorks 帐户或创建一个新帐户。