how to get speed limit from latitude and longitude using microcontroller

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I want to design a GPS car tracker with SIM808. Right now I can get GPS data including latitude, longitude, speed, and ... from SIM808. I want to be able to get the legal speed limit for the latitude and longitude of the place using a microcontroller. How can I do this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Your question has little to do with a microcontroller, but rather where would a database of such info exist, once you know that, then how to access it, ie. is it publicly available?

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes, that's true I only mentioned the microcontroller for clarification because the microcontroller has to extract the speed limit from the database by knowing latitude and longitude. the main question is how to have access to this type of database? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All this kind of stuff is bound to be in standard GPS libraries. Do you really want to reinvent the wheel? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

broadfire2014 wrote:
how to have access to this type of database? 

A lot of googling!

 

It's probably going to be at least one database per country. Add different countries/areas will undoubtedly have different access requirements - I wouldn't assume they'd all be free.

 

Also, different countries/areas will most likely have different (and incompatible) APIs. Maybe some don't have real-time APIs at all ...

 

And don't forget that in some (many?) areas the limit will depend on the type & configuration of the vehicle

 

etc, etc, etc, ...

 

The microcontroller part is going to be the easy bit - the hard part will be in getting all that back-end stuff together!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Aug 30, 2021 - 03:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
The microcontroller part is going to be the easy bit - the hard part will be in getting all that back-end stuff together!

That was what I was alluding too in #2, thanks for stating it clearly!   +1

 

Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In addition to the above, I think that Garmin, etc., use significant A.I. to determine exactly which road an individual is traveling on.

Then the info for that road is pulled from the data base for info on the lanes, exits, speed limits, etc.

 

It isn't enough "just" to know one's Lat & Long.

That info, coupled with speed, heading, info on where the system currently thinks the individual is, and options for alternative roads that they could be on, (an exit ramp, a parallel road, etc.), all play into deciding which road the user is on.

 

Garmin has  quite a large engineering team to work this all out!

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
Garmin has  quite a large engineering team to work this all out!
  And from the construction cranes, it's getting bigger, I live only a couple of miles from there.

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have seen highways with "High Occupancy Vehicle" or "Commuter" LANES within the highway that have different speed limits. So, you can have different limits in just 6-8 meters horizontal.

 

Then, highways go over or under other highways. Which speed limit applies at that lat/lon?

 

'Tis not a simple question.

 

Then, in the U.S., you have speed limits set by cities, and by counties, and by states. Then you have national parks and Indian reservations and such, which might have their own limits. State of Oregon has 36 counties but State of Missouri has 114 and Texas has 254. I will bet that many, many, of those counties have no accessible database of speed limits!

 

Again, 'tis not a simple question.

 

And, I know many counties where large parts of the county do not even have cell service. StarLink or similar?

 

Yet again, 'tis not a simple question!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know in France that Autoroute (Motorway) speed limits decrease from 130km/h to 110km/h when it is raining or very poor visibility.

So now your little AVR has to subscribe to a weather service.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:

I know in France that Autoroute (Motorway) speed limits decrease from 130km/h to 110km/h when it is raining or very poor visibility.

So now your little AVR has to subscribe to a weather service.

 

Or monitor wiper operation!

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
I think that Garmin, etc., use significant A.I. to determine exactly which road an individual is traveling on.

indeed.

 

You can see it happening: it thinks you're on one road, you turn off unexpectedly - but it keeps tracking you on the other road for a while until it realises ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

I have seen highways with "High Occupancy Vehicle" or "Commuter" LANES within the highway that have different speed limits. So, you can have different limits in just 6-8 meters horizontal.

 

In Mexico City I saw three lanes, each with different speed limits.  On those roads cars regularly drove four abreast.  I asked my driver "What speed limit applies?" and he just sorta shrugged.  I shut up and let him drive.  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok just to clarify assume the device is connected to a normal-sized car in a city in Iran (my country)

based on my searches on the net I should get a functional class for the latitude and longitude using a Reverse geocoder request and using an API will get me the speed limit but I'm stuck at finding the functional class for the desired latitude and longitude. I tried a free API that was only for the UK and it showed a forbidden error. 

Last Edited: Mon. Aug 30, 2021 - 11:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

It is not impossible to use a camera to recognize speed limit signs, and once that can be reliably done, driving around a lot, but as has been pointed out before, this is a job for engineering companies with dozens of engineers and half a billion (US$) budgets.  Yeah, it can be done - but not on the cheap.

 

S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think that Garmin, etc., use significant A.I.

And probably a very large database, by microcontroller standards.  Big flash chips are pretty cheap.  (Accessing big databases, not so cheap.  I expect that there's also a lot of rather proprietary data structure and access algorithms involved.)

 

Google Maps can apparently show you speed limits.  There might be a machine-oriented API that would allow you to look that up based on lat/long.  If you have an internet connection.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

And probably a very large database, by microcontroller standards.  Big flash chips are pretty cheap.  (Accessing big databases, not so cheap.  I expect that there's also a lot of rather proprietary data structure and access algorithms involved.)

 

A basic Sat Nav seems to typically have at least 4Gbytes of internal memory for the map database.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
Google Maps can apparently show you speed limits.  

Yes, it does. I've noticed the limit icon, but not paid much attention to it to see how reliable it is ...

 

It also shows (some) speed camera locations.

 

If you have an internet connection

Google maps navigation eats data like it's going out of fashion! surprise

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

70mph is over 30 metres per second - so you would need to be able to predict the vehicle's path well over 30m in advance to make a useful notification to the driver ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...