April 12, 2019
I've built my own speed camera and traffic monitor from a Rasp Pi. I'm using Node-red to upload data to Thingspeak using a http Post request every minute. It uploads a row for every vehicle the camera sees. (it's not a major road so not huge volume).
I'm new to ThingSpeak but have managed to build an app to run every hour to count the number of vehicles passing the camera over the last 60 minutes. I use
"data = thingSpeakRead(readChannelID, 'Fields',[1,2],'ReadKey', readAPIKey,'NumMinutes', 60, 'OutputFormat', 'timetable');"
All was working well until the UK (where I am) switched to summer time. Since then I started getting very high values for traffic volume. I eventually worked out that it was actually counting 2 hours of data rather than just 60 minutes. In fact if I change the NumMinutes parameter to say 3, then it counts 63 minutes of data. So it just adds 60 mins to whatever I specify. Clearly something amiss re timezones but not sure what I need to fix.
March 7, 2017
I will look into the time zone discrepancy.
In the meantime, you can use the 'NumPoints' name value pair to read 60 points if your pi posting is relatively consistent.
You can get a lot more control using a MATLAB analysis to do your calculations. You still need to use thingSpeakRead() to read the data, but if you use the timetable format, you could use retime() to calculate the 60 minute average for up to 8000 points at once.
You could also count the rows or use duration values to make comparisons and be sure you have only one hour of data.
What are you using for image processing? We have a traffic monitor using Simulink and computer vision and image processing toolboxes in MATLAB to process data on a Rasberry Pi.
It looks out to Rte 9, a fairly busy highway in front of our headquarters.
April 12, 2019
Thanks for the info.
I'm using OpenCV on the Pi. it's allows me to measure individual vehicle speeds (as long as I don't have 2 cars passing in front of the camera at the same time which doesn't occur very often).
Although I post data every minute it is a variable number of data points. i send one data point per vehicle. This allows me to record individual speeds of the cars and work out average speeds as well as traffic density. So I can't use NumPoints = 60 as that wouldn't reliably give me an hour.
I've used the retime function on some of the code when I'm analysing a day's worth of data. But with the hourly process I'm trying to write the resultant hourly count to a new channel so i can then later on do further processing across a longer timescale. I'll have another look at retime and see if I can use that differently to what I've done before.
March 7, 2017
Thanks for the info about your counter. There are almost always multiple cars in the frame for us, but we aren't getting speeds.
I tried setting my timezone to London and reading a channel with
Timestamps WindDirectionNorth0Degrees WindSpeedmph Humidity TemperatureF RainInchesminute PressureHg PowerLevelV LightIntensity
____________________ __________________________ ____________ ________ ____________ ________________ __________ ___________ ______________
16-Apr-2019 15:26:02 143 7.4 31 51.9 0 29.6 3.4 38
16-Apr-2019 15:27:04 99 8 31 52 0 29.6 3.4 38
16-Apr-2019 15:28:07 4 6 31 52.1 0 29.6 3.4 58
I get three entries, definitely not over an hour of data. Is your channel public? I can look at the data and try to read your channel to see if I can reproduce the error.
Most Users Ever Online: 166
Currently Browsing this Page:
Guest Posters: 1
Newest Members:porosh2019, KellyBrise, sunainakhanna, flail, sathwik, samlewis02
Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457