Speed Camera Support

Support for detection of speed cameras is included but is not available unless the following are satisfied:

  • You must have a working u-blox USB GPS receiver
  • You must have speed camera data for your area in the appropriate CSV file format.

CSV File Format

Speed camera files are CSV format and should contain the following columns:

<latitude>,<longitude>,<speed limit>,<speed camera type>

Where <latitude> is a signed decimal latitude

<longitude> is a signed decimal longitude

<speed limit> the limit in miles per hour. Specify 0 if not known.

<speed camera type> is either 0 - fixed speed camera, 1 Red light camera, 2 mobile camera, and 3 average camera. SDC currently ignores this field.

Example data

50.72563,-3.65769,70,0
50.7257,-3.65507,70,0
50.62653,-3.54642,70,0
50.65582,-3.5408,70,0
51.58837,0.22098,40,0
51.50249,0.28418,40,0
51.48472,0.31941,40,0
51.6593,0.27031,40,0
51.77797,-4.01991,30,0
51.79522,-3.97687,30,0
51.57066,-3.75205,30,0
51.63372,-3.94936,30,0
51.65221,-3.94865,30,0
51.64917,-3.94815,30,0
51.63027,-3.94365,30,0
51.80464,-3.92861,30,0
51.65628,-3.92646,30,0
51.6722,-3.91883,30,0
51.67517,-3.91679,30,0
51.65058,-3.89981,30,0
51.55285,-0.11248,0,1
51.5408,-0.09621,0,1
51.54669,-0.08744,0,1
51.5466,-0.0866,0,1
51.50113,-0.07779,0,1
51.50257,-0.07732,0,1
51.48846,-0.07688,0,1

General and Personal camera lists

By default the speed camera list is loaded from a file in the root directory of the SD card called “speedcameralist.csv”. In addition to this, SDC also loads any cameras from an additional file called “personalcameras.csv”. Both files have the same format as above.

The reason for having two files is so that you can use a third party source for speed camera data and still have the option of adding in other cameras that your third party source does not yet include. By putting those in the personal camera list you can safely update the main list from your third party source without losing any cameras you added yourself.

GPS Requirements

In order for speed camera detection to work you need a specific GPS receiver. This is a ublox-7 USB GPS receiver. It is also often referred to as a vk-172 or vk172

In my testing of GPS, I found that the GPS receiver needs to be kept away from the Raspberry Pi. When plugged directly into the Pi’s USB port, even with line of sight to the sky, I found that the EMI coming from the Pi interfered with it too much and it could not get a satellite lock. You will need to connect the USB receiver using a USB extension cable not only because of this but because it needs to sit with a clear view of the sky. If you are bench testing, bear this in mind - GPS is unlikely to work with it plugged straight in to the side of the Pi.

Setting up speed camera detection

To set up speed camera detection you need three elements:

  1. A source of speed camera data
  2. A GPS receiver
  3. A composite page that you can use as a warning when a speed camera is detected.

To enable speed camera detection simply copy a primary camera file to the root folder and start the device. If you have a GPS position then camera detection will begin.

In order to see any warnings that are generated, you will need to add a composite page to to all of your cluster pages (or at least the ones you want to see the warning on). There is a sample composite warning page in the pages.xml sample that is shipped with SDC in the download.

The speed camera warning should be comprised of the following composite entry. For further details on how composite pages work, see the info on composite pages:

<composite page="16" x="810" y="182" xscale="1" yscale="1" highlightx="50" 
        highlighty="375" warningid="1193"></composite>

This composite uses warning ID 1193 which is the speed camera warning. It uses page 16. This means that whenever a speed camera is detected, SDC will show composite page 16 at the configured coordinates (810,182) – that’s roughly in the middle of my stretched bar display on my own car, where I have an area reserved for key information. You can see this in some of the videos I posted on my channel before SDC was released.

When a speed camera warning is shown, it will remain on the display until the camera goes out of range.

Speed Camera Warning Criteria

Warnings are generated based on time. As the detection system is based on GPS, you have to be moving for any warnings to be generated. No cameras will be considered to be close enough to alert you if you are sitting still, even if they are right next to you.

SDC uses your current speed to calculate the list of cameras that are within 15 seconds of your current position. This timeframe is intended to give you enough time to react without alerting you to cameras that you may never actually go directly past. Since SDC does not have any road-maps it uses line of sight in its calculations, and as such it could warn you about a camera on a nearby road (for example if you are crossing a bridge over a road with a camera underneath it). There aren’t many times when you’ll come across this scenario.

Once a list of candidate cameras has been generated using the 15 second time basis, the list is further filtered down to anything within a 30 degree arc of your current heading (15 degrees either side of your heading). The heading is again taken from GPS, so you must be moving for this to take effect. This whole calculation is executed once per second.

SDC calculates the distance to the nearest camera in metres. It makes this available in an attribute called ‘speedcameradistance’. This attribute is available for use on any gauge and will update on a 1 second interval. Again, you can see an example of usage on the demo shipped with the software.

Speed camera ‘radar’

SDC contains a gauge that can be used to display speed cameras in the vicinity. This is the ‘XYGauge’ as it was intended to be generic but so far is hard coded for speed camera display. See the XYGauge help for further information.