SpeedCam – Getting the Data

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.

I set up two different lanes.  Lane 1 is for West bound traffic and Lane 2 is for East bound traffic.  In the settings you can specify what the delimiter.  You can also use the software to save a picture of the vehicle, and clean up the reports.

With SpeedCam AI writing the details of traffic to a csv file, Splunk can easily ingest the data.

Installing Splunk on Windows
Installing Splunk on Linux

Adding the data to Splunk:
Once you log in to Splunk, you should see an “Add Data” button.

There is a couple options for bringing the data in.  Select “Monitor” to be able to continuously bring in the data.

You will then want to select “Files & Directories”.

Click “Browse” to select your “reports.csv” file and then click “Next”.

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.

It should prompt you to save your custom sourcetype.  Click Save.

I gave the sourcetype name as “speedcam”.  I then gave it a description and left the category and app the defaults and then click Save.

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 ##
[monitor://c:\program files(86)\SpeedCam\reports\reports.csv]
sourcetype = speedcam

## props.conf ##
[speedcam]
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.

Basic Searching in Splunk
Creating Reports in Splunk Enterprise
Create Dashboards in Splunk Enterprise

ElectroSmash pedalShield Mega – Part 1

My oldest son has been getting really in to music lately.  He has taught himself guitar, bass, ukulele, piano, and most recently violin.  Having an electrical background, I started to look at the different ways the pedals and guitars are put together.  I started to look at the pedal clones and wanted to do a pedal for my son.  After looking around I saw the pedalShield series.  I like working with Arduinos and Raspberry Pis as you still get to use real components and easily interact with them. The pedalShield Mega looked interesting as it has an LED screen on it to help you see your effects.  I was also interested in being able flash new effects on the pedal as needed.

I have decided to give it a go and have ordered the pedalSHIELD MEGA Kit.  They give you all the schematics and part numbers (minus the LED) to order them yourself from Mouser.  Pricing it out, you do save money ordering the kit directly from ElectroSmash.  The only problem for me is that it is international shipping so a bit of a wait.  I also needed to order the Arduino Mega 2560 board.  That is the brains of the programmable pedal.  My normal go to is Adafruit.  On their site it lists the board as discontinued (link).  After reading a few reviews, I decided to go with a clone board from Amazon.  I went with the Elegoo LYSB01H4ZDYCE-ELECTRNCSMEGA 2560 R3 Board.  While I was on the Amazon site, I felt that to do the job properly I need a new soldering iron, helping hands, and cutter.  The quick math is that I will be doing around 141 solder points for this project.

So far I have spent $108.92 on the project:
$14.86 – Arduino Mega 2560 Clone
$25.85 – Tools
$00.00 – Amazon Prime Shipping
$53.84 – ElectroSmash Kit
$14.37 – Shipping from ElectroSmash

I will still need to get some stand offs to make sure everything is nice and stable when he steps on the pedal and the case enclosure.

I have been going through the forums and looking at the work other have already done with the programming.  I look forward to this project as I haven’t done a project like this in a while.