Have you ever wished you could be notified when you are about to reach near Speed Cameras or some of your favorite locations?. With this project you’ll learn how to build a simple & low cost “GPS Speed Camera Detector” that does exactly that by comparing the current location. Furthermore you get complete control of the following parameters:
- current locations
This project is a great example of using an Adafruit-Ultimate GPS Module. You can even use the knowledge and code from this project to add more interesting features to add value your own Arduino projects.
Step 1: How Does It Work?.
Below diagram depicts the actual locations of Fixed Speed Camera around Mauritius Island, locations for the Fix Cameras were captured and manually exported to an array inside the Arduino module.
Locations of fixed speed cameras around Mauritius [link]
Getting locations is very easy!! Simply click on any location in google map, locations in Decimal Degree will be automatically generated for you… and you can simple import the geometry coordinates into your sketch.. thanks to google!!.
The GPS module collects the current location at a rate of 1Hz interval, the arduino perform a simple mathematical function to find distance based on latitude and longitude using the Haversine formula. The Arduino then triggers a sound alert if calculated distance is within the fix speed camera range in this example the distance is set to 100m. Equation used.
dlon = lon2 - lon1
dlat = lat2 - lat1 a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2 c = 2 * atan2( sqrt(a), sqrt(1-a) ) d = R * c (where R is the radius of the Earth)
For more info: Haversine formula
NOTE: This project will be mainly focused on the Fixed Speed Camera around Mauritius, but the scope is not only limited to the geography of Mauritius. This can be further developed and can be used in any country around the world.
Step 3: Hardware
To build this project you’ll need the following hardware and tools:
- Arduino uno.
- Ultimate GPS Module.
- Piezo sounder.
- Dupont cable.
- One 1/4 watt resistor: ~100 ohm.
Step 4: Wiring:
Step 5: Source Code:
You can of course find the complete library in my GitHub repository for this project here. Unpack this archive and import the Adafruit_GPS folder to the the following path.
C:\Program Files (x86)\Arduino\libraries
Note: I have modified the library to include the conversion from Decimal Minutes (DM) to Decimal Degree (DD), as we will be working in Decimal Degree.
Once you have successfully imported the library, it time to prepare the Arduino with the “GPS Speed Camera Detector” sketch which you can find here.
Congratulations, you just built an Arduino Speed Camera Detector project. Of course, you can use the codes in this project to interface other modules like the famous GSM module.
I hope you like the post and hope this tutorial helps you find a way to implement your own Arduino Speed Camera Detector project and please let me know for any of your improvements! Have Fun.. Cheerz…
Thanks for reading.