I recently got to be in be on the news for a fun project (see the bottom of the article for the video). We have had issues with cars speeding down our street. I have had the traffic department place the street sign that showed your speed down the street. This did give us some data, but people seeing the signs changed their driving during that drive only.
Being a person that works with data, I thought there has to be a way to track this data source. I tried to build my own system to track the cars going by. After trying a few different things, Arduino and Raspberry Pi, I started reading on using a webcams to track cars.
My setup is as followed:
Camera: HIKVision IP Camera (but a USB camera will work also as shown in the news video)
Power Injector: TP-LINK TL-PoE150S
Computer: Dell Laptop running Windows 10
Speed Camera Software: SpeedCam AI
Data Analyst Tool: Splunk
I tried a few different programs and found SpeedCam AI. This program let me draw a rectangle and define the distance. I know that the sections of the street are 15 feet (4.572 meters) in length.
You should see a preview of your data. You will see that Splunk has identified the data in a csv file. Since the file doesn’t have a header row, you will need to give it one. In the delimited settings, in the Field names section, click Custom. In this example I used “datestamp,lane,speed,speedLabel”. Then click next to continue.
On the next page we can set the hostname for the data stream. Normally you can leave this the default. In a production environment, we would also want to choose our index. For this example, I am going to leave it as “Default”. At this point we can click “Review”.
You can review the setting and then click Submit and it will start bringing in your data.
For the Command Line People
## inputs.conf ##
sourcetype = speedcam
## props.conf ##
INDEXED_EXTRACTIONS = CSV
FIELD_DELIMITER = ,
FIELD_NAMES = datestamp,lane,speed,speedLabel
CHECK_FOR_HEADER = false
SHOULD_LINEMERGE = false
At this point, you have the SpeedCam AI software running and Splunk bringing the data in. I will follow up with another post on the Splunk App I have written. In the mean time, here are a few videos on searching and reporting in Splunk.